While creating a new ebuild for nitrocli I noticed that the install phase seemingly does a lot of work that the compile phase should already have performed. Here is a trace: > >>> Compiling source in /tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999 ... > Updating crates.io index > Downloading crates ... > Downloaded libc v0.2.66 > Downloaded structopt v0.3.12 > Downloaded nitrokey v0.6.0 > Downloaded base32 v0.4.0 > Downloaded rand_core v0.5.1 > Downloaded clap v2.33.0 > Downloaded structopt-derive v0.4.5 > Downloaded nitrokey-sys v3.5.0 > Downloaded getrandom v0.1.13 > Downloaded lazy_static v1.4.0 > Downloaded unicode-width v0.1.7 > Downloaded textwrap v0.11.0 > Downloaded proc-macro2 v1.0.7 > Downloaded bitflags v1.2.1 > Downloaded syn v1.0.14 > Downloaded cc v1.0.48 > Downloaded heck v0.3.1 > Downloaded quote v1.0.2 > Downloaded proc-macro-error v0.4.12 > Downloaded cfg-if v0.1.10 > Downloaded unicode-xid v0.2.0 > Downloaded version_check v0.9.1 > Downloaded proc-macro-error-attr v0.4.12 > Downloaded syn-mid v0.5.0 > Downloaded unicode-segmentation v1.6.0 > Compiling proc-macro2 v1.0.7 > Compiling unicode-xid v0.2.0 > Compiling version_check v0.9.1 > Compiling syn v1.0.14 > Compiling libc v0.2.66 > Compiling cc v1.0.48 > Compiling bitflags v1.2.1 > Compiling getrandom v0.1.13 > Compiling unicode-segmentation v1.6.0 > Compiling cfg-if v0.1.10 > Compiling unicode-width v0.1.7 > Compiling lazy_static v1.4.0 > Compiling base32 v0.4.0 > Compiling textwrap v0.11.0 > Compiling heck v0.3.1 > Compiling clap v2.33.0 > Compiling proc-macro-error-attr v0.4.12 > Compiling proc-macro-error v0.4.12 > Compiling quote v1.0.2 > Compiling rand_core v0.5.1 > Compiling nitrokey-sys v3.5.0 > Compiling syn-mid v0.5.0 > Compiling structopt-derive v0.4.5 > Compiling structopt v0.3.12 > Compiling nitrokey v0.6.0 > Compiling nitrocli v0.3.1 (/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999) > Finished release [optimized] target(s) in 1m 43s > >>> Source compiled. > * Skipping make test/check due to ebuild restriction. > >>> Test phase [disabled because of RESTRICT=test]: app-crypt/nitrocli-9999 > > >>> Install app-crypt/nitrocli-9999 into /tmp/portage/app-crypt/nitrocli-9999/image > Installing nitrocli v0.3.1 (/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999) > Updating crates.io index > Downloading crates ... > Downloaded proc-macro2 v1.0.10 > Downloaded quote v1.0.3 > Downloaded syn v1.0.17 > Downloaded getrandom v0.1.14 > Downloaded cc v1.0.50 > Downloaded libc v0.2.68 > Compiling proc-macro2 v1.0.10 > Compiling syn v1.0.17 > Compiling libc v0.2.68 > Compiling cc v1.0.50 > Compiling getrandom v0.1.14 > ^C If you look closer you will see that the package versions being compiled are different. That is to say, nitrocli has a Cargo.lock and it is honored during the build step (i.e., cargo build). Not all packages are pinned in up-to-date versions, though, and the installation step (cargo install) now pulls and compiles the more recent versions. There actually exists an upstream issue https://github.com/rust-lang/cargo/issues/7169 The way I worked around it is by providing the --offline and --frozen flags to cargo install, but as the upstream issue detailed, --locked works as well. I believe that should be done in the eclass, though. I believe this issue will most likely affect all Rust binaries (using cargo) that ship a Cargo.lock (the default behavior?) and will get worse as packages get updated over time (because more packages will have divergent versions). Reproducible: Always
Created attachment 630536 [details] ebuild reproducing the problem
you are using eclass incorrectly. you need to define something like this. src_unpack() { if [[ "${PV}" == *9999* ]]; then git-r3_src_unpack cargo_live_src_unpack else cargo_src_unpack fi } look at x11-terms/alacritty for inspiration. eclass does the following: during src_unpack phase (which is not network-sandoxed), you should cargo_live_src_unpack, which will pre-fetch all the deps. I think cargo vendor will honor exact deps you've pinned. all the subsequent phases will have network.offline=true, and network-sandbox active and cargo will not update deps.
your argument about --locked still stands, we may need to add it in theory, but on practice it never happens in normal versioned ebuilds or live ebuilds that use vendoring with cargo_live_src_unpack.
here's the log: > Appending /home/gyakovlev/dev/gentoo to PORTDIR_OVERLAY... > >>> Unpacking source... > Initialized empty Git repository in /var/cache/egit-src/d-e-s-o_nitrocli.git/ > * Repository id: d-e-s-o_nitrocli.git > * To override fetched repository properties, use: > * EGIT_OVERRIDE_REPO_D_E_S_O_NITROCLI > * EGIT_OVERRIDE_BRANCH_D_E_S_O_NITROCLI > * EGIT_OVERRIDE_COMMIT_D_E_S_O_NITROCLI > * EGIT_OVERRIDE_COMMIT_DATE_D_E_S_O_NITROCLI > * > * Fetching https://github.com/d-e-s-o/nitrocli.git ... > git fetch https://github.com/d-e-s-o/nitrocli.git +refs/heads/devel:refs/heads/devel > remote: Enumerating objects: 79, done. > remote: Counting objects: 100% (79/79), done. > remote: Compressing objects: 100% (26/26), done. > remote: Total 4474 (delta 55), reused 65 (delta 53), pack-reused 4395 > Receiving objects: 100% (4474/4474), 2.79 MiB | 1.31 MiB/s, done. > Resolving deltas: 100% (2674/2674), done. > From https://github.com/d-e-s-o/nitrocli > * [new branch] devel -> devel > * [new tag] v0.1.0 -> v0.1.0 > * [new tag] v0.1.1 -> v0.1.1 > * [new tag] v0.1.2 -> v0.1.2 > * [new tag] v0.1.3 -> v0.1.3 > * [new tag] v0.2.0 -> v0.2.0 > * [new tag] v0.2.1 -> v0.2.1 > * [new tag] v0.2.2 -> v0.2.2 > * [new tag] v0.2.3 -> v0.2.3 > * [new tag] v0.2.4 -> v0.2.4 > * [new tag] v0.3.0 -> v0.3.0 > * [new tag] v0.3.1 -> v0.3.1 > git symbolic-ref refs/git-r3/app-crypt/nitrocli/0/__main__ refs/heads/devel > * Checking out https://github.com/d-e-s-o/nitrocli.git to /var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999 ... > git checkout --quiet devel > GIT NEW branch --> > repository: https://github.com/d-e-s-o/nitrocli.git > at the commit: c4436ac168ed10fb116930e6119b710b3ad0d73e > Updating crates.io index > Downloading crates ... > Downloaded rand_core v0.5.1 > Downloaded heck v0.3.1 > Downloaded unicode-xid v0.2.0 > Downloaded lazy_static v1.4.0 > Downloaded base32 v0.4.0 > Downloaded unicode-width v0.1.7 > Downloaded libc v0.2.66 > Downloaded clap v2.33.0 > Downloaded quote v1.0.2 > Downloaded unicode-segmentation v1.6.0 > Downloaded syn v1.0.14 > Downloaded bitflags v1.2.1 > Downloaded textwrap v0.11.0 > Downloaded thread_local v0.3.6 > Downloaded version_check v0.9.1 > Downloaded cc v1.0.48 > Downloaded nitrokey-test v0.3.2 > Downloaded proc-macro2 v1.0.7 > Downloaded wasi v0.7.0 > Downloaded structopt-derive v0.4.5 > Downloaded memchr v2.2.1 > Downloaded nitrokey v0.6.0 > Downloaded nitrokey-test-state v0.1.0 > Downloaded cfg-if v0.1.10 > Downloaded nitrokey-sys v3.5.0 > Downloaded regex v1.3.1 > Downloaded aho-corasick v0.7.6 > Downloaded proc-macro-error-attr v0.4.12 > Downloaded getrandom v0.1.13 > Downloaded structopt v0.3.12 > Downloaded regex-syntax v0.6.12 > Downloaded syn-mid v0.5.0 > Downloaded proc-macro-error v0.4.12 > Vendoring aho-corasick v0.7.6 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.6) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/aho-corasick > Vendoring base32 v0.4.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/base32-0.4.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/base32 > Vendoring bitflags v1.2.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/bitflags > Vendoring cc v1.0.48 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/cc-1.0.48) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/cc > Vendoring cfg-if v0.1.10 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.10) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/cfg-if > Vendoring clap v2.33.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/clap-2.33.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/clap > Vendoring getrandom v0.1.13 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/getrandom-0.1.13) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/getrandom > Vendoring heck v0.3.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/heck-0.3.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/heck > Vendoring lazy_static v1.4.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/lazy_static > Vendoring libc v0.2.66 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/libc > Vendoring memchr v2.2.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/memchr-2.2.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/memchr > Vendoring nitrokey v0.6.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/nitrokey-0.6.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/nitrokey > Vendoring nitrokey-sys v3.5.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/nitrokey-sys-3.5.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/nitrokey-sys > Vendoring nitrokey-test v0.3.2 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/nitrokey-test-0.3.2) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/nitrokey-test > Vendoring nitrokey-test-state v0.1.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/nitrokey-test-state-0.1.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/nitrokey-test-state > Vendoring proc-macro-error v0.4.12 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/proc-macro-error-0.4.12) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/proc-macro-error > Vendoring proc-macro-error-attr v0.4.12 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/proc-macro-error-attr-0.4.12) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/proc-macro-error-attr > Vendoring proc-macro2 v1.0.7 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.7) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/proc-macro2 > Vendoring quote v1.0.2 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/quote-1.0.2) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/quote > Vendoring rand_core v0.5.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/rand_core-0.5.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/rand_core > Vendoring regex v1.3.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/regex-1.3.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/regex > Vendoring regex-syntax v0.6.12 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.12) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/regex-syntax > Vendoring structopt v0.3.12 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/structopt-0.3.12) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/structopt > Vendoring structopt-derive v0.4.5 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.4.5) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/structopt-derive > Vendoring syn v1.0.14 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/syn-1.0.14) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/syn > Vendoring syn-mid v0.5.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/syn-mid-0.5.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/syn-mid > Vendoring textwrap v0.11.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/textwrap-0.11.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/textwrap > Vendoring thread_local v0.3.6 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/thread_local-0.3.6) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/thread_local > Vendoring unicode-segmentation v1.6.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/unicode-segmentation-1.6.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/unicode-segmentation > Vendoring unicode-width v0.1.7 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/unicode-width-0.1.7) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/unicode-width > Vendoring unicode-xid v0.2.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/unicode-xid-0.2.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/unicode-xid > Vendoring version_check v0.9.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/version_check-0.9.1) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/version_check > Vendoring wasi v0.7.0 (/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/registry/src/github.com-1ecc6299db9ec823/wasi-0.7.0) to /var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo/wasi > To use vendored sources, add this to your .cargo/config for this project: > > [source.crates-io] > replace-with = "vendored-sources" > > [source.vendored-sources] > directory = "/var/tmp/portage/app-crypt/nitrocli-9999/work/cargo_home/gentoo" > >>> Source unpacked in /var/tmp/portage/app-crypt/nitrocli-9999/work > >>> Preparing source in /var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999 ... > >>> Source prepared. > >>> Configuring source in /var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999 ... > >>> Source configured. > >>> Compiling source in /var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999 ... > Compiling proc-macro2 v1.0.7 > Compiling unicode-xid v0.2.0 > Compiling version_check v0.9.1 > Compiling syn v1.0.14 > Compiling libc v0.2.66 > Compiling bitflags v1.2.1 > Compiling getrandom v0.1.13 > Compiling cc v1.0.48 > Compiling unicode-width v0.1.7 > Compiling cfg-if v0.1.10 > Compiling unicode-segmentation v1.6.0 > Compiling lazy_static v1.4.0 > .... > > > Finished release [optimized] target(s) in 45.74s > >>> Source compiled. > * Skipping make test/check due to ebuild restriction. > >>> Test phase [disabled because of RESTRICT=test]: app-crypt/nitrocli-9999 > > >>> Install app-crypt/nitrocli-9999 into /var/tmp/portage/app-crypt/nitrocli-9999/image > Installing nitrocli v0.3.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999) > Fresh version_check v0.9.1 > Fresh unicode-xid v0.2.0 > Fresh cc v1.0.48 > Fresh cfg-if v0.1.10 > Fresh unicode-width v0.1.7 > Fresh unicode-segmentation v1.6.0 > Fresh lazy_static v1.4.0 > Fresh base32 v0.4.0 > Fresh textwrap v0.11.0 > Fresh heck v0.3.1 > Fresh proc-macro2 v1.0.7 > Fresh libc v0.2.66 > Fresh bitflags v1.2.1 > Fresh quote v1.0.2 > Fresh getrandom v0.1.13 > Fresh nitrokey-sys v3.5.0 > Fresh clap v2.33.0 > Fresh syn v1.0.14 > Fresh rand_core v0.5.1 > Fresh syn-mid v0.5.0 > Fresh nitrokey v0.6.0 > Fresh proc-macro-error-attr v0.4.12 > Fresh proc-macro-error v0.4.12 > Fresh structopt-derive v0.4.5 > Fresh structopt v0.3.12 > Fresh nitrocli v0.3.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999) > Finished release [optimized] target(s) in 0.02s > Installing /var/tmp/portage/app-crypt/nitrocli-9999/image/usr/bin/nitrocli > Installed package `nitrocli v0.3.1 (/var/tmp/portage/app-crypt/nitrocli-9999/work/nitrocli-9999)` (executable `nitrocli`) > warning: be sure to add `/var/tmp/portage/app-crypt/nitrocli-9999/image/usr/bin` to your PATH to be able to run the installed binaries > >>> Completed installing app-crypt/nitrocli-9999 into /var/tmp/portage/app-crypt/nitrocli-9999/image > > * Final size of build directory: 135484 KiB (132.3 MiB) > * Final size of installed tree: 3268 KiB ( 3.1 MiB) > >
Created attachment 630904 [details] nitrocli-9999.ebuild working ebuild
(In reply to Georgy Yakovlev from comment #2) > you are using eclass incorrectly. > > you need to define something like this. > > src_unpack() { > if [[ "${PV}" == *9999* ]]; then > git-r3_src_unpack > cargo_live_src_unpack > else > cargo_src_unpack > fi > } Hm. I see. Thanks for the pointer & explanation. (In reply to Georgy Yakovlev from comment #3) > your argument about --locked still stands, we may need to add it in theory, > but on practice it never happens in normal versioned ebuilds or live ebuilds > that use vendoring with cargo_live_src_unpack. Seems there is little incentive to add --locked then. Let me close this bug.