real fix for download.pl
[openwrt-10.03/.git] / scripts / gen_deps.pl
index 0cdcc97a14789f6f3cf215ca4e0b8fd24bb4ed3b..e7daf18866be50384a5b8cbf516eabdf3d627349 100755 (executable)
@@ -13,6 +13,8 @@ my $src;
 my $makefile;
 my %conf;
 my %pkg;
+my %prereq;
+my $prereq;
 my %dep;
 my %options;
 my $opt;
@@ -33,6 +35,10 @@ while ($line = <>) {
                defined $pkg{$name} or $pkg{$name} = {};
                $pkg{$name}->{src} = $src;
        };
+       $line =~ /^Prereq-Check:/ and !defined $prereq{$src} and do {
+               $prereq{$src} = 1;
+               $prereq .= "package-prereq += $src\n";
+       };
        $line =~ /^(Build-)?Depends: \s*(.+)\s*$/ and do {
                $pkg{$name}->{depends} ||= [];
                foreach my $v (split /\s+/, $2) {
@@ -62,6 +68,7 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) {
                } elsif (defined($pkg{$dep}) && !$options{SDK}) {
                        $idx = $dep;
                }
+               undef $idx if $idx =~ /^(kernel)|(base-files)$/;
                if ($idx) {
                        next if $dep{$pkg{$name}->{src}."->".$idx};
                        $depline .= " $idx\-compile";
@@ -74,5 +81,5 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) {
 }
 
 if ($line ne "") {
-       print "\n$line";
+       print "\n$line\n$prereq";
 }