Summary: | RESTRICT="!test? ( test )" is not evaluated correctly by ebuild(1) | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Mike Gilbert <floppym> |
Component: | Core - Ebuild Support | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | InVCS |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 604854 | ||
Attachments: | test ebuild |
Description
Mike Gilbert
![]() For comparison, emerge with FEATURES=test works correctly. floppym@naomi test % sudo FEATURES=test emerge -v1O -j1 app-misc/test These are the packages that would be merged, in order: [ebuild N ] app-misc/test-0::local USE="{test}" 0 KiB Total: 1 package (1 new), Size of downloads: 0 KiB >>> Verifying ebuild manifests >>> Emerging (1 of 1) app-misc/test-0::local * setup: test is yes >>> Unpacking source... * unpack: test is yes >>> Source unpacked in /tmp/portage/app-misc/test-0/work >>> Preparing source in /tmp/portage/app-misc/test-0/work ... * prepare: test is yes >>> Source prepared. >>> Configuring source in /tmp/portage/app-misc/test-0/work ... * configure: test is yes >>> Source configured. >>> Compiling source in /tmp/portage/app-misc/test-0/work ... * compile: test is yes >>> Source compiled. >>> Test phase: app-misc/test-0 * test: test is yes >>> Completed testing app-misc/test-0 What's happening is that the _PackageMetadataWrapper._use_conditional_keys code is evaluating RESTRICT to remove the conditionals prematurely. This appears to solve the problem: diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 505c7a2..f1d3d41 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1412,7 +1412,10 @@ class config(object): if not isinstance(mycpv, basestring): pkg = mycpv mycpv = pkg.cpv - mydb = pkg._metadata + try: + mydb = pkg._raw_metadata + except AttributeError: + mydb = pkg._metadata explicit_iuse = pkg.iuse.all args_hash = (mycpv, id(pkg)) if pkg.built: (In reply to Zac Medico from comment #2) When using _raw_metadata, we need to make sure that all of these variables are evaluated when appropriate, since we're by passing _PackageMetadataWrapper's evaluation: _use_conditional_keys = frozenset( ['LICENSE', 'PROPERTIES', 'PROVIDE', 'RESTRICT',]) It turns out that the Package instance in bin/build is using a separate config instance to calculate its USE settings, so that's what triggers this. I'll have to think about what's the best way to make things consistent. Here's one way to do it: diff --git a/bin/ebuild b/bin/ebuild index 1f99177..85226e2 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -296,6 +296,10 @@ pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv, # portdb.porttrees in order to accomplish this). tmpsettings.setcpv(pkg) +# Update pkg.use.enabled, in order to enforce consistency +# for EBUILD_FORCE_TEST support (bug 601466). +pkg._metadata['USE'] = tmpsettings['PORTAGE_USE'] + def stale_env_warning(): if "clean" not in pargs and \ "noauto" not in tmpsettings.features and \ Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/f34c9e7cd5055bfdb3da4fe8668ecdc3 https://github.com/gentoo/portage/pull/75 Minor regression: "Forcing test." is now output twice.
floppym@naomi test % ebuild test-0.ebuild clean test
Forcing test.
Forcing test.
* setup: test is yes
>>> Unpacking source...
Pushed, with fixup to eliminate duplicate "Forcing Test" messages: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c06ff5f8f3e86592bbaeb38f274797505c45b2a Fixed in portage-2.3.3. |