Skip to content

Commit

Permalink
guix: bump time-machine, rust 1.82
Browse files Browse the repository at this point in the history
We can't use rust-src from Guix because it mangles Cargo.lock checksums. Grep for "hash for the empty file".
  • Loading branch information
tobtoht committed Dec 9, 2024
1 parent b51a593 commit 3832577
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion contrib/depends/packages/fcmp_pp_rust_deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package=fcmp_pp_rust_deps
$(package)_version=0.0.0
$(package)_download_path=https://featherwallet.org/files/sources
$(package)_file_name=fcmp_pp_rust-$($(package)_version)-deps.tar.gz
$(package)_sha256_hash=9a7c20d5571c0a82fe570122b4166dd4223672baaa1e25e52eb2426eefe3bc02
$(package)_sha256_hash=06ab31925d4d84a8c811c7036abfdf1956288b12fbe4300176d53ab317a6f811

define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/cargo &&\
Expand Down
2 changes: 1 addition & 1 deletion contrib/depends/packages/packages.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
native_packages:=fcmp_pp_rust_deps
native_packages:=fcmp_pp_rust_deps rust_src
packages:=boost openssl zeromq expat unbound sodium

hardware_packages := hidapi protobuf libusb
Expand Down
10 changes: 10 additions & 0 deletions contrib/depends/packages/rust_src.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package=rust_src
$(package)_version=1.82.0
$(package)_download_path=https://static.rust-lang.org/dist
$(package)_file_name=rustc-$($(package)_version)-src.tar.gz
$(package)_sha256_hash=7c53f4509eda184e174efa6ba7d5eeb586585686ce8edefc781a2b11a7cf512a

define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/rust &&\
mv library $($(package)_staging_prefix_dir)/rust
endef
2 changes: 2 additions & 0 deletions contrib/guix/guix-build
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ EOF
# --user="user" \
# --share="$PWD"=/monero \
# -- bash -c "cd /monero && bash contrib/guix/libexec/cargo.sh"
#
# exit 1

# Run the build script 'contrib/guix/libexec/build.sh' in the build
# container specified by 'contrib/guix/manifest.scm'.
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ store_path() {
# includes/libs
NATIVE_GCC="$(store_path gcc-toolchain)"
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
RUST_SRC="$(store_path rust rust-src)/lib/rustlib/src/rust"
RUST_SRC="/monero/contrib/depends/$HOST/native/rust/library"

unset LIBRARY_PATH
unset CPATH
Expand Down
17 changes: 10 additions & 7 deletions contrib/guix/libexec/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ export TZ="UTC"
allowed_pattern=$(awk '{print "^./" $1 "$" }' /monero/contrib/guix/libexec/allowed_deps.txt | paste -sd '|' -)

cd /
wget --no-check-certificate https://static.rust-lang.org/dist/rustc-1.77.1-src.tar.gz
echo "ee106e4c569f52dba3b5b282b105820f86bd8f6b3d09c06b8dce82fb1bb3a4a1 rustc-1.77.1-src.tar.gz" | sha256sum -c
tar xf rustc-1.77.1-src.tar.gz
cp rustc-1.77.1-src/Cargo.lock rustc-1.77.1-src/library/std/
wget --no-check-certificate https://static.rust-lang.org/dist/rustc-1.82.0-src.tar.gz
echo "7c53f4509eda184e174efa6ba7d5eeb586585686ce8edefc781a2b11a7cf512a rustc-1.82.0-src.tar.gz" | sha256sum -c
tar xf rustc-1.82.0-src.tar.gz
cp rustc-1.82.0-src/Cargo.lock rustc-1.82.0-src/library/std/

# Vendor fcmp_pp_rust deps
cd /monero/src/fcmp_pp/fcmp_pp_rust
RUSTC_BOOTSTRAP=1 cargo vendor --locked --sync /rustc-1.77.1-src/library/std/Cargo.toml /vendor
RUSTC_BOOTSTRAP=1 cargo vendor --locked --sync /rustc-1.82.0-src/library/std/Cargo.toml /vendor

# Create deterministic dependency archive
cd /vendor

find . -mindepth 1 -maxdepth 1 -type d | grep -Ev "($allowed_pattern)" | xargs rm -rf
#find . -mindepth 1 -maxdepth 1 -type d | grep -Ev "($allowed_pattern)" | xargs rm -rf

#find . -type f -regex ".*\.\(a\|dll\|exe\|lib\)$" -delete
#find . -type f -name ".cargo-checksum.json" -print0 | xargs -0 -I% sh -c 'echo "{\"package\":null,\"files\":{}}" > "%"'
#find . -type f -name "Cargo.lock" -delete

find . -type f -regex ".*\.\(a\|dll\|exe\|lib\)$" -delete
find . -print0 \
| sort --zero-terminated \
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/prelude.bash
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
time-machine() {
# shellcheck disable=SC2086
guix time-machine --url=https://github.com/monero-project/guix.git \
--commit=0ba20c76349709fdb04baa8d263e3c0c7bd7b4e7 \
--commit=9d09b0cf841fb657a1aec12e9bab68e00c2b493c \
--cores="$JOBS" \
--keep-failed \
--fallback \
Expand Down
1 change: 0 additions & 1 deletion contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ chain for " target " development."))
cmake-minimal
rust
`(,rust "cargo")
`(,rust "rust-src")
;; Scripting
perl
python-minimal
Expand Down

0 comments on commit 3832577

Please sign in to comment.