From 00cc580c86a8ede602804683ed1a30a03e371015 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Thu, 14 Nov 2024 10:02:15 +0100 Subject: [PATCH] fix release script --- contrib/release/release.sh | 12 +++--- contrib/reproducible/docker/docker-build.sh | 8 +--- contrib/reproducible/docker/macos_cmd.sh | 25 +++++------- contrib/reproducible/docker/windows_cmd.sh | 1 + contrib/reproducible/guix/build.sh | 27 ++++++++----- contrib/reproducible/guix/guix-build.sh | 29 ++------------ contrib/reproducible/guix/manifest.scm | 42 +++++++++------------ 7 files changed, 56 insertions(+), 88 deletions(-) diff --git a/contrib/release/release.sh b/contrib/release/release.sh index 698dc9a5d..8e4e6e61d 100755 --- a/contrib/release/release.sh +++ b/contrib/release/release.sh @@ -38,13 +38,13 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh ( cd "$BUILD_DIR" create_dir "$LINUX_DIR_NAME" - cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md "$LINUX_DIR_NAME" + cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md "$LINUX_DIR_NAME" tar -czf "$LINUX_ARCHIVE" "$LINUX_DIR_NAME" cp "$LINUX_ARCHIVE" "$RELEASE_DIR" unzip ../contrib/release/debian/package.zip sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./package/DEBIAN/control - cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md ./package/usr/bin/ + cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md ./package/usr/bin/ DIRNAME="liana_$VERSION-1_amd64" mv ./package "$DIRNAME" dpkg-deb -Zxz --build "$DIRNAME" @@ -55,23 +55,23 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh ( cd "$BUILD_DIR" create_dir "$WINDOWS_DIR_NAME" - cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME" + cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME" zip -r "$WINDOWS_ARCHIVE" "$WINDOWS_DIR_NAME" cp "$WINDOWS_ARCHIVE" "$RELEASE_DIR" - cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe" + cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe" ) # Create the MacOS archive and a zipped application bundle of liana-gui. ( cd "$BUILD_DIR" create_dir "$MAC_DIR_NAME" - cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME" + cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME" tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME" cp "$MAC_ARCHIVE" "$RELEASE_DIR" unzip ../contrib/release/macos/Liana.app.zip sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist - cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana + cp "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana zip -ry Liana-noncodesigned.zip Liana.app cp ./Liana-noncodesigned.zip "$RELEASE_DIR/" diff --git a/contrib/reproducible/docker/docker-build.sh b/contrib/reproducible/docker/docker-build.sh index 4e8c747a1..2e42de529 100755 --- a/contrib/reproducible/docker/docker-build.sh +++ b/contrib/reproducible/docker/docker-build.sh @@ -16,15 +16,13 @@ docker run --rm -ti \ -v "$PWD/Cargo.toml":/liana/Cargo.toml \ -v "$PWD/Cargo.lock":/liana/Cargo.lock \ -v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \ - -v "$PWD/liana/Cargo.lock":/liana/liana/Cargo.lock \ -v "$PWD/liana/src":/liana/liana/src \ -v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \ - -v "$PWD/liana-gui/Cargo.lock":/liana/liana-gui/Cargo.lock \ -v "$PWD/liana-gui/src":/liana/liana-gui/src \ -v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \ - -v "$PWD/liana-ui/Cargo.lock":/liana/liana-ui/Cargo.lock \ -v "$PWD/liana-ui/src":/liana/liana-ui/src \ -v "$PWD/liana-ui/static":/liana/liana-ui/static \ + -v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \ liana_cross_win @@ -42,15 +40,13 @@ docker run -ti \ -v "$PWD/Cargo.toml":/liana/Cargo.toml \ -v "$PWD/Cargo.lock":/liana/Cargo.lock \ -v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \ - -v "$PWD/liana/Cargo.lock":/liana/liana/Cargo.lock \ -v "$PWD/liana/src":/liana/liana/src \ -v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \ - -v "$PWD/liana-gui/Cargo.lock":/liana/liana-gui/Cargo.lock \ -v "$PWD/liana-gui/src":/liana/liana-gui/src \ -v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \ - -v "$PWD/liana-ui/Cargo.lock":/liana/liana-ui/Cargo.lock \ -v "$PWD/liana-ui/src":/liana/liana-ui/src \ -v "$PWD/liana-ui/static":/liana/liana-ui/static \ + -v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \ -v "$XCODE_PATH":"/liana/$XCODE_FILENAME" \ -e XCODE_PATH="/liana/$XCODE_FILENAME" \ liana_cross_mac diff --git a/contrib/reproducible/docker/macos_cmd.sh b/contrib/reproducible/docker/macos_cmd.sh index 89b915e54..dd45f1498 100755 --- a/contrib/reproducible/docker/macos_cmd.sh +++ b/contrib/reproducible/docker/macos_cmd.sh @@ -29,25 +29,18 @@ cd .. # Finally build the projects using the toolchain just created. alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo" -PATH="$PATH:$PWD/osxcross/target/bin/" \ - CC=o64-clang \ - CXX=o64-clang++ \ - RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \ - cargo rustc \ +for package_name in "liana" "liana-gui"; do + PATH="$PATH:$PWD/osxcross/target/bin/" \ + CC=o64-clang \ + CXX=o64-clang++ \ + RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \ + cargo rustc \ + -p "$package_name" \ --target x86_64-apple-darwin \ --release - -cd gui/ -PATH="$PATH:$PWD/../osxcross/target/bin/" \ - CC=o64-clang \ - CXX=o64-clang++ \ - RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \ - cargo rustc \ - --target x86_64-apple-darwin \ - --release -cd .. +done # Avoid having to get root on the host to remove the target dir. -chmod -R a+rw target/ gui/target +chmod -R a+rw target/ set +xe diff --git a/contrib/reproducible/docker/windows_cmd.sh b/contrib/reproducible/docker/windows_cmd.sh index 14a8a2aa7..b087a7cb1 100755 --- a/contrib/reproducible/docker/windows_cmd.sh +++ b/contrib/reproducible/docker/windows_cmd.sh @@ -11,6 +11,7 @@ set -xe alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo" RUSTFLAGS="-Clink-arg=-Wl,--no-insert-timestamp" \ cargo rustc \ + -p liana-gui \ --release \ --target x86_64-pc-windows-gnu diff --git a/contrib/reproducible/guix/build.sh b/contrib/reproducible/guix/build.sh index a768a0469..9af2d6624 100755 --- a/contrib/reproducible/guix/build.sh +++ b/contrib/reproducible/guix/build.sh @@ -24,18 +24,25 @@ branch = "patch-0.12.3" replace-with = "vendored_sources" EOF +ls -la .cargo/config.toml + +export CARGO_HOME="/liana/.cargo" + # We need to set RUSTC_BOOTSTRAP=1 as a workaround to be able to use unstable # features in the GUI dependencies -RUSTC_BOOTSTRAP=1 cargo -vvv \ - --color always \ - --frozen \ - --offline \ - rustc \ - --jobs "$JOBS" \ - --release \ - --target-dir "/out" - -for bin_name in "liana-gui lianad liana-cli"; do +for package_name in "liana" "liana-gui"; do + RUSTC_BOOTSTRAP=1 cargo -vvv \ + --color always \ + --frozen \ + --offline \ + rustc \ + -p "$package_name" \ + --jobs "$JOBS" \ + --release \ + --target-dir "/out" +done + +for bin_name in "liana-gui" "lianad" "liana-cli"; do # Assume 64bits. Even bitcoind doesn't ship 32bits binaries for x86. # FIXME: is there a cleaner way than using patchelf for this? patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "/out/release/$bin_name" diff --git a/contrib/reproducible/guix/guix-build.sh b/contrib/reproducible/guix/guix-build.sh index 601c01a58..ceeaaf214 100755 --- a/contrib/reproducible/guix/guix-build.sh +++ b/contrib/reproducible/guix/guix-build.sh @@ -59,7 +59,6 @@ time_machine() { PROJECT_ROOT="$PWD" PROJECT_VENDOR_DIR="$VENDOR_DIR" PROJECT_OUT_DIR="$OUT_DIR" -PROJECT_PATCHES_ROOT="$PWD/contrib/reproducible/guix/liana-patches" maybe_create_dir "$PROJECT_OUT_DIR" @@ -67,30 +66,9 @@ maybe_create_dir "$PROJECT_OUT_DIR" if ! [ -d "$PROJECT_VENDOR_DIR" ]; then # Download the dependencies ($CARGO_BIN vendor "$PROJECT_VENDOR_DIR" ) - - # Patch some dependencies sources if needed for this project - ( - cd "$PROJECT_VENDOR_DIR" - for patch_file in $(ls "$PROJECT_PATCHES_ROOT"); do - patch -p1 < "$PROJECT_PATCHES_ROOT/$patch_file" - done - ) - - # Some of the checksums will be incorrect. Instead of cherry-picking remove them - # altogether, since they aren't useful anyways (see comment below). - for dep in $(ls "$PROJECT_VENDOR_DIR"); do - echo "{\"files\":{}}" > "$PROJECT_VENDOR_DIR/$dep/.cargo-checksum.json" - done fi cp "$PROJECT_ROOT/Cargo.lock" "$BUILD_ROOT/Cargo.lock" -# Remove the checksums from the Cargo.lock. In the container `cargo rustc` would compare -# them against the .cargo-checksum.json to make sure they weren't tampered with since they -# where vendored. But we just removed the checksums from the .cargo-checksum.json. -# There is little point in checking integrity between the above vendor step and now anyways. -# What matters is checking integrity after downloading the crates from the internet and -# `cargo vendor` does that already. -sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock" # Bootstrap a reproducible environment as specified by the manifest in an isolated # container, and build the project. @@ -99,16 +77,15 @@ sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock" # miss some dependencies). time_machine shell --no-cwd \ --expose="$PWD/Cargo.toml=/liana/Cargo.toml" \ - --expose="$PWD/Cargo.lock=/liana/Cargo.lock" \ + --expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \ --expose="$PWD/liana/src=/liana/liana/src" \ --expose="$PWD/liana/Cargo.toml=/liana/liana/Cargo.toml" \ - --expose="$PWD/liana/Cargo.lock=/liana/liana/Cargo.lock" \ --expose="$PWD/liana-gui/Cargo.toml=/liana/liana-gui/Cargo.toml" \ - --expose="$PWD/liana-gui/Cargo.lock=/liana/liana-gui/Cargo.lock" \ - --expose="$PWD/liana-gui/src=/liana/liana-gui/Cargo.lock" \ + --expose="$PWD/liana-gui/src=/liana/liana-gui/src" \ --expose="$PWD/liana-ui/src=/liana/liana-ui/src" \ --expose="$PWD/liana-ui/Cargo.toml=/liana/liana-ui/Cargo.toml" \ --expose="$PWD/liana-ui/static=/liana/liana-ui/static" \ + --expose="$PWD/fuzz/Cargo.toml=/liana/fuzz/Cargo.toml" \ --expose="$PWD/contrib/reproducible/guix/build.sh=/liana/build.sh" \ --expose="$PROJECT_VENDOR_DIR=/vendor" \ --share="$PROJECT_OUT_DIR=/out" \ diff --git a/contrib/reproducible/guix/manifest.scm b/contrib/reproducible/guix/manifest.scm index fa8e39781..46d89637e 100644 --- a/contrib/reproducible/guix/manifest.scm +++ b/contrib/reproducible/guix/manifest.scm @@ -170,27 +170,21 @@ FILE-NAME found in ./patches relative to the current file." ;; END of the newer rustc versions copied over from the current Guix master. -(let ((is_gui (getenv "IS_GUI"))) - (concatenate-manifests - (list - (specifications->manifest - (append - (list - "rust:cargo" - "coreutils-minimal" - "patchelf" - "gcc-toolchain@10.3.0") - ;; Additional dependencies for building the GUI. - (if - (string=? is_gui "1") - (list "pkg-config" - "eudev" - "fontconfig") - '()))) - ;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for - ;; both. - ;; FIXME: be able to compile against a specified glibc (or musl) instead of having to - ;; resort to backporting the newer rustc releases here. Also have proper Guix packages - ;; for the two projects. - (packages->manifest - `(,rust-1.71))))) +(concatenate-manifests + (list + (specifications->manifest + (list + "rust:cargo" + "coreutils-minimal" + "patchelf" + "gcc-toolchain@10.3.0" + "pkg-config" + "eudev" + "fontconfig")) + ;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for + ;; both. + ;; FIXME: be able to compile against a specified glibc (or musl) instead of having to + ;; resort to backporting the newer rustc releases here. Also have proper Guix packages + ;; for the two projects. + (packages->manifest + `(,rust-1.71))))