From 175acbc8b373823d98c7f0bfb1c54efc07d5a441 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Mon, 9 Dec 2024 19:55:23 +0100 Subject: [PATCH] let cargo.sh vendor deps for now --- contrib/depends/packages/packages.mk | 2 +- contrib/guix/guix-build | 16 ++++++------- contrib/guix/libexec/allowed_deps.txt | 33 +++++++++++++++++++++++++++ contrib/guix/libexec/cargo.config | 2 +- contrib/guix/libexec/cargo.sh | 26 ++++++++++++--------- 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index d14cc07a285..f632999e61c 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,4 +1,4 @@ -native_packages:=fcmp_pp_rust_deps rust_src +native_packages:=rust_src packages:=boost openssl zeromq expat unbound sodium hardware_packages := hidapi protobuf libusb diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index d049ab604cd..ff164c80392 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -366,14 +366,14 @@ EOF # TODO: use depends to fetch and clean rustc source # Fetch cargo dependencies -# time-machine environment --manifest="${PWD}/contrib/guix/cargo.scm" \ -# --container \ -# --pure \ -# --network \ -# --no-cwd \ -# --user="user" \ -# --share="$PWD"=/monero \ -# -- bash -c "cd /monero && bash contrib/guix/libexec/cargo.sh" + time-machine environment --manifest="${PWD}/contrib/guix/cargo.scm" \ + --container \ + --pure \ + --network \ + --no-cwd \ + --user="user" \ + --share="$PWD"=/monero \ + -- bash -c "cd /monero && bash contrib/guix/libexec/cargo.sh" # # exit 1 diff --git a/contrib/guix/libexec/allowed_deps.txt b/contrib/guix/libexec/allowed_deps.txt index 22e894ca7bc..9c5a7deb038 100644 --- a/contrib/guix/libexec/allowed_deps.txt +++ b/contrib/guix/libexec/allowed_deps.txt @@ -1,22 +1,34 @@ addr2line adler ahash +allocator-api2 +base16ct +base64ct bitvec blake2 block-buffer +byteorder +cc cfg-if ciphersuite compiler_builtins +const-oid cpufeatures crypto-bigint crypto-common curve25519-dalek curve25519-dalek-derive dalek-ff-group +der digest +dlmalloc ec-divisors +ecdsa +elliptic-curve ff +fiat-crypto flexible-transcript +fortanix-sgx-abi full-chain-membership-proofs funty generalized-bulletproofs @@ -24,15 +36,20 @@ generalized-bulletproofs-circuit-abstraction generalized-bulletproofs-ec-gadgets generalized-schnorr generic-array +getopts getrandom gimli group hashbrown helioselene +hermit-abi hex +k256 keccak libc memchr +merlin +minimal-ed448 miniz_oxide monero-fcmp-plus-plus monero-generators @@ -41,25 +58,41 @@ monero-primitives multiexp object once_cell +p256 +pkcs8 +primeorder proc-macro2 quote radium +rand rand_core +rand_xorshift +r-efi +r-efi-alloc rustc-demangle rustc_version rustversion +sec1 semver sha2 sha3 +signature spin +spki std-shims subtle syn tap typenum unicode-ident +unicode-width +unwinding version_check +wasi +windows-sys +windows-targets wyz zerocopy +zerocopy-derive zeroize zeroize_derive \ No newline at end of file diff --git a/contrib/guix/libexec/cargo.config b/contrib/guix/libexec/cargo.config index 733eecd06d3..76d0e054dff 100644 --- a/contrib/guix/libexec/cargo.config +++ b/contrib/guix/libexec/cargo.config @@ -11,4 +11,4 @@ git = "https://github.com/kayabaNerve/fcmp-plus-plus" replace-with = "vendored-sources" [source.vendored-sources] -directory = "/monero/contrib/depends/TARGET/native/cargo" +directory = "/monero/vendor" diff --git a/contrib/guix/libexec/cargo.sh b/contrib/guix/libexec/cargo.sh index 4a9d832db0c..ec4d3acd2a4 100644 --- a/contrib/guix/libexec/cargo.sh +++ b/contrib/guix/libexec/cargo.sh @@ -9,28 +9,32 @@ 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.82.0-src.tar.gz +rm -rf /monero/vendor + +cd /monero +if [ ! -e "rustc-1.82.0-src.tar.gz" ]; then + wget --no-check-certificate https://static.rust-lang.org/dist/rustc-1.82.0-src.tar.gz +fi + 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.82.0-src/library/std/Cargo.toml /vendor +RUSTC_BOOTSTRAP=1 cargo vendor --locked --sync /monero/rustc-1.82.0-src/library/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 -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 . -print0 \ - | sort --zero-terminated \ - | tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \ - | gzip -9n > "/fcmp_pp_rust-0.0.0-deps.tar.gz" +#find . -print0 \ +# | sort --zero-terminated \ +# | tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \ +# | gzip -9n > "/fcmp_pp_rust-0.0.0-deps.tar.gz" -mv /fcmp_pp_rust-0.0.0-deps.tar.gz /monero/ +mv /vendor /monero/