diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-05-09 14:48:49 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-05-09 14:48:49 +0200 |
commit | 4a3348ef09d7c882ae3c99f7384689a57c2c6074 (patch) | |
tree | 7bf6e1847593ff809aed60bef7a80f3a112d7ed9 /scripts/metadata.pl | |
parent | 91f205acaf2a44ae75418d2f2cb156149f0df8ae (diff) | |
download | mtk-20170518-4a3348ef09d7c882ae3c99f7384689a57c2c6074.zip mtk-20170518-4a3348ef09d7c882ae3c99f7384689a57c2c6074.tar.gz mtk-20170518-4a3348ef09d7c882ae3c99f7384689a57c2c6074.tar.bz2 |
metadata.pl: add support for selecting packages available only via PROVIDES
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'scripts/metadata.pl')
-rwxr-xr-x | scripts/metadata.pl | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 5695bda..410fa9f 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -457,28 +457,38 @@ sub mconf_depends { $depend = $2; } next if $package{$depend} and $package{$depend}->{buildonly}; - if ($vdep = $package{$depend}->{vdepends}) { - $depend = join("||", map { "PACKAGE_".$_ } @$vdep); - } else { - $flags =~ /\+/ and do { - # Menuconfig will not treat 'select FOO' as a real dependency - # thus if FOO depends on other config options, these dependencies - # will not be checked. To fix this, we simply emit all of FOO's - # depends here as well. - $package{$depend} and push @t_depends, [ $package{$depend}->{depends}, $condition ]; - - $m = "select"; - next if $only_dep; - }; - $flags =~ /@/ or $depend = "PACKAGE_$depend"; - if ($condition) { - if ($m =~ /select/) { - next if $depend eq $condition; - $depend = "$depend if $condition"; - } else { - $depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select'; + if ($flags =~ /\+/) { + if ($vdep = $package{$depend}->{vdepends}) { + my @vdeps = @$vdep; + $depend = shift @vdeps; + if (@vdeps > 1) { + $condition = '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')'; + } elsif (@vdeps > 0) { + $condition = '!PACKAGE_'.$vdeps[0]; } } + + # Menuconfig will not treat 'select FOO' as a real dependency + # thus if FOO depends on other config options, these dependencies + # will not be checked. To fix this, we simply emit all of FOO's + # depends here as well. + $package{$depend} and push @t_depends, [ $package{$depend}->{depends}, $condition ]; + + $m = "select"; + next if $only_dep; + } else { + if ($vdep = $package{$depend}->{vdepends}) { + $depend = join("||", map { "PACKAGE_".$_ } @$vdep); + } + } + $flags =~ /@/ or $depend = "PACKAGE_$depend"; + if ($condition) { + if ($m =~ /select/) { + next if $depend eq $condition; + $depend = "$depend if $condition"; + } else { + $depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select'; + } } $dep->{$depend} =~ /select/ or $dep->{$depend} = $m; } |