From 407512dc7bd81195f77a9e6244d246b258644dfd Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Thu, 30 Nov 2023 20:43:22 -0500 Subject: [PATCH 01/11] claim ownership of `/opt/chia` in the RPM This results in the directory being removed on package removal. When this doesn't happen we have observed odd behavior with `None` versions. --- build_scripts/build_linux_rpm-2-installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 293d45cb0cc6..76b76d8bba6f 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -64,6 +64,7 @@ rvm use ruby-3 # Marking as a dependency allows yum/dnf to automatically install the libxcrypt-compat package as well fpm -s dir -t rpm \ -C "dist/$CLI_RPM_BASE" \ + --directories "/opt/chia" \ -p "dist/$CLI_RPM_BASE.rpm" \ --name chia-blockchain-cli \ --license Apache-2.0 \ From 05b2fd49ee4dc2572c72a5fc95979fff6418652a Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Thu, 30 Nov 2023 22:17:31 -0500 Subject: [PATCH 02/11] also make gui package own `/opt/chia` --- build_scripts/build_linux_rpm-2-installer.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 76b76d8bba6f..6db39e390430 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -93,11 +93,13 @@ PRODUCT_NAME="chia" echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" + --config.rpm.packageName="chia-blockchain" \ + --config.rpm.fpm='["--directory=/opt/chia"]' npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" + --config.rpm.packageName="chia-blockchain" \ + --config.rpm.fpm='["--directory=/opt/chia"]' LAST_EXIT_CODE=$? ls -l dist/linux*-unpacked/resources From 9b0ec1f96d9d5d5600e6067bb85f76a3ab4a7932 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Thu, 30 Nov 2023 22:57:39 -0500 Subject: [PATCH 03/11] maybe this way? --- build_scripts/build_linux_rpm-2-installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 6db39e390430..64f388732e0d 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -94,12 +94,12 @@ echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" \ - --config.rpm.fpm='["--directory=/opt/chia"]' + --config.rpm.fpm="--directory=/opt/chia" npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" \ - --config.rpm.fpm='["--directory=/opt/chia"]' + --config.rpm.fpm="--directory=/opt/chia" LAST_EXIT_CODE=$? ls -l dist/linux*-unpacked/resources From cce082f878e807575a259710f10a6497d45603ec Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Thu, 30 Nov 2023 23:18:19 -0500 Subject: [PATCH 04/11] in the config file? --- build_scripts/build_linux_rpm-2-installer.sh | 6 ++---- build_scripts/npm_linux/package.json | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 64f388732e0d..76b76d8bba6f 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -93,13 +93,11 @@ PRODUCT_NAME="chia" echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" \ - --config.rpm.fpm="--directory=/opt/chia" + --config.rpm.packageName="chia-blockchain" npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" \ - --config.rpm.fpm="--directory=/opt/chia" + --config.rpm.packageName="chia-blockchain" LAST_EXIT_CODE=$? ls -l dist/linux*-unpacked/resources diff --git a/build_scripts/npm_linux/package.json b/build_scripts/npm_linux/package.json index 6a39a1ff2f94..545d735a6c38 100644 --- a/build_scripts/npm_linux/package.json +++ b/build_scripts/npm_linux/package.json @@ -14,5 +14,8 @@ }, "devDependencies": { "electron-builder": "^24.6.3" + }, + "rpm": { + "fpm": ["--directory=/opt/chia"] } } From ae60f7d2ad2b7c9531b63eb5ad82b8ebd819d701 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 08:54:18 -0500 Subject: [PATCH 05/11] use the config file --- build_scripts/build_linux_rpm-2-installer.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 76b76d8bba6f..782b6e3e7dee 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -91,10 +91,12 @@ if [ "$REDHAT_PLATFORM" = "arm64" ]; then fi PRODUCT_NAME="chia" echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ + --config=../../../build_scripts/npm_linux/package.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" npx electron-builder build --linux rpm "${OPT_ARCH}" \ + --config=../../../build_scripts/npm_linux/package.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" From f6f2b641c1f690b16e4d153a91ea3ad15d06e59a Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 09:09:15 -0500 Subject: [PATCH 06/11] separate --- build_scripts/build_linux_rpm-2-installer.sh | 4 ++-- build_scripts/npm_linux/electron-builder.json | 5 +++++ build_scripts/npm_linux/package.json | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 build_scripts/npm_linux/electron-builder.json diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 782b6e3e7dee..fdeebd01865c 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -91,12 +91,12 @@ if [ "$REDHAT_PLATFORM" = "arm64" ]; then fi PRODUCT_NAME="chia" echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ - --config=../../../build_scripts/npm_linux/package.json \ + --config=../../../build_scripts/npm_linux/electron-builder.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" npx electron-builder build --linux rpm "${OPT_ARCH}" \ - --config=../../../build_scripts/npm_linux/package.json \ + --config=../../../build_scripts/npm_linux/electron-builder.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" diff --git a/build_scripts/npm_linux/electron-builder.json b/build_scripts/npm_linux/electron-builder.json new file mode 100644 index 000000000000..21a8ba00b45f --- /dev/null +++ b/build_scripts/npm_linux/electron-builder.json @@ -0,0 +1,5 @@ +{ + "rpm": { + "fpm": ["--directory=/opt/chia"] + } +} diff --git a/build_scripts/npm_linux/package.json b/build_scripts/npm_linux/package.json index 545d735a6c38..6a39a1ff2f94 100644 --- a/build_scripts/npm_linux/package.json +++ b/build_scripts/npm_linux/package.json @@ -14,8 +14,5 @@ }, "devDependencies": { "electron-builder": "^24.6.3" - }, - "rpm": { - "fpm": ["--directory=/opt/chia"] } } From dad35a753ef402acfea7904bc10c9bdb453b8b1d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 11:37:33 -0500 Subject: [PATCH 07/11] edit existing config --- build_scripts/build_linux_rpm-2-installer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index fdeebd01865c..db21e23c1e96 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -90,13 +90,12 @@ if [ "$REDHAT_PLATFORM" = "arm64" ]; then OPT_ARCH="--arm64" fi PRODUCT_NAME="chia" +python -c 'import json, pathlib; path = pathlib.Path("../../package.json"); root = json.loads(path.read_text()); root.setdefault("rpm", {}); root["rpm"]["fpm"] = ["--directories=/opt/chia"]; path.write_text(json.dumps(root, indent=2))' echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ - --config=../../../build_scripts/npm_linux/electron-builder.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" npx electron-builder build --linux rpm "${OPT_ARCH}" \ - --config=../../../build_scripts/npm_linux/electron-builder.json \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ --config.rpm.packageName="chia-blockchain" From f9fab14c1a9f93833d6200cc4050f5c8da105c54 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 12:35:54 -0500 Subject: [PATCH 08/11] oops? maybe? --- build_scripts/build_linux_rpm-2-installer.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index db21e23c1e96..6e7bc273e933 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -84,13 +84,16 @@ cd ../chia-blockchain-gui/packages/gui || exit 1 cp package.json package.json.orig jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json +cat package.json | jq +python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); root.setdefault("rpm", {}); root["rpm"]["fpm"] = ["--directories=/opt/chia"]; path.write_text(json.dumps(root, indent=2))' +cat package.json | jq + echo "Building Linux(rpm) Electron app" OPT_ARCH="--x64" if [ "$REDHAT_PLATFORM" = "arm64" ]; then OPT_ARCH="--arm64" fi PRODUCT_NAME="chia" -python -c 'import json, pathlib; path = pathlib.Path("../../package.json"); root = json.loads(path.read_text()); root.setdefault("rpm", {}); root["rpm"]["fpm"] = ["--directories=/opt/chia"]; path.write_text(json.dumps(root, indent=2))' echo npx electron-builder build --linux rpm "${OPT_ARCH}" \ --config.extraMetadata.name=chia-blockchain \ --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ From 060fd9fa0c2d629f8e8a9814b25b56ac7382bb15 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 13:10:07 -0500 Subject: [PATCH 09/11] right place now? --- build_scripts/build_linux_rpm-2-installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 6e7bc273e933..ce5103410732 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -85,7 +85,7 @@ cp package.json package.json.orig jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json cat package.json | jq -python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); root.setdefault("rpm", {}); root["rpm"]["fpm"] = ["--directories=/opt/chia"]; path.write_text(json.dumps(root, indent=2))' +python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); build = root.setdefault("build", {}); fpm = build.setdefault("fpm", []); fpm.append("--directories=/opt/chia"); path.write_text(json.dumps(root, indent=2))' cat package.json | jq echo "Building Linux(rpm) Electron app" From 215d6a7a2137d9f31a8d52cc7d016680ea740ec2 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 13:34:38 -0500 Subject: [PATCH 10/11] blah --- build_scripts/build_linux_rpm-2-installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index ce5103410732..d8410f42ef7c 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -85,7 +85,7 @@ cp package.json package.json.orig jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json cat package.json | jq -python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); build = root.setdefault("build", {}); fpm = build.setdefault("fpm", []); fpm.append("--directories=/opt/chia"); path.write_text(json.dumps(root, indent=2))' +python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); build = root.setdefault("build", {}); rpm = build.setdefault("rpm", {}); fpm = rpm.setdefault("fpm", []); fpm.append("--directories=/opt/chia"); path.write_text(json.dumps(root, indent=2))' cat package.json | jq echo "Building Linux(rpm) Electron app" From 40ae6882a3f292dd7b218cf88318e4db77647a8b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 1 Dec 2023 17:10:15 -0500 Subject: [PATCH 11/11] tidy --- build_scripts/build_linux_rpm-2-installer.sh | 4 ---- build_scripts/npm_linux/electron-builder.json | 5 ----- 2 files changed, 9 deletions(-) delete mode 100644 build_scripts/npm_linux/electron-builder.json diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index d8410f42ef7c..76b76d8bba6f 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -84,10 +84,6 @@ cd ../chia-blockchain-gui/packages/gui || exit 1 cp package.json package.json.orig jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json -cat package.json | jq -python -c 'import json, pathlib; path = pathlib.Path("package.json"); root = json.loads(path.read_text()); build = root.setdefault("build", {}); rpm = build.setdefault("rpm", {}); fpm = rpm.setdefault("fpm", []); fpm.append("--directories=/opt/chia"); path.write_text(json.dumps(root, indent=2))' -cat package.json | jq - echo "Building Linux(rpm) Electron app" OPT_ARCH="--x64" if [ "$REDHAT_PLATFORM" = "arm64" ]; then diff --git a/build_scripts/npm_linux/electron-builder.json b/build_scripts/npm_linux/electron-builder.json deleted file mode 100644 index 21a8ba00b45f..000000000000 --- a/build_scripts/npm_linux/electron-builder.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rpm": { - "fpm": ["--directory=/opt/chia"] - } -}