summaryrefslogtreecommitdiff
path: root/openwrt/scripts/gen_deps.pl
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-05-30 18:55:52 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-05-30 18:55:52 +0000
commit5b05f4a5ee5fa1dd3246350b6672d05a1aaa7f4d (patch)
treeb9f40012c0fbad8c3123e42d0ec5439224a0f6fd /openwrt/scripts/gen_deps.pl
parent10152c5c0752e6e514999056142dacbc8de71d95 (diff)
downloadmtk-20170518-5b05f4a5ee5fa1dd3246350b6672d05a1aaa7f4d.zip
mtk-20170518-5b05f4a5ee5fa1dd3246350b6672d05a1aaa7f4d.tar.gz
mtk-20170518-5b05f4a5ee5fa1dd3246350b6672d05a1aaa7f4d.tar.bz2
improve dependency handling, fix some package makefile bugs
SVN-Revision: 3843
Diffstat (limited to 'openwrt/scripts/gen_deps.pl')
-rwxr-xr-xopenwrt/scripts/gen_deps.pl19
1 files changed, 16 insertions, 3 deletions
diff --git a/openwrt/scripts/gen_deps.pl b/openwrt/scripts/gen_deps.pl
index 40153bd..d75f06d 100755
--- a/openwrt/scripts/gen_deps.pl
+++ b/openwrt/scripts/gen_deps.pl
@@ -5,6 +5,7 @@ my $name;
my $src;
my $makefile;
my %pkg;
+my %dep;
my $line;
while ($line = <>) {
@@ -19,8 +20,12 @@ while ($line = <>) {
$pkg{$name}->{src} = $src;
};
$line =~ /^(Build-)?Depends: \s*(.+)\s*$/ and do {
- my @dep = split /,\s*/, $2;
- $pkg{$name}->{depends} = \@dep;
+ $pkg{$name}->{depends} ||= [];
+ foreach my $v (split /\s+/, $2) {
+ next if $v =~ /^@/;
+ $v =~ s/^\+//;
+ push @{$pkg{$name}->{depends}}, $v;
+ }
};
}
@@ -32,8 +37,16 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) {
my $hasdeps = 0;
my $depline = "";
foreach my $dep (@{$pkg{$name}->{depends}}) {
+ my $idx;
if (defined $pkg{$dep}->{src} && $pkg{$name}->{src} ne $pkg{$dep}->{src}) {
- $depline .= " $pkg{$dep}->{src}-compile";
+ $idx = $pkg{$dep}->{src};
+ } elsif (defined $pkg{$dep}) {
+ $idx = $dep;
+ }
+ if ($idx) {
+ next if $dep{$pkg{$name}->{src}."->".$idx};
+ $depline .= " $idx\-compile";
+ $dep{$pkg{$name}->{src}."->".$idx} = 1;
}
}
if ($depline ne "") {