mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-08-17 14:50:57 +03:00
Generate a license directory that contains licenses missing from the installers (#15146)
* Add scripts to build a tree of licenses that are missing from the installers
* Add a line that was accidentally removed
* add steps in the build_license_directory script to install pip-licenses and license-checker
* Pip install pip-license
* Added commands to check the working dir in the build_license_direcotory.sh
* Fix the path for the npm commands
* Copy the library dir over
* Add a line to cd back to the previous dir in the build_licenses_directory.sh file
* Fix path to go back to "build_scripts"
* Fixing a typo with a path in the build_license_directory.sh file
* Troubleshoot path
* Change word from library to licenses
* Add a command to list contents of "dist/$CLI_DEB_BASE/opt/chia/" for troubleshooting
* Copy the license file to the "GUI" directory
* Fix the last for loop
* Move the step to change directory back to build scripts in the build_license_directory.sh file
* Add some more steps to troubleshoot the path and license-checker usage
* Fix a typo
* Add an "npm install ." before running the license-checker
* Fix a typo
* Change back to the build_scripts dir before the first loop in build_license_directory.sh file
* Revert "Change back to the build_scripts dir before the first loop in build_license_directory.sh file"
This reverts commit a3e88a2583
.
* Fix the path for moving the license file
* Change the first loop for printing licenses from npm license-checker
* Add steps to copy the license file over to the builds and comment out the "npm install ." step out of the build_license_firectory script
* Add npm ci to the build_license_directory file
* Adding a dir for troubleshooting
* Fix errors in the scripts
* Fix a path to the licenses file
* Remove a dir from the windows installer script
* Remove a copy command
* Remove a few more copy commands
* Adding a ps1 script for usage in the windows installer build script
* Replace the powershell script
* Made a couple changes to the ps1 script for building the license directory
* Remove the ps1 script for building the license dir
* Add a new script for the windows installer to build the license dir
* Fix issues with the code for windows
* Remove the -1 from NF
* Changing the script for windows to test
* Remove filename=$(basename "$i")
* Remove some ls command lines
* Add "cp -r dist/daemon ../chia-blockchain-gui/packages/gui" to the RPM installer script
* Remove "|| 'exit" or "cd' || return" from when CD'ing in the license creation scripts
* Remove extra set of ||
This commit is contained in:
parent
7a5f0ffac5
commit
3a2dc484b5
55
build_scripts/build_license_directory.sh
Normal file
55
build_scripts/build_license_directory.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# PULL IN LICENSES USING NPM - LICENSE CHECKER
|
||||||
|
npm install -g license-checker
|
||||||
|
|
||||||
|
cd ../chia-blockchain-gui || exit 1
|
||||||
|
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
sum=$(license-checker --summary)
|
||||||
|
printf "%s\n" "$sum"
|
||||||
|
|
||||||
|
license_list=$(license-checker --json | jq -r '.[].licenseFile' | grep -v null)
|
||||||
|
|
||||||
|
# Split the license list by newline character into an array
|
||||||
|
IFS=$'\n' read -rd '' -a licenses_array <<< "$license_list"
|
||||||
|
|
||||||
|
#print the contents of the array
|
||||||
|
printf '%s\n' "${licenses_array[@]}"
|
||||||
|
|
||||||
|
for i in "${licenses_array[@]}"; do
|
||||||
|
dirname="licenses/$(dirname "$i" | awk -F'/' '{print $NF}')"
|
||||||
|
mkdir -p "$dirname"
|
||||||
|
echo "$dirname"
|
||||||
|
cp "$i" "$dirname"
|
||||||
|
done
|
||||||
|
|
||||||
|
mv licenses/ ../build_scripts/dist/daemon
|
||||||
|
cd ../build_scripts || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
# PULL IN THE LICENSES FROM PIP-LICENSE
|
||||||
|
pip install pip-licenses || pip3 install pip-licenses
|
||||||
|
|
||||||
|
# capture the output of the command in a variable
|
||||||
|
output=$(pip-licenses -l -f json | jq -r '.[].LicenseFile' | grep -v UNKNOWN)
|
||||||
|
|
||||||
|
# initialize an empty array
|
||||||
|
license_path_array=()
|
||||||
|
|
||||||
|
# read the output line by line into the array
|
||||||
|
while IFS= read -r line; do
|
||||||
|
license_path_array+=("$line")
|
||||||
|
done <<< "$output"
|
||||||
|
|
||||||
|
# create a dir for each license and copy the license file over
|
||||||
|
for i in "${license_path_array[@]}"; do
|
||||||
|
dirname="dist/daemon/licenses/$(dirname "$i" | awk -F'/' '{print $NF}')"
|
||||||
|
echo "$dirname"
|
||||||
|
mkdir -p "$dirname"
|
||||||
|
cp "$i" "$dirname"
|
||||||
|
echo "$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
ls -lah dist/daemon
|
@ -44,6 +44,12 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|||||||
exit $LAST_EXIT_CODE
|
exit $LAST_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Creates a directory of licenses
|
||||||
|
echo "Building pip and NPM license directory"
|
||||||
|
pwd
|
||||||
|
bash ./build_license_directory.sh
|
||||||
|
|
||||||
|
|
||||||
# Builds CLI only .deb
|
# Builds CLI only .deb
|
||||||
# need j2 for templating the control file
|
# need j2 for templating the control file
|
||||||
pip install j2cli
|
pip install j2cli
|
||||||
@ -53,6 +59,7 @@ mkdir -p "dist/$CLI_DEB_BASE/usr/bin"
|
|||||||
mkdir -p "dist/$CLI_DEB_BASE/DEBIAN"
|
mkdir -p "dist/$CLI_DEB_BASE/DEBIAN"
|
||||||
j2 -o "dist/$CLI_DEB_BASE/DEBIAN/control" assets/deb/control.j2
|
j2 -o "dist/$CLI_DEB_BASE/DEBIAN/control" assets/deb/control.j2
|
||||||
cp -r dist/daemon/* "dist/$CLI_DEB_BASE/opt/chia/"
|
cp -r dist/daemon/* "dist/$CLI_DEB_BASE/opt/chia/"
|
||||||
|
|
||||||
ln -s ../../opt/chia/chia "dist/$CLI_DEB_BASE/usr/bin/chia"
|
ln -s ../../opt/chia/chia "dist/$CLI_DEB_BASE/usr/bin/chia"
|
||||||
dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE"
|
dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE"
|
||||||
# CLI only .deb done
|
# CLI only .deb done
|
||||||
|
@ -42,11 +42,17 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|||||||
exit $LAST_EXIT_CODE
|
exit $LAST_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Creates a directory of licenses
|
||||||
|
echo "Building pip and NPM license directory"
|
||||||
|
pwd
|
||||||
|
bash ./build_license_directory.sh
|
||||||
|
|
||||||
# Builds CLI only rpm
|
# Builds CLI only rpm
|
||||||
CLI_RPM_BASE="chia-blockchain-cli-$CHIA_INSTALLER_VERSION-1.$REDHAT_PLATFORM"
|
CLI_RPM_BASE="chia-blockchain-cli-$CHIA_INSTALLER_VERSION-1.$REDHAT_PLATFORM"
|
||||||
mkdir -p "dist/$CLI_RPM_BASE/opt/chia"
|
mkdir -p "dist/$CLI_RPM_BASE/opt/chia"
|
||||||
mkdir -p "dist/$CLI_RPM_BASE/usr/bin"
|
mkdir -p "dist/$CLI_RPM_BASE/usr/bin"
|
||||||
cp -r dist/daemon/* "dist/$CLI_RPM_BASE/opt/chia/"
|
cp -r dist/daemon/* "dist/$CLI_RPM_BASE/opt/chia/"
|
||||||
|
|
||||||
ln -s ../../opt/chia/chia "dist/$CLI_RPM_BASE/usr/bin/chia"
|
ln -s ../../opt/chia/chia "dist/$CLI_RPM_BASE/usr/bin/chia"
|
||||||
# This is built into the base build image
|
# This is built into the base build image
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
@ -66,9 +72,7 @@ fpm -s dir -t rpm \
|
|||||||
--depends /usr/lib64/libcrypt.so.1 \
|
--depends /usr/lib64/libcrypt.so.1 \
|
||||||
.
|
.
|
||||||
# CLI only rpm done
|
# CLI only rpm done
|
||||||
|
|
||||||
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
|
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
|
||||||
|
|
||||||
# Change to the gui package
|
# Change to the gui package
|
||||||
cd ../chia-blockchain-gui/packages/gui || exit 1
|
cd ../chia-blockchain-gui/packages/gui || exit 1
|
||||||
|
|
||||||
|
@ -32,8 +32,14 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|||||||
echo >&2 "pyinstaller failed!"
|
echo >&2 "pyinstaller failed!"
|
||||||
exit $LAST_EXIT_CODE
|
exit $LAST_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
|
|
||||||
|
|
||||||
|
|
||||||
|
# Creates a directory of licenses
|
||||||
|
echo "Building pip and NPM license directory"
|
||||||
|
pwd
|
||||||
|
bash ./build_license_directory.sh
|
||||||
|
|
||||||
|
cp -r dist/daemon ../chia-blockchain-gui/packages/gui
|
||||||
# Change to the gui package
|
# Change to the gui package
|
||||||
cd ../chia-blockchain-gui/packages/gui || exit 1
|
cd ../chia-blockchain-gui/packages/gui || exit 1
|
||||||
|
|
||||||
|
54
build_scripts/build_win_license_dir.sh
Normal file
54
build_scripts/build_win_license_dir.sh
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# PULL IN LICENSES USING NPM - LICENSE CHECKER
|
||||||
|
npm install -g license-checker
|
||||||
|
|
||||||
|
cd ../chia-blockchain-gui || exit 1
|
||||||
|
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
sum=$(license-checker --summary)
|
||||||
|
printf "%s\n" "$sum"
|
||||||
|
|
||||||
|
license_list=$(license-checker --json | jq -r '.[].licenseFile' | grep -v null)
|
||||||
|
|
||||||
|
# Split the license list by newline character into an array
|
||||||
|
IFS=$'\n' read -rd '' -a licenses_array <<< "$license_list"
|
||||||
|
|
||||||
|
#print the contents of the array
|
||||||
|
printf '%s\n' "${licenses_array[@]}"
|
||||||
|
|
||||||
|
for i in "${licenses_array[@]}"; do
|
||||||
|
dirname="licenses/$(basename "$(dirname "$i")")"
|
||||||
|
echo "$dirname"
|
||||||
|
mkdir -p "$dirname"
|
||||||
|
cp "$i" "$dirname"
|
||||||
|
done
|
||||||
|
|
||||||
|
mv licenses/ ../build_scripts/dist/daemon
|
||||||
|
cd ../build_scripts || exit 1
|
||||||
|
|
||||||
|
# PULL IN THE LICENSES FROM PIP-LICENSE
|
||||||
|
pip install pip-licenses || pip3 install pip-licenses
|
||||||
|
|
||||||
|
# capture the output of the command in a variable
|
||||||
|
output=$(pip-licenses -l -f json | jq -r '.[].LicenseFile' | grep -v UNKNOWN)
|
||||||
|
|
||||||
|
# initialize an empty array
|
||||||
|
license_path_array=()
|
||||||
|
|
||||||
|
# read the output line by line into the array
|
||||||
|
while IFS= read -r line; do
|
||||||
|
license_path_array+=("$line")
|
||||||
|
done <<< "$output"
|
||||||
|
|
||||||
|
# create a dir for each license and copy the license file over
|
||||||
|
for i in "${license_path_array[@]}"; do
|
||||||
|
dirname="dist/daemon/licenses/$(basename "$(dirname "$i")")"
|
||||||
|
echo "$dirname"
|
||||||
|
mkdir -p "$dirname"
|
||||||
|
cp "$i" "$dirname"
|
||||||
|
echo "$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
ls -lah dist/daemon
|
@ -20,6 +20,11 @@ Write-Output " ---"
|
|||||||
$SPEC_FILE = (python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') -join "`n"
|
$SPEC_FILE = (python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') -join "`n"
|
||||||
pyinstaller --log-level INFO $SPEC_FILE
|
pyinstaller --log-level INFO $SPEC_FILE
|
||||||
|
|
||||||
|
Write-Output " ---"
|
||||||
|
Write-Output "Creating a directory of licenses from pip and npm packages"
|
||||||
|
Write-Output " ---"
|
||||||
|
bash ./build_win_license_dir.sh
|
||||||
|
|
||||||
Write-Output " ---"
|
Write-Output " ---"
|
||||||
Write-Output "Copy chia executables to chia-blockchain-gui\"
|
Write-Output "Copy chia executables to chia-blockchain-gui\"
|
||||||
Write-Output " ---"
|
Write-Output " ---"
|
||||||
|
Loading…
Reference in New Issue
Block a user