Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46980 - emerge tracebacks while trying to emerge development-sources (kernel-2.eclass)
Summary: emerge tracebacks while trying to emerge development-sources (kernel-2.eclass)
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-04-06 10:53 UTC by SpanKY
Modified: 2004-08-16 11:39 UTC (History)
2 users (show)

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


Attachments
Fixes handling of nested use without parenthesis (portage-2.0.50-r4-use_reduce.patch,2.11 KB, patch)
2004-04-08 21:00 UTC, Jason Stubbs (RETIRED)
Details | Diff
Non-nested use warning is always printed (portage-2.0.50-r4-use_reduce.patch,1.91 KB, patch)
2004-04-10 08:35 UTC, Jason Stubbs (RETIRED)
Details | Diff
Bug fix (portage-2.0.50-r4-use_reduce.patch,1.86 KB, patch)
2004-04-10 08:43 UTC, Jason Stubbs (RETIRED)
Details | Diff
diff -u (same as previous) (portage-2.0.50-r4-use_reduce.patch,2.28 KB, patch)
2004-04-10 09:51 UTC, Jason Stubbs (RETIRED)
Details | Diff
another solution (bug46980.patch,576 bytes, patch)
2004-04-10 10:53 UTC, Masatomo Nakano (RETIRED)
Details | Diff
Fixed patch (portage-2.0.50-r4-use_reduce.patch,2.22 KB, patch)
2004-04-10 18:30 UTC, Jason Stubbs (RETIRED)
Details | Diff
Fix for mishandling of "use? ()" (portage-2.0.50-r4-paren_reduce.patch,541 bytes, patch)
2004-04-10 19:25 UTC, Jason Stubbs (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-04-06 10:53:27 UTC
root@vapier 0 linux-headers # emerge development-sources -pv

These are the packages that I would merge, in order:

Calculating dependencies ...done!
Note: Nested use flags without parenthesis! (Deprecated)
      ppc? pcc64? sparc? ['mirror://gentoo/patches-2.6.5-sparc.tar.bz2']
Traceback (most recent call last):
  File "/usr/bin/emerge", line 2651, in ?
    mydepgraph.display(mydepgraph.altlist())
  File "/usr/bin/emerge", line 1337, in display
    myfilesdict=portage.portdb.getfetchsizes(x[2], useflags=self.applied_useflags[x[2]], debug=edebug)
  File "/usr/lib/portage/pym/portage.py", line 4818, in getfetchsizes
    myuris, myfiles = self.getfetchlist(mypkg,useflags=useflags)
  File "/usr/lib/portage/pym/portage.py", line 4797, in getfetchlist
    myurilist = portage_dep.use_reduce(myurilist,useflags,matchall=all)
  File "/usr/lib/portage/pym/portage_dep.py", line 103, in use_reduce
    raise ValueError, "Conditional with no target."
ValueError: Conditional with no target.
Comment 1 SpanKY gentoo-dev 2004-04-06 10:54:15 UTC
root@vapier 0 linux-headers # emerge info
Portage 2.0.50-r4 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3_pre20040207-r0, 2.6.5)
System uname: 2.6.5 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz

root@prophase 0 root # emerge info
Portage 2.0.50-r4 (default-sparc64-2004.0, gcc-3.3.3, glibc-2.3.3_pre20040207-r0, 2.6.4)
System uname: 2.6.4 sparc64 sun4u
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2004-04-08 21:00:29 UTC
Created attachment 28928 [details, diff]
Fixes handling of nested use without parenthesis

can't reproduce this...

looking at the code, i found that nested use without parenthesis are handled
incorrectly, though. DEPEND="a? b? c? z" will match on a USE of "c", "b c", "a
b c" or "". This patch fixes that.
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 08:26:07 UTC
Okay.. reproduced it and my other patch won't fix the bug because the bug is in kernel-2.eclass.

The deplist before use_reduce (where the exception occurs) is:
['mirror://kernel/linux/kernel/v2.6/linux-2.6.5.tar.bz2', 'x86?', 'ppc?', 'pcc64?', 'sparc?', ['mirror://gentoo/patches-2.6.5-sparc.tar.bz2'], 'mips?', 'alpha?', 'arm?', 'hppa?', 'amd64?', 'ia64?', 'x86obsd?']

or in normal syntax:

"mirror://kernel/linux/kernel/v2.6/linux-2.6.5.tar.bz2 x86? ppc? pcc64? sparc? (mirror://gentoo/patches-2.6.5-sparc.tar.bz2) mips? alpha? arm? hppa? amd64? ia64? x86obsd?"

This is interpreted with the current (deprecated) rules as:
Always mirror://kernel/linux/kernel/v2.6/linux-2.6.5.tar.bz2
If x86, ppc, ppc64 and sparc then mirror://gentoo/patches-2.6.5-sparc.tar.bz2
If mips, alpha, arm, hppa, amd64, ia64, x86obsd then ???

I'll fix my patch so that it actually reports the part of the dep string that causes the traceback.

Spanky, portage dying in a friendly manner (for this and other problems) should be fixed in a couple of months.
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 08:35:18 UTC
Created attachment 29030 [details, diff]
Non-nested use warning is always printed

As per my previous comment, the second non-nested use string will be printed
with a deprecation warning before raising the ValueError.
Comment 5 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 08:43:30 UTC
Created attachment 29031 [details, diff]
Bug fix

Was claiming valid dep strings were deprecated.
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 09:51:52 UTC
Created attachment 29033 [details, diff]
diff -u (same as previous)
Comment 7 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-10 10:53:19 UTC
Created attachment 29035 [details, diff]
another solution

Hi jstubbs,

I saw your patch. But I don't understand what you want to do..
I've think this problem is that empty parenthesis is gone.
I made a patch. can you look at it?
Comment 8 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 18:30:41 UTC
Created attachment 29055 [details, diff]
Fixed patch

Something went wrong when I recreated the patch and there was a line in there
that shouldn't have been.

I don't think your patch is the correct solution. It essentially adds an empty
list to the end of every dep list. This would prevent the traceback from
occurring, but would hide the fact that the dep string (SRC_URI in this case)
is broken.

Also, it doesn't address the problem that my patch does. Here is some output to
illustrate the problem:
>>> from portage_dep import *
>>> use_reduce(paren_reduce("abc? def? xyz"), [])
['xyz']
>>> use_reduce(paren_reduce("abc? def? xyz"), ["abc"])
Note: Nested use flags without parenthesis! (Deprecated)
      def? xyz
[]
>>> use_reduce(paren_reduce("abc? def? xyz"), ["def"])
['xyz']
>>> use_reduce(paren_reduce("abc? def? xyz"), ["abc","def"])
Note: Nested use flags without parenthesis! (Deprecated)
      def? xyz
['xyz']

And with my patch:
>>> from portage_dep import *
>>> use_reduce(paren_reduce("abc? def? xyz"), [])
Note: Nested use flags without parenthesis! (Deprecated)
      abc? def? xyz
[]
>>> use_reduce(paren_reduce("abc? def? xyz"), ["abc"])
Note: Nested use flags without parenthesis! (Deprecated)
      abc? def? xyz
[]
>>> use_reduce(paren_reduce("abc? def? xyz"), ["def"])
Note: Nested use flags without parenthesis! (Deprecated)
      abc? def? xyz
[]
>>> use_reduce(paren_reduce("abc? def? xyz"), ["abc","def"])
Note: Nested use flags without parenthesis! (Deprecated)
      abc? def? xyz
['xyz']
Comment 9 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-10 18:48:51 UTC
If there is "abc? def? xyz" in SRC_URI it's ebuild bug.

But development-sources(kernel-2.eclass) has "abc? ( ) def? ( ) xyz".
It's not ebuild bug. The ebuild is not broken.
Comment 10 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 19:25:17 UTC
Created attachment 29060 [details, diff]
Fix for mishandling of "use? ()"

I did notice the problem with "foo? () bar?" being reduced to ["foo?", "bar?"].
By comment about your solution, I meant that "foo? () bar?" is reduced to
["foo?", [], "bar?", []].
This patch will will reduce "foo? () bar?" to ["foo?", [], "bar?"].

The "Fixed patch" is still required to fix the other problem though.
Comment 11 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-10 19:38:43 UTC
OK. Your patch is better.

And what is comment #8 patch for?
It's just improving error handling?
Comment 12 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 20:02:11 UTC
As per comment #2 and examples in comment #8, the problem behaviour is that consecutive use flags are only checked if the first use condition matches as follows:

is element use flag?
  is use flag enabled?
    are there more use flags?
      accumulate use flags
    are all use flags enabled?
      add next element

giving:
use_reduce(["abc?","def?","xyz"],[]) == ["xyz"]
use_reduce(["abc?","def?","xyz"],["abc"]) == []
use_reduce(["abc?","def?","xyz"],["def"]) == ["xyz"]

The patch's behaviour is:

is element use flag?
  are there more use flags?
    accumulate use flags
  are all use flags enabled?
    add next element
Comment 13 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 21:09:34 UTC
Hmmm, my previous explanation was not entirely accurate. Look at it this way,

"use1? use2? use3? use4? atom"
If use1 is not set, use2 will be skipped and processing restarts at use3.
If use3 is not set, use4 will be skipped and processing restarts at atom.
If use1 or use3 is set, then the remaining elements are checked to see if they are conditions.
Thus "atom" is returned if USE equals "", "use3 use4" or "use1 use2 use3 use4".

My patch simply checks for extra use conditions before acting on the first one.
Comment 14 Brian Harring (RETIRED) gentoo-dev 2004-08-16 11:39:58 UTC
Fixed for a while...