1 |
Bartosch Pixa wrote: |
2 |
> On Mon, 2003-10-27 at 08:32, Andrew Gaffney wrote: |
3 |
> |
4 |
>>In an effort to better understand the way that Portage works, I'm trying to write a perl |
5 |
>>program that can generate a dependency tree like emerge does. Since I'm using Perl and not |
6 |
>>Python, I can't use the Portage API. Here is my code so far: |
7 |
> |
8 |
> |
9 |
> you could try to use the portage API with the help of this: |
10 |
> |
11 |
> http://search.cpan.org/~gaas/pyperl-1.0/Python-Object/lib/Python.pm |
12 |
|
13 |
I think I'll just stick with what I know. For now, I'm just doing 'emerge info | grep USE' |
14 |
to get a complete list of USE flags. As for the DEPEND line, I'm using a regex to extract |
15 |
each item, although its not going too well. |
16 |
|
17 |
[code] |
18 |
while($deplist =~ /((\w+\?)?) (\(?) (\S+) (\)?)/cg) { |
19 |
print "$2 - $4\n"; |
20 |
} |
21 |
[/code] |
22 |
|
23 |
which is supposed to pull apart a string like: |
24 |
|
25 |
nls? ( sys-devel/gettext ) media-sound/cdparanoia gif? ( media-libs/giflib |
26 |
media-libs/libungif ) |
27 |
|
28 |
and pull out each 'key? ( value )', 'key? ( value value )', or just 'value' where its |
29 |
alone. Anyone have any idea where I'm going wrong? |
30 |
|
31 |
-- |
32 |
Andrew Gaffney |
33 |
|
34 |
|
35 |
-- |
36 |
gentoo-dev@g.o mailing list |