Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 373209 - sys-apps/portage: reliably link FEATURES="test" with USE="test"
Summary: sys-apps/portage: reliably link FEATURES="test" with USE="test"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 193946 198640 341655 (view as bug list)
Depends on:
Blocks: 912975 431026
  Show dependency tree
 
Reported: 2011-06-27 14:25 UTC by Ralph Sennhauser (RETIRED)
Modified: 2023-08-24 20:34 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 Ralph Sennhauser (RETIRED) gentoo-dev 2011-06-27 14:25:58 UTC
FEATURES="test" forces USE="test" as expected but FEATURES="-test" doesn't force USE="-test".

The expected behaviour for portage would be to always ignore USE="test" or even better complain if a user sets USE="test" / USE="-test" either on command line or through package.use / make.conf.

The edge case USE="-*" should be considered when implementing this.

The preferred way to display the test useflag in emerge -pv output would be the same as a masked respectively forced useflag.
Comment 1 Zac Medico gentoo-dev 2011-06-29 05:53:15 UTC
(In reply to comment #0)
> The expected behaviour for portage would be to always ignore USE="test" or even
> better complain if a user sets USE="test" / USE="-test" either on command line
> or through package.use / make.conf.

If we add additional coupling between FEATURES=test and USE=test, it complicates the code without necessarily providing any really practical value.

That fact that FEATURES=test happens to enable USE=test is really just to ensure that src_test dependencies are satisfied when appropriate. It works fine as it is.

Sometimes people enable USE=test globally in order to avoid having FEATURES=test interact with emerge --newuse behavior, since they have it configured such that USE=test is enabled whether or not FEATURES=test is enabled. If we implement your suggestion, it seems like it might interfere with this use case.
Comment 2 Ralph Sennhauser (RETIRED) gentoo-dev 2011-06-30 10:33:46 UTC
A user either wants to run src_test or not.

Portage complaining about USE="test" in the form of 'Use FEATURES="test" to enable optional tests (often unit tests).' would prevent a lot of confusion in the first place.

As the useflag description says it's a workaround to pull in test dependencies only if needed. Many say it shouldn't be a useflag at all. I agree, but unconditionally depending on test dependencies isn't an option either.

So I believe test should be treated as a useflag only where needed, ie. within ebuilds/eclasses. Fully linking the value of 'use test' with FEATURES="test" would also allow to reliably tell whether src_test will be run from within the ebuild in a package manager independent form. This could well have some use cases. Could be an item for a future EAPI.

(In reply to comment #1)
> 
> Sometimes people enable USE=test globally in order to avoid having
> FEATURES=test interact with emerge --newuse behavior, since they have it
> configured such that USE=test is enabled whether or not FEATURES=test is
> enabled. If we implement your suggestion, it seems like it might interfere with
> this use case.

It seems to me that the motivation for this case was the lack of per package env configuration. See https://bugs.gentoo.org/show_bug.cgi?id=193946#c2


The case FEATURES="-test" USE="test", which unexperienced users might come up unintentionally, will pull a lot of stuff with no gain at all or even worse create circular deps and other minor issues.
Comment 3 Zac Medico gentoo-dev 2011-06-30 11:05:59 UTC
I like the idea, and have a couple of requirements to add:

1) Behavior of options like emerge --newuse will be entirely independent of the "test" flag state.

2) All USE flag displays will have to display the "test" flag in a way that makes it distinguishable from normal, masked, and forced flags.
Comment 4 Ralph Sennhauser (RETIRED) gentoo-dev 2011-07-09 07:33:13 UTC
Didn't took long to find an example where the behaviour described in in here would have helped. http://forums.gentoo.org/viewtopic-t-885952-highlight-.html

(In reply to comment #3)
> I like the idea, and have a couple of requirements to add:
> 
> 1) Behavior of options like emerge --newuse will be entirely independent of the
> "test" flag state.
> 
> 2) All USE flag displays will have to display the "test" flag in a way that
> makes it distinguishable from normal, masked, and forced flags.

If you already intend to have a new way to display the "test" flag, you might think up something which potentially could handle other special use flags as well. "arch" and "libc" useflags for instance would be kind of similar in nature.
Comment 5 Zac Medico gentoo-dev 2011-07-09 07:43:00 UTC
Well, the arch and libc flags are close enough to use.force since they're never supposed to change. In fact, the profiles have those flags in use.force already.
Comment 6 Ralph Sennhauser (RETIRED) gentoo-dev 2011-07-09 08:55:57 UTC
(In reply to comment #5)
> Well, the arch and libc flags are close enough to use.force since they're never
> supposed to change. In fact, the profiles have those flags in use.force
> already.

In case of arch and libc I'm thinking about cross root support. So them changing is in principle valid.

The difference is one is forced by FEATURES, the other by profile. Depending on what you had in mind they do or do not fit together. I don't mind either way.
Comment 7 Zac Medico gentoo-dev 2012-05-26 21:09:02 UTC
*** Bug 193946 has been marked as a duplicate of this bug. ***
Comment 8 Zac Medico gentoo-dev 2012-05-26 21:09:28 UTC
*** Bug 198640 has been marked as a duplicate of this bug. ***
Comment 9 Zac Medico gentoo-dev 2012-05-26 21:13:15 UTC
*** Bug 341655 has been marked as a duplicate of this bug. ***
Comment 10 Zac Medico gentoo-dev 2012-09-13 22:58:58 UTC
This is fixed in git:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6b19f71b39b6af43307abf20654511bace041217

The "test" flag will show as {test} or {-test} in the emerge output, in order to indicate that it is bound to the FEATURES setting.

Also, options like emerge --newuse will ignore the state of USE=test, since users typically don't want to trigger a bunch of rebuilds when they enable or disable FEATURES=test.
Comment 11 Zac Medico gentoo-dev 2012-09-14 02:58:15 UTC
This is fixed in 2.1.11.17 and 2.2.0_alpha128.
Comment 12 Zac Medico gentoo-dev 2018-08-08 04:01:03 UTC
We've got a new approach, involving USE_ORDER:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=8c5598c1af2c4c96546f196e2213211ec9cd7e7a

commit 8c5598c1af2c4c96546f196e2213211ec9cd7e7a
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-06-04 10:21:45 +0200
Commit:     Michał Górny <mgorny@gentoo.org>
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 <zmedico@gentoo.org>
    Closes: https://github.com/gentoo/portage/pull/347