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:

[code]
#!/usr/bin/perl -w

my $dbpath = '/usr/portage';
my $pkgregex =
    '^(.+?)'.                                   # name
    '-(\d+(?:\.\d+)*\w*)'.                      # version, eg 1.23.4a
    '((?:(?:_alpha|_beta|_pre|_rc)\d*)?)'.      # special suffix
    '((?:-r\d+)?)$';                            # revision, eg r12

my $pkg = shift;

$depend = `source ${dbpath}/${pkg}; echo \${DEPEND}; echo \${RDEPEND}`;
print $depend;

$useflags = `source /etc/make.conf; echo \${USE}`;
print $useflags;
[/code]

This gets me a nice list of the packages that the ebuild depends on. As for the USE flags, I only get the ones defined in /etc/make.conf, not the full set. Is there an easy way to do this?

--
Andrew Gaffney


-- [EMAIL PROTECTED] mailing list



Reply via email to