Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 32114 - PROVIDES dont understand !?() syntax
Summary: PROVIDES dont understand !?() syntax
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: High blocker (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 69864 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-27 11:33 UTC by solar (RETIRED)
Modified: 2005-03-11 17:56 UTC (History)
6 users (show)

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


Attachments
portage-provides.patch (portage-provides.patch,426 bytes, patch)
2004-11-02 13:19 UTC, Harald van Dijk (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description solar (RETIRED) gentoo-dev 2003-10-27 11:33:22 UTC
While working on a pamless profiles I came across the need for PROVIDES to understand !? ( pkg ) syntax.

Here is an example

for (shadow)
PROVIDE="pam? ( virtual/login )"

for (pam-login)
PROVIDE="!pam? ( virtual/login )"
----------------------------------
When we try this the virtuals file becomes corrupted 
and must be hand repaired.

hardened db # cat /var/cache/edb/virtuals
sys-apps/console-tools sys-apps/kbd
pam? sys-apps/shadow
virtual/python dev-lang/python
virtual/kernel sys-kernel/linux-headers
virtual/glibc sys-libs/glibc
) sys-apps/shadow
virtual/editor app-editors/nano
virtual/bootloader sys-apps/lilo
virtual/linux-sources sys-kernel/grsec-sources
( sys-apps/shadow
virtual/login sys-apps/shadow

virtual/ssh net-misc/openssh
virtual/modutils sys-apps/modutils
virtual/os-headers sys-kernel/linux-headers
----------------------------------

The idea here is we have two packages that can both provide the /bin/login depending on USE flags. When -pam is set then we need to ensure that pam-login is tossed out the door and blocked.

Ideas, suggestions and workarounds are welcome, otherwise I'd like to see this type of functionaly get added.
Comment 1 SpanKY gentoo-dev 2003-10-27 15:59:31 UTC
again, another arguement for unification of the !?() parsing function for
*DEPEND, PROVIDE, and SRC_URI ;)
Comment 2 solar (RETIRED) gentoo-dev 2003-12-17 10:19:19 UTC
SpanKY,
Could you please point out another bug or two where this functionality 
was requested/needed if any exist.
Comment 3 solar (RETIRED) gentoo-dev 2004-04-30 22:32:36 UTC
dev-portage can somebody please make a comment on this? 
Yes/No/Go Away anything. 
It's very discouraging for developers when you don't/won't comment on bugs.
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-05-01 05:57:39 UTC
Presently, PROVIDE should only be unversioned cat/pkg atoms with "cat" being "virtual".

The need for conditional PROVIDEs is fairly plain, but will require a fair few changes implementation-wise, so it'll take a bit of time. There's no real workaround at the moment that doesn't break the ebuild caching.
Comment 5 solar (RETIRED) gentoo-dev 2004-06-15 11:17:10 UTC
I've come across the need for this again and I'm not sure how to 
proceed. Basically we will need to test for use uclibc in a fair # of packages 
and then conditionally provide a PROVIDE= This will thrash your cache I assume 
but without any another option I'm not sure what to do.. I know I sure
as heck don't want to hear devs yelling about QA problems when no other
solution exists.

It would be really really cool if we could get this functionaly of !?() in portage. hint hint smile :)
Comment 6 solar (RETIRED) gentoo-dev 2004-06-18 18:38:54 UTC
carpaski requested I mark this as a blocker. Once this is solved the embedded herd can actually start getting to work. 
Till then I guess we might have to resort to hacks that will end up killing the cache, such as use blah && PROVIDES=
Comment 7 Jason Stubbs (RETIRED) gentoo-dev 2004-07-23 21:15:50 UTC
Will be out in the next .51 release. Make sure to do some local testing to ensure that it works properly before it starts being used within the tree.
Comment 8 Marius Mauch (RETIRED) gentoo-dev 2004-07-24 05:15:06 UTC
And don't use it in the tree until .51 is stable for some time (a few weeks at least).
Comment 9 solar (RETIRED) gentoo-dev 2004-07-24 05:37:57 UTC
Jason,
very very nice.

Were you able to code it in such a way that it would be nice to the 
cache? If not should I/we also add something like RESTRICT=portage-cache
to the ebuilds that would use this type of functionality?

----------------------

genone,

The reason to not use in it the tree would be to avoid the virtuals 
corruption as mentioned in comment #0 ?

If so then should any ebuild that would benefit from these conditional
provides also maybe have a dep of >=sys-apps/portage-2.0.51_pre14 ?
Comment 10 Marius Mauch (RETIRED) gentoo-dev 2004-07-24 06:14:52 UTC
The reason is that you have no control about the users portage version and this new feature looks like it has an effect on depgraph creation (not comletely sure on that), so a simple DEPEND would not suffice. It's the same rule as for any change that affects naming, versioning, parsing or depgraph creation.
And the cache should be ok as the same syntax is used for *DEPEND and SRC_URI.
Comment 11 Jason Stubbs (RETIRED) gentoo-dev 2004-07-24 06:34:15 UTC
It won't break the cache. That's the main reason I put it in. Along with use-based SLOT support, there should be no reason for dynamic stuff in the global section of ebuilds after .51.

It is used in dep graph creation, but that is due to fixing bug 54608. Essentially, the virtuals are updated as the graph is built so that, for example, xorg-x11 -> xterm -> virtual/x11 doesn't install xfree.

It should be safe to use as soon as .51 goes stable as long as you put a depend on it. For ~arch ebuilds, it could even be done earlier, but not until .51 is unmasked.
Comment 12 Brian Harring (RETIRED) gentoo-dev 2004-08-16 11:35:27 UTC
Jason, has this been released?
Comment 13 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:48:15 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2
Comment 14 SpanKY gentoo-dev 2004-11-02 11:16:24 UTC
the code that handles this is broken

USE=-pam emerge shadow -pv

Calculating dependencies -

!!! Problem in sys-apps/shadow dependencies.
!!! 'in <string>' requires string as left operand exceptions

shadow ebuild has this: PROVIDE="!pam? ( virtual/login )"
Comment 15 Harald van Dijk (RETIRED) gentoo-dev 2004-11-02 13:19:28 UTC
Created attachment 43189 [details, diff]
portage-provides.patch

It seems to work with this...
Comment 16 SpanKY gentoo-dev 2004-11-02 15:50:40 UTC
*** Bug 69864 has been marked as a duplicate of this bug. ***
Comment 17 Jason Stubbs (RETIRED) gentoo-dev 2004-11-02 16:56:57 UTC
The patch is correct. Unfortunately this was the first testing anyone gave it. :/  There was also a similar occurence requiring the use of flatten().
Comment 18 Jason Stubbs (RETIRED) gentoo-dev 2004-11-10 03:25:53 UTC
>=portage-2.0.51 will actually support use-based provides. The only catch is that brackets can't be used. So, PROVIDE="use? ( virtual/pkg )" will fail where PROVIDE="use? virtual/pkg" will work without issue.
Comment 19 Jason Stubbs (RETIRED) gentoo-dev 2005-03-11 17:56:02 UTC
I should have clarified that last statement.. It applied to the available versions at the time of writing. All versions available in rsync fully support this brackets et al.