|
|
| |
# Copyright 1999-2003 Gentoo Technologies, Inc. | # Copyright 1999-2003 Gentoo Technologies, Inc. |
# Distributed under the terms of the GNU General Public License v2 | # Distributed under the terms of the GNU General Public License v2 |
# $Header: /home/cvsroot/gentoo-src/ufed/ufed.pl,v 1.18 2003/08/11 04:44:03 fava Exp $ |
# $Header: /var/cvsroot/gentoo-src/ufed/ufed.pl,v 1.19 2004/06/03 04:58:49 fava Exp $ |
| |
# If you make ANY changes, please put them directly to the CVS log. The | # If you make ANY changes, please put them directly to the CVS log. The |
# ChangeLog file is generated automatically from that data. | # ChangeLog file is generated automatically from that data. |
|
|
# the associated flag is emabled | # the associated flag is emabled |
my ($flag, $package); | my ($flag, $package); |
my @flags; | my @flags; |
my $tmppath; |
open(FILE, '/etc/make.profile/use.defaults') or die ('couldn\'t open ' . "use.defaults"); |
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); |
|
| |
if ((defined($package)) and my_glob("/var/db/pkg/$package")) |
while (<FILE>) |
{ |
{ |
#the package exists, therefore we add the use flag |
s!#.*!!; |
push (@flags, $flag); |
($flag, $package) = split (m![\t ]+!); |
} |
$flag =~ s![ \t]!!g; |
} |
$package =~ s![ \t]!!g; |
close(FILE1); |
chomp($package); |
} |
|
| |
open (FILE,$tmppath . '/parent') or last; |
if ((defined($package)) and my_glob("/var/db/pkg/$package")) |
while (<FILE>) |
|
{ | { |
s!#.*!!; |
|
s!\n!!g; |
#the package exists, therefore we add the use flag |
@tmpitem = split /\//, $_; |
push (@flags, $flag); |
for my $buf (@tmpitem) |
|
{ |
|
if ($buf =~ /\.\./) |
|
{ |
|
pop @items; |
|
} |
|
else |
|
{ |
|
push @items, $buf; |
|
} |
|
} |
|
} | } |
close(FILE); |
|
} | } |
|
close(FILE); |
return (@flags); | return (@flags); |
} | } |
| |