|
|
@ -24,8 +24,6 @@ my %depends; |
|
|
|
close AVAIL; |
|
|
|
} |
|
|
|
|
|
|
|
use Cwd; |
|
|
|
my $topdir=getcwd; |
|
|
|
use File::Find; |
|
|
|
find(\&processfile, $dir); |
|
|
|
|
|
|
@ -46,27 +44,23 @@ sub processfile { |
|
|
|
|
|
|
|
push @lines, $_ unless $skipping == 1; |
|
|
|
|
|
|
|
if (/^#\s*include\s+([-a-z0-9]+)\s*$/) { |
|
|
|
if (/^#\s*include\s+(\w+)/) { |
|
|
|
my $pkg=$1; |
|
|
|
if ($skipping) { |
|
|
|
die "$file: nested includes near $_\n"; |
|
|
|
} |
|
|
|
if (-e $pkg) { |
|
|
|
push @lines, "# Automatically added by doincludes.pl; do not edit.\n"; |
|
|
|
push @lines, map { chomp; " $_\n" } |
|
|
|
`$topdir/listpackages.pl $pkg`; |
|
|
|
} |
|
|
|
elsif (! exists $depends{$pkg}) { |
|
|
|
warn "$file: #include $dir/$pkg skipped; no such package. Leaving what was there alone.\n"; |
|
|
|
if (! exists $depends{$pkg}) { |
|
|
|
warn "$file: #include $1 skipped; no such package. Leaving what was there alone.\n"; |
|
|
|
$skipping=-1; |
|
|
|
} |
|
|
|
else { |
|
|
|
push @lines, "# Automatically added by doincludes.pl; do not edit.\n"; |
|
|
|
push @lines, "#Automatically added by doincludes.pl; do not edit.\n"; |
|
|
|
# Split deps and remove alternates and versioned |
|
|
|
# deps. Include the metapackage on the list. |
|
|
|
push @lines, map { s/[|(].*//; " $_\n" } |
|
|
|
split(/,\s+/, $depends{$pkg}), $pkg; |
|
|
|
$skipping=1; |
|
|
|
} |
|
|
|
$skipping=1; |
|
|
|
} |
|
|
|
} |
|
|
|
close IN; |
|
|
|