Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 436152 - equery u: incorrect parse digits+#
Summary: equery u: incorrect parse digits+#
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-25 02:32 UTC by megabaks
Modified: 2012-09-25 06:58 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description megabaks 2012-09-25 02:32:24 UTC
if USE have digit at end of name, then '#' works as switch
example:
media-libs/libvpx have use sse4_1
===============
package.use:
media-libs/libvpx sse4_1#
======
equery -NCq u "media-libs/libvpx":
....
-sse4_1
=======
package.use:
media-libs/libvpx sse4_1 #
======
equery -NCq u "media-libs/libvpx"
....
+sse4_1
===============
app-portage/gentoolkit-0.3.0.6-r3

Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2012-09-25 03:12:08 UTC
Portage requires a space before # in order for it to be treated as a comment. I believe this is how most things that support # comments work. The portage code is visible in this commit:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3ad5122a80f741119b48cb7f0f5107e64e2e3b11
Comment 2 megabaks 2012-09-25 04:03:50 UTC
(In reply to comment #1)
> Portage requires a space before # in order for it to be treated as a
> comment. I believe this is how most things that support # comments work. The
> portage code is visible in this commit:
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;
> h=3ad5122a80f741119b48cb7f0f5107e64e2e3b11

ok.
but this isn't good idea anyway
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2012-09-25 04:17:44 UTC
Portage does not support the comment character immediately after a value without a space.  See the example below.  One of the primary reasons for it is that the lines are split into individual values at the space breaks.  Equery uses portage to get the values to display.

So:
media-libs/libvpx sse4_1# some-comment

is broken up into:

['media-libs/libvpx', 'sse4_1#', 'some-comment']

however if you put a space before '#' then it and anything after the '#' will be trimmed.

['media-libs/libvpx', 'sse4_1', '#', 'some-comment']

yields: ['media-libs/libvpx', 'sse4_1']


actual test example:

big_daddy brian # emerge -vp libvpx
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] media-libs/libvpx-1.1.0  USE="mmx sse sse2 sse3 threads (-altivec) -debug -doc -postproc -sse4_1 -ssse3 -static-libs" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

big_daddy brian # cat /etc/portage/package.use/test | grep libvpx
media-libs/libvpx sse4_1#
big_daddy brian # scite /etc/portage/package.use/test
big_daddy brian # emerge -vp libvpx
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] media-libs/libvpx-1.1.0  USE="mmx sse sse2 sse3 sse4_1* threads (-altivec) -debug -doc -postproc -ssse3 -static-libs" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

big_daddy brian # cat /etc/portage/package.use/test | grep libvpx
media-libs/libvpx sse4_1 # some-comment
big_daddy brian #
Comment 4 megabaks 2012-09-25 05:09:39 UTC
(In reply to comment #3)
> Portage does not support the comment character immediately after a value
> without a space.
o_O what?
example:
x11-libs/qt-webkit exceptions icu jit#ololo
no digits - no troubles
may be just fix it for more flexibility!?
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2012-09-25 06:58:32 UTC
Nope, still doesn't work.

eg:

big_daddy brian # emerge -vp libvpx
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] media-libs/libvpx-1.1.0  USE="mmx sse sse2 sse3 sse4_1* threads (-altivec) -debug -doc -postproc -ssse3 -static-libs" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

big_daddy brian # cat /etc/portage/package.use/test | grep libvpx
media-libs/libvpx sse4_1 -mmx# some-comment
big_daddy brian # 


Here is some of the code Zac gave you the link to.

               myline=x.split()
               mylinetemp = []
               for item in myline:
                       if not item.startswith('#'):
                               mylinetemp.append(item)
                       else:
                               break
               myline = mylinetemp


NOTE the line ==>  if not item.startswith('#'):

The keyword there is startswith

So in the test I did above, the -mmx flag is read as -mmx# and translates to disable the mmx# flag which does not match a flag in IUSE for the ebuild.  Portage then ignores it.  The "some-comment" is also read as a flag since it did not find the '#' as the first character of any of the items on the line.

media-libs/libvpx sse4_1 -mmx #some-comment  <== this will work correctly since '#' is the first character of '#some-comment'

So, again, no, it is and will remain invalid.