sub get_depend {
my $ebuildfname = shift;
my $ebuildcontents;
my %ebuildvars;
my $pkgname = $ebuildfname; $pkgname =~ s|/usr/portage/||;
$pkgname =~ s|(.+)/.+/(.+).ebuild|$1/$2|;
my $pkg = parse_package_name($pkgname);
$pkg->{version} =~ s/^-//;
$ebuildvars{PV} = "$pkg->{version}"; open EBUILD, "< $ebuildfname" or die "Couldn't open '$ebuildfname'\n";
while(<EBUILD>) {
$ebuildcontents .= $_;
}
close EBUILD; while($ebuildcontents =~ /\b([-A-Z0-9_]+)=\"(.*?)\"{1}?/sgc) {
$ebuildvars{$1} = $2;
}
foreach(keys %ebuildvars) {
$ebuildvars{$_} =~ s/\$\{?([-A-Z0-9_]+)\}?/$ebuildvars{$1}/gs;
} my $depend = $ebuildvars{'DEPEND'} || '';
$depend =~ s/(\s+|\n+)/ /gs;return $depend; }
This works to do one-pass interpolation, but it doesn't get all the variables (for example: VAR1="something $VAR2" VAR2="test $VAR3" VAR3="anything $VAR4" would give me VAR1="something test $VAR3" VAR2="test $VAR3" VAR3="anything $VAR4"). How can I make this work without actually calling bash?
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
