|
|
# $Header: /var/cvsroot/gentoo-src/ufed/ufed.pl,v 1.19 2004/06/03 04:58:49 fava Exp $ |
# $Header: /home/cvsroot/gentoo-src/ufed/ufed.pl,v 1.18 2003/08/11 04:44:03 fava Exp $ |
|
|
open(FILE, '/etc/make.profile/use.defaults') or die ('couldn\'t open ' . "use.defaults"); |
my $tmppath; |
|
my @tmpitem; |
|
my @items; |
|
my $path; |
|
#open(FILE, '/etc/make.profile/use.defaults') or die ('couldn\'t open ' . "use.defaults"); |
|
$path = readlink '/etc/make.profile'; |
|
$path =~ s!\.\.!!; |
|
@items = split /\//, $path ; |
|
while(@items) |
|
{ |
|
$tmppath = join '/', @items ; |
|
if (open(FILE1,$tmppath . "/use.defaults")) |
|
{ |
|
while (<FILE1>) |
|
{ |
|
s!#.*!!; |
|
($flag, $package) = split (m![\t ]+!); |
|
$flag =~ s![ \t]!!g; |
|
$package =~ s![ \t]!!g; |
|
chomp($package); |
|
|
while (<FILE>) |
if ((defined($package)) and my_glob("/var/db/pkg/$package")) |
{ |
{ |
s!#.*!!; |
#the package exists, therefore we add the use flag |
($flag, $package) = split (m![\t ]+!); |
push (@flags, $flag); |
$flag =~ s![ \t]!!g; |
} |
$package =~ s![ \t]!!g; |
} |
chomp($package); |
close(FILE1); |
|
} |
|
|
if ((defined($package)) and my_glob("/var/db/pkg/$package")) |
open (FILE,$tmppath . '/parent') or last; |
|
while (<FILE>) |
|
|
|
s!#.*!!; |
#the package exists, therefore we add the use flag |
s!\n!!g; |
push (@flags, $flag); |
@tmpitem = split /\//, $_; |
|
for my $buf (@tmpitem) |
|
{ |
|
if ($buf =~ /\.\./) |
|
{ |
|
pop @items; |
|
} |
|
else |
|
{ |
|
push @items, $buf; |
|
} |
|
} |
|
|
|
close(FILE); |
|
|
close(FILE); |
|