add support for bsd md5 as a md5sum replacement
[openwrt-10.03/.git] / scripts / gen_deps.pl
index 04998715d41d6b97f43d82e819d6e0f52e03967e..e7daf18866be50384a5b8cbf516eabdf3d627349 100755 (executable)
@@ -1,4 +1,11 @@
 #!/usr/bin/perl
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
 use strict;
 
 my $name;
@@ -6,6 +13,8 @@ my $src;
 my $makefile;
 my %conf;
 my %pkg;
+my %prereq;
+my $prereq;
 my %dep;
 my %options;
 my $opt;
@@ -26,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) {
@@ -55,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";
@@ -67,5 +81,5 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) {
 }
 
 if ($line ne "") {
-       print "\n$line";
+       print "\n$line\n$prereq";
 }