Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 639168 - sys-apps/portage: --usepkg does not respect FEATURES="test"
Summary: sys-apps/portage: --usepkg does not respect FEATURES="test"
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 639588 912975
  Show dependency tree
 
Reported: 2017-11-29 13:36 UTC by Michael Seifert
Modified: 2023-08-24 20:20 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Seifert 2017-11-29 13:36:53 UTC
It looks like changes to USE="test" (via FEATURES="test" in package.env) are ignored when emerge is called with --usepkg. This means that, as soon as a binary package is present in PKGDIR, changes to FEATURES=test for this package are meaningless. Portage will always use the existing binary package and ignore the current state of FEATURES="test".

Reproducible: Always

Steps to Reproduce:
1. Emerge any package that has USE="test":
emerge --buildpkg =dev-python/mock-2.0.0
2. Remove the package
emerge --rage-clean =dev-python/mock-2.0.0
3. Enable FEATURES="test" for the package
echo 'FEATURES="test"' >> /etc/portage/env/test
echo 'dev-python/mock test' >> /etc/portage/package.env/mock
4. Reinstall with --usepkg (--with-bdeps should be required, because test dependencies are build-time dependencies)
emerge --pretend --verbose --usepkg --with-bdeps=y =dev-python/mock-2.0.0

(Note that emerge --pretend --verbose --usepkg --with-bdeps=y --with-test-deps=y =dev-python/mock-2.0.0 does not pull in test-dependecies either)
Actual Results:  
Emerge uses the existing binary package with USE="-test" and will not pull dependencies required by USE="test"

Expected Results:  
Emerge ignores the existing binary due to different USE configuration (since --binpkg-respect-use is enabled by default) and builds the package from source with USE="test".

# 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,   6008212 free
KiB Swap:    4194296 total,   4176976 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
Comment 1 Zac Medico gentoo-dev 2017-11-30 06:54:46 UTC
(In reply to Michael Seifert from comment #0)
> Expected Results:  
> Emerge ignores the existing binary due to different USE configuration (since
> --binpkg-respect-use is enabled by default) and builds the package from
> source with USE="test".

It's not intended to work that way. The assumption is that you would not use --usepkg if you wanted to run unit tests.

The link between FEATURES=test and USE=test is unfortunate. It would be nice if we could eliminate it somehow. For example, we could introduce a separate variable for test dependencies, and provide some way for the ebuild to know in earlier phases if src_test is to be executed later (in case the early phases need to make some adjustments for this).
Comment 2 Michael Seifert 2017-11-30 07:08:57 UTC
I understand that USE="test" is somewhat special. I already thought that I might be misusing portage :)

My main goal was to install the test dependencies. Shouldn't --with-test-deps=y do the trick (except running src_test)? As I mentioned in parentheses, it doesn't seem to pull in the test dependencies in the same setup. Yet, I'd expect it to do exactly that. (Or should this be a different ticket?)
Comment 3 Zac Medico gentoo-dev 2017-11-30 07:25:33 UTC
Yes please file a new ticket for the --with-test-deps=y option which currently has no effect on binary packages. Currently, the only way to include test dependencies for binary packages is to build them with USE=test enabled *and* use the --with-bdeps=y option.
Comment 4 Michael Seifert 2017-11-30 07:30:06 UTC
Will do so, thanks!

Do you think it makes sense to add a line about the interaction of --usepkg and USE="test" in the documentation of the --usepkg switch? I debugged this for around two days, until I knew what was going on and had a minimal example. Maybe this will prevent someone else from running into it.
Comment 5 Zac Medico gentoo-dev 2017-11-30 07:38:41 UTC
Yes, a mention in the documentation is a very good idea.
Comment 6 Michael Seifert 2017-12-08 09:17:03 UTC
(In reply to Zac Medico from comment #1)
> (In reply to Michael Seifert from comment #0)
> 
> The link between FEATURES=test and USE=test is unfortunate. It would be nice
> if we could eliminate it somehow. For example, we could introduce a separate
> variable for test dependencies, and provide some way for the ebuild to know
> in earlier phases if src_test is to be executed later (in case the early
> phases need to make some adjustments for this).

Factoring out test dependencies into a new ebuild variable sounds like a very good idea. It also seems like a logical thing to do, now that host and target dependencies for cross-compilation are being separated in EAPI 7.
Is there a bug or GLEP to track the progress on the "TDEPEND" idea?
Comment 7 Zac Medico gentoo-dev 2017-12-08 09:37:55 UTC
There is bug 517658, but it's focused on circular dependency issues, so we need to open a separate bug.