Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 647938

Summary: Any of many dependency in ebuild with use flags solved wrong ( pkg not installed || pkg installed with a specific use flag )
Product: Portage Development Reporter: Jan Buecken <jb.faq>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: esigra, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
URL: https://devmanual.gentoo.org/general-concepts/dependencies/index.html
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 155723    
Attachments: unit test

Description Jan Buecken 2018-02-17 11:22:02 UTC
Hello,
I'm not sure if it is a bug or a feature, so I put it as a feature here in the first place.

I'm writing an ebuild and I tried to use the following condition:
 
RDEPEND="|| ( media-plugins/alsa-plugins[abi_x86_32(-)] !media-sound/pulseaudio )"

It should say: 
If pulseaudio is installed, then alsa-plugins should be installed with the 32bit use flag OR pulseaudio should not be installed


In theory, the any of many condition should be able to cover this?
https://devmanual.gentoo.org/general-concepts/dependencies/index.html


But I get a blocker only:

Calculating dependencies... done!
[ebuild     U ~] games-fps/ut2003-2225-r9007::own [2225-r9006::own] USE="-dedicated" 9,805 KiB
[blocks B      ] media-sound/pulseaudio ("media-sound/pulseaudio" is blocking games-fps/ut2003-2225-r9007)

Total: 1 package (1 upgrade), Size of downloads: 9,805 KiB
Conflict: 1 block (1 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.


This bug should clarify if the above condition should be possible, or if it is a valid feature request, or if there is another way to specify such a statement.

This bug should not cover that I'm try to extend an ebuild for an old 32bit application, and that I may be able to solve the sound bug with the application if I configure pulseaudio correctly to not be involved with this 32bit application, if it is not installed in 32bit.
Comment 1 Zac Medico gentoo-dev 2018-02-19 00:25:03 UTC
There have been a number of recent changes in the relevant code, so you may get a different result with the portage-2.3.24 (see bug 645002).

The reason it chooses the blocker is that this choice "costs less" because it doesn't have to install media-plugins/alsa-plugins[abi_x86_32(-)], but the cost calculation has changed in portage-2.3.24, so what portage version are you using?

Also, the way that you are using the blocker looks questionable, but it might work as intended with portage-2.3.24.
Comment 2 Jan Buecken 2018-02-25 21:53:56 UTC
(In reply to Zac Medico from comment #1)
> There have been a number of recent changes in the relevant code, so you may
> get a different result with the portage-2.3.24 (see bug 645002).

Same result

> 
> The reason it chooses the blocker is that this choice "costs less" because
> it doesn't have to install media-plugins/alsa-plugins[abi_x86_32(-)]

But it chooses it even if media-plugins/alsa-plugins[abi_x86_32(-)] is fullfilled already, is this as intended?

> but
> the cost calculation has changed in portage-2.3.24, so what portage version
> are you using?

Tested with 2.3.19-r1 (~)2.3.24-r

> 
> Also, the way that you are using the blocker looks questionable, but it
> might work as intended with portage-2.3.24.

I did not found any documentation to do what I want to do. Is there a best practise guide? (maybe I need to switch to gentoo forum with this question, but at least this bug should sort out if portage works as intended in this case and/or if https://devmanual.gentoo.org/general-concepts/dependencies/index.html needs a update?)

Greetings
Comment 3 Zac Medico gentoo-dev 2018-02-26 04:25:34 UTC
Created attachment 521060 [details]
unit test

The attached unit test reproduces the problem. This patch suppresses the problem:

> diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
> index 2896e2389..b4614be0c 100644
> --- a/pym/portage/dep/dep_check.py
> +++ b/pym/portage/dep/dep_check.py
> @@ -562,10 +562,10 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
>  					# added to the digraph, in order to distinguish between
>  					# those packages and installed packages that may need
>  					# to be uninstalled in order to resolve blockers.
> -					if not any(pkg in graph for pkg in
> -						graph_db.match_pkgs(atom)):
> -						all_in_graph = False
> -						break
> +					#if not any(pkg in graph for pkg in
> +					#	graph_db.match_pkgs(atom)):
> +					#	all_in_graph = False
> +					#	break
>  				circular_atom = None
>  				if not (parent is None or priority is None) and \
>  					(parent.onlydeps or
Comment 4 Zac Medico gentoo-dev 2018-02-26 04:30:07 UTC
Generally, blockers are used to indicate a conflict of some kind, and the presence of some package (such as media-plugins/alsa-plugins) typically does not make this sort of conflict "disappear".