Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 26836 - euse from gentoolkit-0.1.30 parses make.conf wrongly
Summary: euse from gentoolkit-0.1.30 parses make.conf wrongly
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-17 19:44 UTC by Georgi Georgiev
Modified: 2005-04-23 09:55 UTC (History)
4 users (show)

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


Attachments
euse.patch (euse.patch,602 bytes, patch)
2003-08-17 19:49 UTC, Georgi Georgiev
Details | Diff
euse.patch (euse.patch,713 bytes, patch)
2003-08-18 20:40 UTC, Georgi Georgiev
Details | Diff
patch for euse based on perl parsing (euse.diff,760 bytes, patch)
2004-03-05 14:57 UTC, Joerg Schaible
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Georgi Georgiev 2003-08-17 19:44:50 UTC
On my system I have all my use flags split over a few lines. The syntax I use is
like this:

USE="flag1 flag2 flag3 flag4.... "
USE="${USE} flagN flagN+1 flagN+2"

and so on. However, running euse -c only shows the first line. Wouldn't it be
better if the parse_make function instead of manually parsing make.conf, simply
did something like:

my $use_var = `. /etc/make.conf; echo -n \$USE`;

$use_var =~ s/\s+/ /gs;
# the above would also catch the case when there are consecutive
# spaces
@site_uf_list = split(' ', $use_var);

The currently used regexp

$lines =~ m/^\s*USE[\s\n]*=[\s\n]*"([^"]*)"/ms

heavily depends on a predefined syntax, and this syntax may not be the syntax
everyone uses. What if I am not using quotes, but simply prefer to escape the
spaces using a backslash? USE=flag1\ flag2\ flag3....
Comment 1 SpanKY gentoo-dev 2003-08-17 19:47:10 UTC
umm best solution would actually be to run `portageq envvar USE` 
Comment 2 Georgi Georgiev 2003-08-17 19:49:17 UTC
Created attachment 16246 [details, diff]
euse.patch

Make parse_make use the shell for parsing a file, thus correctly parsing in all
situations.

Remove the whitespace substition regexp as it is not needed. Change the split
to split on multiple whitespace instead: split (/\s+/...)
Comment 3 Georgi Georgiev 2003-08-17 19:51:50 UTC
Oh... that was fast.
Comment 4 SpanKY gentoo-dev 2003-08-18 18:01:47 UTC
i'm not a perl master by any means (i learned enough to patch stuff and understand it), so could you create a patch for what i suggested ?
Comment 5 Georgi Georgiev 2003-08-18 20:39:00 UTC
portageq only reports USE flags in use, while euse has the options:

    -c, --conf     - print USE flag setting in make.conf
    -d, --defaults - print USE flag setting in make.defaults
    -e, --env      - print USE flag setting in environment variable USE

Therefore, parse_make has to be able to parse a specific file only.

I had no idea that /etc/make.conf did not have to have a /bin/sh compatible syntax, which is why I proposed what I did propose.

I agree it is better to use the official portage interface though.
Comment 6 Georgi Georgiev 2003-08-18 20:40:25 UTC
Created attachment 16295 [details, diff]
euse.patch

Makes euse use the getconfig parser from portage.
Comment 7 Markus Nigbur (RETIRED) gentoo-dev 2003-11-19 06:34:54 UTC
Your territory ;)
Comment 8 Georgi Georgiev 2003-12-17 21:27:26 UTC
Any progress on this one? It's been a few months already....
Comment 9 Joerg Schaible 2004-03-05 14:57:08 UTC
Created attachment 26917 [details, diff]
patch for euse based on perl parsing

Supports following formats:

USE="3dnow"
USE="$USE X"
USE="${USE} Xaw3d"
Comment 10 Georgi Georgiev 2004-03-05 17:50:34 UTC
I dare object to the last patch (Attachment #26917 [details, diff]). If I read it correctly, given the input:

USE=3dnow
USE=sse

it would count both 3dnow and sse as use flags. And it shouldn't.

I still believe, the best way is to use the portage interface, considering that portage 2.0.50 is already out and it supports per-package use flags via /etc/portage/package.use (and etcat produces proper output).

In fact, I am not sure if this bug is still relevant.
Comment 11 Georgi Georgiev 2004-03-05 17:51:23 UTC
The last comment should have read attachment #26917 [details, diff]
This one should link now.
Comment 12 Joerg Schaible 2004-03-06 01:25:44 UTC
Ups. You're right.
But concerning the usage it depends. I am used to take euse to keep track of all available flags:

euse -i > euse.lst

and some time later

euse -i | diff -ub euse.lst - | less

So I see very easily any new, removed or changed flag. I don't know any other utility in gentoolkit, that can list all available flags. Therefore I need a working version.
Comment 13 Maurice van der Pot (RETIRED) gentoo-dev 2005-04-22 14:27:02 UTC
Is this problem still present in the latest gentoolkit?
Comment 14 Georgi Georgiev 2005-04-22 20:06:45 UTC
The problem doesn't seem to be relevant. euse doesn't have the "-c" option anymore.
Comment 15 Marius Mauch (RETIRED) gentoo-dev 2005-04-23 03:05:10 UTC
old
Comment 16 Joerg Schaible 2005-04-23 08:59:21 UTC
Just because its old, it's not solved! euse -i is still the only possibility to follow changes in flags. The attached patch is still valid for the KEYWORD syntax in the description. It's just worse now, since euse currently does not work at all (75525)!

Comment 17 Marius Mauch (RETIRED) gentoo-dev 2005-04-23 09:36:41 UTC
And how is that related to this bug? euse has been rewritten completely and this issue shouldn't be present anymore (see comment 14)
Comment 18 Joerg Schaible 2005-04-23 09:55:39 UTC
I'm sorry, you're right. I didn't check the current implementation and used my own old and patched version in /usr/local/bin. Your impl of get_useflags() should really solve this issue.