Bartosch Pixa wrote:
On Mon, 2003-10-27 at 08:32, Andrew Gaffney wrote:

In an effort to better understand the way that Portage works, I'm trying to write a perl program that can generate a dependency tree like emerge does. Since I'm using Perl and not Python, I can't use the Portage API. Here is my code so far:


you could try to use the portage API with the help of this:

http://search.cpan.org/~gaas/pyperl-1.0/Python-Object/lib/Python.pm

I think I'll just stick with what I know. For now, I'm just doing 'emerge info | grep USE' to get a complete list of USE flags. As for the DEPEND line, I'm using a regex to extract each item, although its not going too well.


[code]
while($deplist =~ /((\w+\?)?) (\(?) (\S+) (\)?)/cg) {
  print "$2 - $4\n";
}
[/code]

which is supposed to pull apart a string like:

nls? ( sys-devel/gettext ) media-sound/cdparanoia gif? ( media-libs/giflib media-libs/libungif )

and pull out each 'key? ( value )', 'key? ( value value )', or just 'value' where its alone. Anyone have any idea where I'm going wrong?

--
Andrew Gaffney


-- [EMAIL PROTECTED] mailing list



Reply via email to