diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-10-17 19:01:08 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2006-10-17 19:01:08 +0000 |
commit | 15230af45d228f8311beb6f5216620cbe794a0c9 (patch) | |
tree | cd076dd1b34416689de1e65934a7f94c59aa937b /scripts | |
parent | 2c5be9bc38a67b26aa3fe92218a80da9a732d102 (diff) |
add PROVIDES option, currently only used for menuconfig
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5194 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_deps.pl | 8 | ||||
-rwxr-xr-x | scripts/gen_menuconfig.pl | 28 |
2 files changed, 29 insertions, 7 deletions
diff --git a/scripts/gen_deps.pl b/scripts/gen_deps.pl index 745d31c7d..af206f004 100755 --- a/scripts/gen_deps.pl +++ b/scripts/gen_deps.pl @@ -34,6 +34,12 @@ while ($line = <>) { defined $pkg{$name} or $pkg{$name} = {}; $pkg{$name}->{src} = $src; }; + $line =~ /^Provides: \s*(.+)\s*$/ and do { + foreach my $vpkg (split /\s+/, $1) { + defined $pkg{$vpkg} or $pkg{$vpkg} = {}; + $pkg{$vpkg}->{virtual} = 1; + } + }; $line =~ /^Prereq-Check:/ and !defined $prereq{$src} and do { $pkg{$name}->{prereq} = 1; }; @@ -52,6 +58,7 @@ $line=""; foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) { my $config; + next if defined $pkg{$name}->{virtual}; if ($options{SDK}) { $conf{$pkg{$name}->{src}} or do { $config = 'm'; @@ -69,6 +76,7 @@ foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) { my $depline = ""; foreach my $dep (@{$pkg{$name}->{depends}}) { my $idx; + next if defined $pkg{$dep}->{virtual}; if (defined $pkg{$dep}->{src}) { ($pkg{$name}->{src} ne $pkg{$dep}->{src}) and $idx = $pkg{$dep}->{src}; } elsif (defined($pkg{$dep}) && !$options{SDK}) { diff --git a/scripts/gen_menuconfig.pl b/scripts/gen_menuconfig.pl index fe0dc2763..2a2511212 100755 --- a/scripts/gen_menuconfig.pl +++ b/scripts/gen_menuconfig.pl @@ -30,9 +30,10 @@ sub close_submenu { sub find_dep($$) { my $pkg = shift; my $name = shift; - - return 0 unless defined $pkg->{depends}; - foreach my $dep (@{$pkg->{depends}}) { + my $deps = ($pkg->{vdepends} or $pkg->{depends}); + + return 0 unless defined $deps; + foreach my $dep (@{$deps}) { return 1 if $dep eq $name; return 1 if ($package{$dep} and (find_dep($package{$dep},$name) == 1)); } @@ -43,13 +44,13 @@ sub depends($$) { my $a = shift; my $b = shift; my $ret; - + if (find_dep($a, $b->{name}) == 1) { $ret = 1; } elsif (find_dep($b, $a->{name}) == 1) { $ret = -1; } else { - $ret = 0; + return 0; } # print STDERR "depends($a->{name}, $b->{name}) == $ret\n"; return $ret; @@ -93,8 +94,14 @@ sub print_category($) { my $m = "depends"; $depend =~ s/^([@\+]+)//; my $flags = $1; - $flags =~ /@/ or $depend = "PACKAGE_$depend"; - $flags =~ /\+/ and $m = "select"; + my $vdep; + + if ($vdep = $package{$depend}->{vdepends}) { + $depend = join("||", map { "PACKAGE_".$_ } @$vdep); + } else { + $flags =~ /@/ or $depend = "PACKAGE_$depend"; + $flags =~ /\+/ and $m = "select"; + } print "\t\t$m $depend\n"; } print "\t\thelp\n"; @@ -132,6 +139,13 @@ while ($line = <>) { $line =~ /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1; $line =~ /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1; $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; + $line =~ /^Provides: \s*(.+)\s*$/ and do { + my @vpkg = split /\s+/, $1; + foreach my $vpkg (@vpkg) { + $package{$vpkg} or $package{$vpkg} = { vdepends => [] }; + push @{$package{$vpkg}->{vdepends}}, $pkg->{name}; + } + }; $line =~ /^Depends: \s*(.+)\s*$/ and do { my @dep = split /\s+/, $1; $pkg->{depends} = \@dep; |