Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 2272 - portage: ability to depend on USE flags being enabled
Summary: portage: ability to depend on USE flags being enabled
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 7554 8401 20326 34905 38907 41170 41452 51584 53467 57828 74328 81461 83554 106685 111031 113599 128123 133058 136448 136578 142209 149423 149556 152930 153366 155945 190855 191370 193335 197666 198126 199460 206613 208872 236147 (view as bug list)
Depends on:
Blocks: 142941 155723 dumb-ebuild-problem 64289 74435 233213
  Show dependency tree
 
Reported: 2002-04-30 06:24 UTC by kde123
Modified: 2011-10-30 22:21 UTC (History)
69 users (show)

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


Attachments
have_flags.patch (have_flags.patch,1.28 KB, patch)
2004-01-23 02:32 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kde123 2002-04-30 06:24:07 UTC
gdk-pixbuf works just fine without gnome, but the ebuild enforces inclusion of 
gnome.  I would suggest a gdk-pixbuf-gnome and a gdk-pixbuf (no gnome support) 
ebuild.
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2002-04-30 06:45:32 UTC
this has come up so many times, it is not even funny any more.

Daniel, we might want to give this some serious consideration.
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2002-04-30 15:41:33 UTC
Only way to properly fix this, is to have the ability to specify the USE
flags something should have been compiled with in DEPEND.  Otherwise
we will have half backed hacks which will only make things worse.
Comment 3 SpanKY gentoo-dev 2002-09-26 10:13:35 UTC
*** Bug 8401 has been marked as a duplicate of this bug. ***
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-12 14:11:17 UTC
Any news on this front ?
Comment 5 Hannes Mehnert (RETIRED) gentoo-dev 2002-10-20 17:00:11 UTC
another package we need this feature for is vim (because vimpart needs a vim merged 
with dcop enabled (kde in use)) 
would be nice to have this soon in portage, than we can merge [g,k]vim[-core] ebuilds 
back into one ebuild. 
Comment 6 George Shapovalov (RETIRED) gentoo-dev 2002-10-24 00:26:41 UTC
Another "case":
dev-ml/lablgl depends on dev-lang/ocaml and gtk. Ocaml has gtk as an *optional*
dependency.
Right now I can only do a dirty hack in ebuild which will only catch ~90% of
situations (namely check if gtk is defined system-wide and if not check if ocaml
is already installed). This is better than nothing, but still bad and ugly.
So yes, having this feature will be very nice.

George
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-02 05:14:56 UTC
Could this be resolved some time soon ?  If you need help, just tell us how.
Comment 8 Grant Goodyear (RETIRED) gentoo-dev 2002-12-04 10:57:49 UTC
*** Bug 7554 has been marked as a duplicate of this bug. ***
Comment 9 Christian Parpart (RETIRED) gentoo-dev 2003-01-12 01:08:41 UTC
has this been fixed in emerge now?  
I do ask because it isn't yet mentioned neither here nor in othe other (duplicated) bug 
report. 
 
otherwise, when will this be fixed? at which position is this on the portage todo-list?..... 
 
many thanks, 
Christian Parpart. 
Comment 10 Martin Holzer (RETIRED) gentoo-dev 2003-10-12 15:11:48 UTC
portage can do this now
Comment 11 SpanKY gentoo-dev 2003-12-01 21:04:01 UTC
actually, it still cant
Comment 12 SpanKY gentoo-dev 2003-12-02 21:31:41 UTC
*** Bug 34905 has been marked as a duplicate of this bug. ***
Comment 13 SpanKY gentoo-dev 2004-01-21 04:17:59 UTC
*** Bug 38907 has been marked as a duplicate of this bug. ***
Comment 14 TGL 2004-01-23 02:32:22 UTC
Created attachment 24275 [details, diff]
have_flags.patch

I don't really know what should be the behavior of a dependency on USE flags,
but at least here is a patch that adds a new portageq/ebuild.sh function to
test if a given pkg has been emerged with some given use flags. 

Usage from portageq is:
% portageq have_flags <root> <depend_atom> [<use_flag>]+
==> exit with code 0 if all matching pkgs have been compiled with all the
required flags. Here "all pkgs" means that if there is no matching pkg, it will
also exit(0). (Use has_version if you want to ensure there is at least one
matching pkg, but this is not the goal of this function.)

Usage from an ebuild:
  have_flags <depend_atom> [<use_flags>]
==> returns 0 or 1, with the same behavior as the portageq call.

I think the good way to use it would be in pkg_setup(), to display an error and
die if the user have to reemerge some pkg with different use flags. For
instance:

pkg_setup() {
    have_flags "=dev-ml/lablgtk-2*" glade \
       || { eerror "Please reemerge dev-ml/lablgtk-2.x with the \"glade\" local
USE flag enabled." 
	    die "You need to reemerge something." ; }
}
Comment 15 foser (RETIRED) gentoo-dev 2004-02-10 15:12:38 UTC
*** Bug 41170 has been marked as a duplicate of this bug. ***
Comment 16 SpanKY gentoo-dev 2004-02-13 10:58:05 UTC
*** Bug 41452 has been marked as a duplicate of this bug. ***
Comment 17 Brian Harring (RETIRED) gentoo-dev 2004-07-22 00:48:55 UTC
*** Bug 57828 has been marked as a duplicate of this bug. ***
Comment 18 Peter Johanson (RETIRED) gentoo-dev 2004-08-05 08:08:35 UTC
Let me add my voice to really wanting this in portage. Many of the various mono packages rely on the gtk-sharp package having certain USE flags enabled to build the different optional pieces (like gnome-sharp and gtkhtml-sharp in particular). It would be wonderful not to have to add silly checks for files all over the place instead of having USE based DEPENDs.

On IRC i've heard conflicting "this'll be in .51" to "i've seen no code for this yet"... so what's the status?
Comment 19 foser (RETIRED) gentoo-dev 2004-08-09 10:56:55 UTC
*** Bug 53467 has been marked as a duplicate of this bug. ***
Comment 20 Brian Harring (RETIRED) gentoo-dev 2004-08-10 23:43:13 UTC
*** Bug 20326 has been marked as a duplicate of this bug. ***
Comment 21 Jason Stubbs (RETIRED) gentoo-dev 2004-08-11 04:22:50 UTC
I guess I didn't do that properly.. :/
Comment 22 Andrew Cowie 2004-11-10 16:29:08 UTC
Just had an email 'round gentoo-dev about this: my use case is that I need to test if gcc was compiled such that the Java language module is present, ie USE=gcj resulting in `gcj` being available on the system.

So, +1 or whatever :)

AfC
Comment 23 Jason Stubbs (RETIRED) gentoo-dev 2004-11-11 03:56:53 UTC
/me hates duplicate mails.

Not a chance this will be in the 2.0.51 series, but should be in what comes after.
Comment 24 TGL 2004-12-06 19:14:56 UTC
Comment on attachment 24275 [details, diff]
have_flags.patch

Marking this patch obsolete since a similar hack has been included in
eutils.eclass.
Comment 25 SpanKY gentoo-dev 2004-12-14 21:01:15 UTC
*** Bug 74328 has been marked as a duplicate of this bug. ***
Comment 26 John Nilsson 2005-01-31 07:45:56 UTC
So what is the recommended way of handling this situation? 

---snip---
# [FIXME] wxpython must be installed with USE="unicode"
# [FIXME] tunepimp must be installed with USE="python"
RDEPEND="
        >=dev-python/wxpython-2.5.1.5
        dev-python/python-musicbrainz
        >=media-libs/tunepimp-0.4.0_pre1
"
---snip---
Comment 27 SpanKY gentoo-dev 2005-01-31 07:49:22 UTC
the current work around is to use the function 'built_with_use' in the eutils eclass
Comment 28 Hanno Böck gentoo-dev 2005-02-13 11:21:48 UTC
*** Bug 81461 has been marked as a duplicate of this bug. ***
Comment 29 Sven Wegener gentoo-dev 2005-02-28 07:08:38 UTC
*** Bug 83554 has been marked as a duplicate of this bug. ***
Comment 30 Jakub Moc (RETIRED) gentoo-dev 2005-09-20 10:09:20 UTC
*** Bug 106685 has been marked as a duplicate of this bug. ***
Comment 31 Jason Stubbs (RETIRED) gentoo-dev 2005-10-07 09:20:04 UTC
*** Bug 51584 has been marked as a duplicate of this bug. ***
Comment 32 Martin Schlemmer (RETIRED) gentoo-dev 2005-11-01 00:58:45 UTC
*** Bug 111031 has been marked as a duplicate of this bug. ***
Comment 33 Jakub Moc (RETIRED) gentoo-dev 2005-11-25 17:16:24 UTC
*** Bug 113599 has been marked as a duplicate of this bug. ***
Comment 34 Andrew Frink 2006-02-14 07:03:37 UTC
just wanted to let add a +1, avahi with howl-compat use flag and gnome-vfs don't play well, because avahi blocks howl and gnome-vfs is hard coded to howl, not some virtual that only gets set to avahi when you emerge it with that flag. anyways i'm sure i'm way of base here, but it is kind of annoying, seeing as the newest banshee requires avahi
Comment 35 SpanKY gentoo-dev 2006-03-30 10:51:00 UTC
*** Bug 128123 has been marked as a duplicate of this bug. ***
Comment 36 Jakub Moc (RETIRED) gentoo-dev 2006-05-11 13:11:56 UTC
*** Bug 133058 has been marked as a duplicate of this bug. ***
Comment 37 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-06-11 10:53:42 UTC
*** Bug 136448 has been marked as a duplicate of this bug. ***
Comment 38 Jakub Moc (RETIRED) gentoo-dev 2006-06-12 13:58:53 UTC
*** Bug 136578 has been marked as a duplicate of this bug. ***
Comment 39 Jakub Moc (RETIRED) gentoo-dev 2006-07-30 12:12:48 UTC
*** Bug 142209 has been marked as a duplicate of this bug. ***
Comment 40 Felix Schuster 2006-09-21 02:45:30 UTC
A while ago I installed media-video/VLC. Emerge told me that I also need to install wxGTK and a few other packages. When it came to install VLC, VLC complained about wxGTK, because it was built without the "unicode" USE-Flag. So I had to reemerge wxGTK. This took me a long time - only 1100MHz...
I would be glad about a portage, that could tell me, before I start emerging anything, which USE-Flags are missing.
Comment 41 Jakub Moc (RETIRED) gentoo-dev 2006-09-28 08:18:54 UTC
*** Bug 149423 has been marked as a duplicate of this bug. ***
Comment 42 Zac Medico gentoo-dev 2006-09-29 12:59:26 UTC
*** Bug 149556 has been marked as a duplicate of this bug. ***
Comment 43 Marius Mauch (RETIRED) gentoo-dev 2006-10-26 15:47:14 UTC
*** Bug 152930 has been marked as a duplicate of this bug. ***
Comment 44 Zac Medico gentoo-dev 2006-10-29 15:51:09 UTC
*** Bug 153366 has been marked as a duplicate of this bug. ***
Comment 45 Jakub Moc (RETIRED) gentoo-dev 2006-11-22 10:10:19 UTC
*** Bug 155945 has been marked as a duplicate of this bug. ***
Comment 46 Daniel Herzog 2006-12-13 09:10:29 UTC
Why is "built_with_use" only a work around and not the solution, as stated by SpanKY/vapier in comment #27 ?
Comment 47 Joel Martin (RETIRED) gentoo-dev 2006-12-13 09:15:12 UTC
Because built_with_use happens after dependency calculations. It's only useful for make the install stop with an error. You want is to be able to express the dependency in *DEPENDS so that portage can pick the right packages to install in the first place.
Comment 48 Sven Wegener gentoo-dev 2007-04-21 15:18:28 UTC
*** Bug 175444 has been marked as a duplicate of this bug. ***
Comment 49 Elias Probst 2007-07-25 11:04:43 UTC
Any news here? Has calculation of USE-flags in dependencies been considered for EAPI-1 proposals?
Comment 50 Zac Medico gentoo-dev 2007-08-23 23:04:44 UTC
*** Bug 189966 has been marked as a duplicate of this bug. ***
Comment 51 Jakub Moc (RETIRED) gentoo-dev 2007-08-31 09:55:02 UTC
*** Bug 190855 has been marked as a duplicate of this bug. ***
Comment 52 Jakub Moc (RETIRED) gentoo-dev 2007-09-05 11:55:17 UTC
*** Bug 191370 has been marked as a duplicate of this bug. ***
Comment 53 Jakub Moc (RETIRED) gentoo-dev 2007-09-21 15:49:26 UTC
*** Bug 193335 has been marked as a duplicate of this bug. ***
Comment 54 Jakub Moc (RETIRED) gentoo-dev 2007-10-31 21:53:06 UTC
*** Bug 197666 has been marked as a duplicate of this bug. ***
Comment 55 Jakub Moc (RETIRED) gentoo-dev 2007-11-05 07:09:52 UTC
*** Bug 198126 has been marked as a duplicate of this bug. ***
Comment 56 Jakub Moc (RETIRED) gentoo-dev 2007-11-17 19:07:50 UTC
*** Bug 199460 has been marked as a duplicate of this bug. ***
Comment 57 Zac Medico gentoo-dev 2008-01-19 04:59:20 UTC
*** Bug 206613 has been marked as a duplicate of this bug. ***
Comment 58 Jakub Moc (RETIRED) gentoo-dev 2008-02-04 20:59:53 UTC
*** Bug 208872 has been marked as a duplicate of this bug. ***
Comment 59 Ruben Faelens 2008-05-25 11:08:39 UTC
Happy 6th birthday, bug 2272! (yes, I'm being an unconstructive asshole ;) )
Comment 60 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-05-26 07:32:52 UTC
(In reply to comment #59)
> Happy 6th birthday, bug 2272! (yes, I'm being an unconstructive asshole ;) ) 

Yup. Luckily we also have constructive non-assholes.
[23:57] +CIA-9 zmedico * gentoo/xml/htdocs/proj/en/portage/index.xml: Note that USE dep support is in svn r10387.
Comment 61 Marius Mauch (RETIRED) gentoo-dev 2008-06-10 16:08:13 UTC
Fixed in or before 2.2_pre8
Comment 62 Steffen Schaumburg 2008-06-11 05:19:02 UTC
Brilliant, thanks :)
Somewhat off-topic - does anyone happen to know if this works in paludis, too?
Comment 63 Zac Medico gentoo-dev 2008-07-28 23:07:39 UTC
Here are some examples showing everything that's supported when using >=sys-apps/portage-2.2_pre4 with EAPI="2_pre0" set in the ebuild (bug #233213 tracks EAPI 2_pre0). These come from "Ebuild" chapter of the html docs that are installed with portage when USE="doc" is enabled.

Unconditional USE Dependencies

Table 6.2. Syntax Examples
Example	        Meaning
foo[bar]	foo must have bar enabled
foo[bar,baz]	foo must have both bar and baz enabled
foo[-bar,baz]	foo must have bar disabled and baz enabled

Conditional USE Dependencies

Table 6.3. Syntax Examples
Compact Form	Equivalent Expanded Form
foo[bar?]	bar? ( foo[bar] ) !bar? ( foo )
foo[-bar?]	bar? ( foo ) !bar? ( foo[-bar] )
foo[bar=]	bar? ( foo[bar] ) !bar? ( foo[-bar] )
foo[bar!=]	bar? ( foo[-bar] ) !bar? ( foo[bar] )
Comment 64 Marius Mauch (RETIRED) gentoo-dev 2008-07-29 00:51:12 UTC
(In reply to comment #63)
> foo[bar!=]      bar? ( foo[-bar] ) !bar? ( foo[bar] )

Could we change that to foo[-bar=] eventually? I rather dislike the current syntax  as
- it's inconsistent with the ? operator, negation should use the same syntax for all variants
- wrt use flags, ! is usually implemented as a prefix operator
Comment 65 Zac Medico gentoo-dev 2008-07-29 03:00:18 UTC
(In reply to comment #64)
> (In reply to comment #63)
> > foo[bar!=]      bar? ( foo[-bar] ) !bar? ( foo[bar] )
> 
> Could we change that to foo[-bar=] eventually? I rather dislike the current
> syntax  as
> - it's inconsistent with the ? operator, negation should use the same syntax
> for all variants

Well, I'd describe != as an "inversion" rather than a "negation". They're two distinctly different operations.

> - wrt use flags, ! is usually implemented as a prefix operator

It still is a prefix operator if you view it as prefixing the = symbol. Also, practically every language I can think of has a != operator.
Comment 66 Marius Mauch (RETIRED) gentoo-dev 2008-07-29 21:13:00 UTC
(In reply to comment #65)
> Well, I'd describe != as an "inversion" rather than a "negation". They're two
> distinctly different operations.
...
> It still is a prefix operator if you view it as prefixing the = symbol. Also,
> practically every language I can think of has a != operator.

Guess the problem is that I see != here as two distinct operators. IMO reading the != as "not equal" like in other languages doesn't make much sense here as we only have one operand (the current state of "bar"). I read the = more as "assign to state of operand", and != would be "assign to inversed state", which is however the same as "assign to state" if the operand is negated. Same logic applies to the ? operator (which I read as "assign if operand"). So either that should be changed to !? (which looks quite stupid) as well if you see ! as a prefix to =, or the syntax should be changed as suggested in comment #64. The current situation is just inconsistent and therefore silly.
Comment 67 Zac Medico gentoo-dev 2008-07-30 01:27:10 UTC
(In reply to comment #66)
> So either that
> should be changed to !? (which looks quite stupid) as well if you see ! as a
> prefix to =, or the syntax should be changed as suggested in comment #64. The
> current situation is just inconsistent and therefore silly.

Seems reasonable. Maybe we should also swap the - character with a ! character in all the conditionals, so it's consistent with the pre-existing conditional syntax? Then we'd have something like this:

Compact Form    Equivalent Expanded Form
foo[bar?]       bar? ( foo[bar] ) !bar? ( foo )
foo[!bar?]      bar? ( foo ) !bar? ( foo[-bar] )
foo[bar=]       bar? ( foo[bar] ) !bar? ( foo[-bar] )
foo[!bar=]      bar? ( foo[-bar] ) !bar? ( foo[bar] )

Comment 68 Marius Mauch (RETIRED) gentoo-dev 2008-07-30 02:27:49 UTC
(In reply to comment #67)
> Seems reasonable. Maybe we should also swap the - character with a ! character
> in all the conditionals, so it's consistent with the pre-existing conditional
> syntax?

That works for me too.
Comment 69 Zac Medico gentoo-dev 2008-07-30 10:23:07 UTC
I've released sys-apps/portage-2.2_rc5 and it supports a new EAPI="2_pre1" which has the conditional syntax shown in comment #67. The previous experimental EAPI="2_pre0" value is no longer supported.
Comment 70 Zac Medico gentoo-dev 2008-08-29 22:19:33 UTC
*** Bug 236147 has been marked as a duplicate of this bug. ***
Comment 71 Serkan Kaba (RETIRED) gentoo-dev 2009-01-27 14:32:26 UTC
*** Bug 256519 has been marked as a duplicate of this bug. ***