Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 639588 - sys-apps/portage: Resolution of test dependencies not possible with --usepkg
Summary: sys-apps/portage: Resolution of test dependencies not possible with --usepkg
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
Depends on: 639168 703458 832168
Blocks: 155723
  Show dependency tree
Reported: 2017-12-03 09:43 UTC by Michael Seifert
Modified: 2022-02-08 08:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Seifert 2017-12-03 09:43:23 UTC
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

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /var/lib/layman/ameto
    masters: gentoo
    priority: 50

    location: /var/lib/layman/digitalernachschub
    masters: gentoo
    priority: 50

    location: /var/lib/layman/musl
    masters: gentoo
    priority: 50

CFLAGS="-O2 -pipe"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
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"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9 -l8"
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"
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"
Comment 1 Zac Medico gentoo-dev 2017-12-03 21:13:11 UTC
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.
Comment 2 Zac Medico gentoo-dev 2017-12-04 03:33:22 UTC
I have a patch to save test deps for built packages:

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.
Comment 3 Zac Medico gentoo-dev 2018-08-11 18:50:28 UTC
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):

commit 8c5598c1af2c4c96546f196e2213211ec9cd7e7a
Author:     Michał Górny <>
AuthorDate: 2017-06-04 10:21:45 +0200
Commit:     Michał Górny <>
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 <>