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.
*** Bug 226389 has been marked as a duplicate of this bug. ***
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.
(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?
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
RESTRICT="test? ( fetch )" I'd say so.
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.
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
(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.
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(-)