Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 61732 - specifying default USE settings on a per package-version basis via IUSE
Summary: specifying default USE settings on a per package-version basis via IUSE
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All All
: High enhancement (vote)
Assignee: Portage team
URL: http://article.gmane.org/gmane.linux....
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 147007 174410
  Show dependency tree
 
Reported: 2004-08-25 23:20 UTC by SpanKY
Modified: 2008-01-28 00:31 UTC (History)
20 users (show)

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


Attachments
prelimenary patch (emerge-IUSE.patch,2.75 KB, patch)
2006-01-02 13:09 UTC, Alec Warner (RETIRED)
Details | Diff
A crappy ebuild to test with. (IUSE-test-1.0.ebuild,703 bytes, application/octet-stream)
2006-01-02 13:14 UTC, Alec Warner (RETIRED)
Details
New "real" patch (IUSE-DEFAULTS-v0.1.patch,6.65 KB, patch)
2006-02-13 09:35 UTC, Alec Warner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2004-08-25 23:20:34 UTC
see noted thread for more info but basically here is the problem:

- we have global and local USE flags
- default global USE settings can be specified via make.defaults
  - per profile and keeping settings across profiles is a pita for maintainers
- nothing exists to specify default local USE settings
- maintainers usually know best what a good sane 'default' USE setting is

here is the proposed solution:

(short term first stage)
updated IUSE syntax which will allow for setting default flags ... this is on a per-package and per-version basis since each ebuild can set IUSE differently ... also note that this can be done for both global and local USE flags; if it's in $IUSE it's fair game

for example, nano-1.3.4:
IUSE="nls build +spell +justify debug slang ncurses +mac"
if a user's USE did not have 'justify' specified either as 'justify' or '-justify', then portage would auto add 'justify' to USE for nano-1.3.4 ... basically portage considers $IUSE as the last item in the env ordering system

(long term second stage)
some people suggested we could also support '-' in IUSE with this system.  for example, if make.defaults has USE="sdl", but the ebuild has IUSE="-sdl", and the user has nothing to say one way or the other for sdl, then sdl would be turned off for that package
Comment 1 Brian Harring (RETIRED) gentoo-dev 2004-08-27 13:02:34 UTC
I like it, although nobody has thrown out ideas for backwards compatibility (aside from that ebuild dep'ing on a version of portage that has the support, which works).
Comment 2 Nicholas Jones (RETIRED) gentoo-dev 2004-10-09 19:34:43 UTC
This includes a very large bit of complexity. Now we have to determine
the profile's "intent" and the "intent" of the user's selections in
their config and judge them against the maintainer's "intent".

I think it's neat and glittery, but highly confusing.

As a small excercise, please identify the course of action for the following:
(Final applied USE, and what USE is saved in the DB)

Default: USE="a b c"
Auto:    USE="a"
User:    USE="-a b d"
IUSE="+a -b -c -d +e"

Default: USE="a b c"
Auto:    USE="e"
User:    USE="-a b d"
IUSE="-a -b -c -d -e"

Default: USE="a b c"
Auto:    USE="e"
User:    USE="-* f"
IUSE="+a +b +c +d +e"

Default: USE="a b c"
Auto:    USE="e"
User:    USE="-*"
IUSE="+a +b -c +d +e"

Comment 3 SpanKY gentoo-dev 2004-10-09 19:41:03 UTC
the solution here is basically increment the settings:
use.defaults
ebuild's IUSE
make.defaults
user

i dont see how this is confusing ... basically you're taking make.defaults and complementing it with the ebuild's IUSE

you record into the database whatever is applied to the ebuild when you emerge it
Comment 4 Stefan Schweizer (RETIRED) gentoo-dev 2005-01-16 04:03:08 UTC
This is also valid for beep-media-player, where a IUSE=+mp3 is needed.
Comment 5 Michiel de Bruijne 2005-02-08 04:16:57 UTC
Hi Nicholas,

Could you please explain why/where you see a very large bit of complexity, I don't see it either, just evaluate in the following order;

use.defaults
ebuild's IUSE
make.defaults
make.conf
package.use
use.mask
if not set in previous then disabled

About the backwards compatibility; why not make it a policy that if you want to use a tree at x point in time you need the stable version of portage available in x point in time?
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2005-02-09 05:36:19 UTC
> (long term second stage)
> some people suggested we could also support '-' in IUSE with this system.  for
> example, if make.defaults has USE="sdl", but the ebuild has IUSE="-sdl", and the
> user has nothing to say one way or the other for sdl, then sdl would be turned
> off for that package

Just need to make sure devs ONLY use this when the feature is broken or cause
issues, and not when they do not like it/whatever.
Comment 7 Nicholas Jones (RETIRED) gentoo-dev 2005-03-06 15:55:09 UTC
The better way to handle this is probably via use requirements
in the depend strings.
Comment 8 Jason Stubbs (RETIRED) gentoo-dev 2005-07-28 07:25:36 UTC
Putting a hold on feature requests for portage as they are drowning out the 
bugs. Most of these features should be available in the next major version of 
portage. But for the time being, they are just drowning out the major bugs and 
delaying the next version's progress. 
 
Any bugs that contain patches and any bugs for etc-update or dispatch-conf can 
be reopened. Sorry, I'm just not good enough with bugzilla. ;) 
Comment 9 Petteri Räty (RETIRED) gentoo-dev 2005-10-20 15:05:07 UTC
One way to make this work in a backwards compatible way is to just add
${PORTDIR}/profiles/package.use. Then we could move to using the new syntax when
the new EAPI stuff is implemented.
Comment 10 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-02 13:08:34 UTC
Working on this.
Comment 11 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-02 13:09:53 UTC
Created attachment 76018 [details, diff]
prelimenary patch

This is just a proof of concept and learning tool, also sent to the ML.  Hoping for more input, need to review the archives above...
Comment 12 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-02 13:14:06 UTC
Created attachment 76019 [details]
A crappy ebuild to test with.

Here is the ebuild I used for testing.  No it doesn't pass QA, no I don't care.
Comment 13 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-02-13 09:35:26 UTC
Created attachment 79707 [details, diff]
New "real" patch

Ok, this one needs testing, but is how it will probably get implemented.

IUSE_DEFAULTS instead of IUSE for backwards compatability.
USE_ORDER="env:pkg:conf:iuse_defaults:auto:defaults"

I'll upload a test ebuild later, but basically you ehh put things in IUSE_DEFAULTS in an ebuild, such as IUSE_DEFAULTS="-cxx"

This shouldl apply to 2.1_pre4 and trunk.  You need to either add iuse_defaults to USE_ORDER in make.conf or just set USE_ORDER="" make.conf to get the proper defaults.
Comment 14 solar (RETIRED) gentoo-dev 2006-08-09 05:02:13 UTC
I'm in favor of this basic support being added to portage.
This would round out portage in a nice way now that USE_ORDER w/ auto 
was deprecated.
Comment 15 Zac Medico gentoo-dev 2006-10-12 10:37:56 UTC
(In reply to comment #9)
> One way to make this work in a backwards compatible way is to just add
> ${PORTDIR}/profiles/package.use. Then we could move to using the new syntax when
> the new EAPI stuff is implemented.

I'm working on a patch that does both.  The patch adds 2 more layers to the USE_ORDER stack: pkginternal and pkgprofile.  The pkginternal is for +flag inside IUSE and pkgprofile is for package.use inside profiles.

USE_ORDER = "env:pkg:conf:pkgprofile:defaults:pkginternal"

The intention is that the IUSE defaults is for flags that should be enabled regardless of profile.  Then, package.use is available for flags that might vary depending on the profile.  For example, a server profile might enable server flags and a desktop profile might enable client flags.
Comment 16 Zac Medico gentoo-dev 2006-10-13 21:23:38 UTC
Most people have responded favorable to the idea of IUSE defaults and profile package.use, so I've gone ahead and put support for both in svn r4679.  Since people shouldn't use these immediately in the main tree, we can always revert one or both sometime in the near future if we need to.
Comment 17 Zac Medico gentoo-dev 2006-10-14 00:54:58 UTC
This has been released in 2.1.2_pre3.
Comment 18 Zac Medico gentoo-dev 2007-04-13 22:03:45 UTC
(In reply to comment #0)
> (long term second stage)
> some people suggested we could also support '-' in IUSE with this system.  for example, if make.defaults has USE="sdl", but the ebuild has IUSE="-sdl", and the user has nothing to say one way or the other for sdl, then sdl would be turned off for that package

The current implementation does not support -flag in IUSE.  One reason is the stacking order,  USE_ORDER="env:pkg:conf:defaults:pkginternal", where pkginternal represents flags from IUSE.  Since pkginternal comes at the beginning of the stack, there are no flags for it to negate.
Comment 19 Zac Medico gentoo-dev 2007-11-10 21:43:32 UTC
(In reply to comment #18)
> The current implementation does not support -flag in IUSE.

In versions of portage that support EAPI 1, -flag is supported, but it's usually not very useful due to the default USE_ORDER setting (see `man make.conf`).

Comment 20 David Watzke 2008-01-27 23:04:49 UTC
(In reply to comment #19)
> In versions of portage that support EAPI 1, -flag is supported, but it's
> usually not very useful due to the default USE_ORDER setting (see `man
> make.conf`).

Let me get this straight. It doesn't do what vapier suggested in comment #0; it only affects something if an environment variable USE has been set through /etc/env.d/. Am I right?
Comment 21 Zac Medico gentoo-dev 2008-01-28 00:31:18 UTC
(In reply to comment #20)
See explanation in bug 204196 comment #1.