Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273272 - RESTRICT=test should mask test USE flag for package
Summary: RESTRICT=test should mask test USE flag for package
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Conceptual/Abstract Ideas (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 226389 (view as bug list)
Depends on:
Blocks: 912975 659322
  Show dependency tree
 
Reported: 2009-06-09 00:27 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2023-08-24 20:27 UTC (History)
4 users (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 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-06-09 00:27:34 UTC
While working on the new Ruby eclass packages, I could use setting RESTRICT=test for stuff that I haven't got the proper dependencies in yet, but still keeping test USE flag present and declared as it should.

Would be nice if Portage masked the test USE flag when RESTRICT is on.
Comment 1 Ulrich Müller gentoo-dev 2011-09-11 09:15:53 UTC
*** Bug 226389 has been marked as a duplicate of this bug. ***
Comment 2 Zac Medico gentoo-dev 2011-09-12 15:17:24 UTC
This is a little bit tricky, since RESTRICT support USE conditionals. So, we have to evaluate USE, use that to evaluate conditionals in RESTRICT, and then use that to adjust USE again.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-09-12 15:20:15 UTC
(In reply to comment #2)
> This is a little bit tricky, since RESTRICT support USE conditionals. So, we
> have to evaluate USE, use that to evaluate conditionals in RESTRICT, and then
> use that to adjust USE again.

The question would be then: do we want to support 'test?' in RESTRICT?
Comment 4 Zac Medico gentoo-dev 2011-09-12 15:55:05 UTC
I'd rather not ban test? conditionals, since it's not really necessary. We can use an algorithm like this:

1) calculate USE
2) evaluate RESTRICT
3) if test is in evaluated RESTRICT then adjust USE and re-evaluate RESTRICT
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-09-12 15:56:04 UTC
RESTRICT="test? ( fetch )"

I'd say so.
Comment 6 Alexander Vershilov (RETIRED) gentoo-dev 2012-03-23 14:09:44 UTC
Another problem is in case when tests are build on compile phase, so they will be build even if RESTRICT="test" is set. If tests are restricted because of build failure then all ebuild process will be broken, and it's not right behavior.
So masking test will fix this problem.
Comment 7 Zac Medico gentoo-dev 2013-02-02 09:08:13 UTC
This patch handles the simple case where RESTRICT=test is not conditional on any USE flags:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e746c0bf48eab6974e0537056fa93a356432b5ba
Comment 8 Zac Medico gentoo-dev 2013-02-12 04:12:41 UTC
(In reply to comment #7)
> This patch handles the simple case where RESTRICT=test is not conditional on
> any USE flags:
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;
> h=e746c0bf48eab6974e0537056fa93a356432b5ba

This is in 2.1.11.51 and 2.2.0_alpha162.
Comment 9 Zac Medico gentoo-dev 2018-08-12 21:53:56 UTC
This patch implements support for USE conditionals in RESTRICT:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=45986341a80cfb01dad470f56f02b210b3ebf753

commit 45986341a80cfb01dad470f56f02b210b3ebf753
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-08-11 21:04:05 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-08-12 00:40:32 +0000

    Support !test? conditionals in RESTRICT (bug 663278)
    
    Since RESTRICT="!test? ( test )" can be very useful within the context
    of bug 663278, pass an appropriate uselist parameter to the RESTRICT
    use_reduce call. Make self.configdict["features"]["USE"] independent
    of IUSE and RESTRICT, so that the same value can be shared between
    packages with different settings, which is important when evaluating
    USE conditional RESTRICT. When the evaluated value of RESTRICT contains
    "test", handle it like IUSE="-test", since features USE is independent
    of RESTRICT.
    
    Bug: https://bugs.gentoo.org/663278

 lib/portage/package/ebuild/config.py | 40 +++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 14 deletions(-)