Emerging a binary package with the --usepkg switch ignores test dependencies when --with-test-deps=y is set. Reproducible: Always Steps to Reproduce: 1. Emerge any package that has test dependencies and build a binary package without test dependencies enabled: emerge --buildpkg =dev-python/mock-2.0.0 2. Remove the package emerge --rage-clean =dev-python/mock-2.0.0 3. Install package with --usepkg and --with-test-deps=y emerge --pretend --verbose --usepkg --with-test-deps=y =dev-python/mock-2.0.0 Actual Results: Emerge uses the existing binary package and does not pull in test dependencies. Expected Results: Emerge uses the existing binary package, but pulls in all test dependencies. # emerge --info Portage 2.3.13 (python 3.6.3-final-0, hardened/linux/musl/amd64, gcc-5.4.0, musl-1.1.18, 4.13.7-gentoo x86_64) ================================================================= System uname: Linux-4.13.7-gentoo-x86_64-Intel-R-_Core-TM-_i7-4770_CPU_@_3.40GHz-with-gentoo-2.4.1 KiB Mem: 32805260 total, 21901096 free KiB Swap: 4194296 total, 4190880 free Timestamp of repository gentoo: Wed, 22 Nov 2017 00:45:01 +0000 Head commit of repository gentoo: 17ee4dbf1ddb843028d3a63e806d37303e55f054 sh bash 4.3_p48-r1 ld GNU ld (Gentoo 2.28.1 p1.0) 2.28.1 app-shells/bash: 4.3_p48-r1::gentoo dev-lang/perl: 5.24.3::gentoo dev-lang/python: 2.7.12::gentoo, 3.4.5::gentoo, 3.6.3-r1::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.4.1-r2::gentoo sys-apps/openrc: 0.34.9::gentoo sys-apps/sandbox: 2.10-r4::musl sys-devel/autoconf: 2.69::gentoo sys-devel/automake: 1.15-r2::gentoo sys-devel/binutils: 2.28.1::gentoo, 2.29.1-r1::gentoo sys-devel/gcc: 5.4.0-r3::musl, 6.4.0::musl sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.4::musl (virtual/os-headers) sys-libs/musl: 1.1.18::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: ameto location: /var/lib/layman/ameto masters: gentoo priority: 50 digitalernachschub location: /var/lib/layman/digitalernachschub masters: gentoo priority: 50 musl location: /var/lib/layman/musl masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-gentoo-linux-musl" CFLAGS="-O2 -pipe" CHOST="x86_64-gentoo-linux-musl" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--nospinner --quiet" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j9 -l8" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="amd64 bindist cli cracklib crypt cxx dri fortran hardened iconv ipv6 mmx modules ncurses nls nptl openmp pam pcre pic readline seccomp session sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_6" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Currently, the DEPEND metadata embedded in binary and installed packages has all of the USE conditionals collapsed. Given the special meaning of the 'test' USE flag, it would make sense to preserve 'test' conditionals in DEPEND for binary and installed packages, which will allow --with-test-deps=y to work as intended.
I have a patch to save test deps for built packages: https://github.com/zmedico/portage/tree/bug_639588 Currently --with-test-deps only works during installation for packages given as arguments, but I'm thinking it might be useful to have a way to install test deps for all packages, and also a way to protect these packages from being removed by emerge --depclean.
This new behavior (related to bug 373209) changes things, since it allows USE=test to be enabled when FEATURES=test is not enabled (but we have bug 663278 to contend with): https://gitweb.gentoo.org/proj/portage.git/commit/?id=8c5598c1af2c4c96546f196e2213211ec9cd7e7a commit 8c5598c1af2c4c96546f196e2213211ec9cd7e7a Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2017-06-04 10:21:45 +0200 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2018-07-31 19:24:02 +0200 Replace implicit {FEATURES->USE}=test forcing with USE default Use an explicit USE_ORDER entry to control mapping FEATURES=test into default-enabled USE=test, rather than forcing/masking it depending on the state of FEATURES. This makes it possible for users to enable (or disable) USE=test independently of FEATURES. An example use case is installing test dependencies and building test cases without actually running tests at a particular moment which is something I've been doing quite frequently with LLVM. Reviewed-by: Zac Medico <zmedico@gentoo.org> Closes: https://github.com/gentoo/portage/pull/347