1 |
In an effort to better understand the way that Portage works, I'm trying to write a perl |
2 |
program that can generate a dependency tree like emerge does. Since I'm using Perl and not |
3 |
Python, I can't use the Portage API. Here is my code so far: |
4 |
|
5 |
[code] |
6 |
#!/usr/bin/perl -w |
7 |
|
8 |
my $dbpath = '/usr/portage'; |
9 |
my $pkgregex = |
10 |
'^(.+?)'. # name |
11 |
'-(\d+(?:\.\d+)*\w*)'. # version, eg 1.23.4a |
12 |
'((?:(?:_alpha|_beta|_pre|_rc)\d*)?)'. # special suffix |
13 |
'((?:-r\d+)?)$'; # revision, eg r12 |
14 |
|
15 |
my $pkg = shift; |
16 |
|
17 |
$depend = `source ${dbpath}/${pkg}; echo \${DEPEND}; echo \${RDEPEND}`; |
18 |
print $depend; |
19 |
|
20 |
$useflags = `source /etc/make.conf; echo \${USE}`; |
21 |
print $useflags; |
22 |
[/code] |
23 |
|
24 |
This gets me a nice list of the packages that the ebuild depends on. As for the USE flags, |
25 |
I only get the ones defined in /etc/make.conf, not the full set. Is there an easy way to |
26 |
do this? |
27 |
|
28 |
-- |
29 |
Andrew Gaffney |
30 |
|
31 |
|
32 |
-- |
33 |
gentoo-dev@g.o mailing list |