Skip to content

Commit 4a3348e

Browse files
committed
metadata.pl: add support for selecting packages available only via PROVIDES
Signed-off-by: Felix Fietkau <[email protected]>
1 parent 91f205a commit 4a3348e

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

scripts/metadata.pl

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -457,28 +457,38 @@ sub mconf_depends {
457457
$depend = $2;
458458
}
459459
next if $package{$depend} and $package{$depend}->{buildonly};
460-
if ($vdep = $package{$depend}->{vdepends}) {
461-
$depend = join("||", map { "PACKAGE_".$_ } @$vdep);
462-
} else {
463-
$flags =~ /\+/ and do {
464-
# Menuconfig will not treat 'select FOO' as a real dependency
465-
# thus if FOO depends on other config options, these dependencies
466-
# will not be checked. To fix this, we simply emit all of FOO's
467-
# depends here as well.
468-
$package{$depend} and push @t_depends, [ $package{$depend}->{depends}, $condition ];
469-
470-
$m = "select";
471-
next if $only_dep;
472-
};
473-
$flags =~ /@/ or $depend = "PACKAGE_$depend";
474-
if ($condition) {
475-
if ($m =~ /select/) {
476-
next if $depend eq $condition;
477-
$depend = "$depend if $condition";
478-
} else {
479-
$depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select';
460+
if ($flags =~ /\+/) {
461+
if ($vdep = $package{$depend}->{vdepends}) {
462+
my @vdeps = @$vdep;
463+
$depend = shift @vdeps;
464+
if (@vdeps > 1) {
465+
$condition = '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
466+
} elsif (@vdeps > 0) {
467+
$condition = '!PACKAGE_'.$vdeps[0];
480468
}
481469
}
470+
471+
# Menuconfig will not treat 'select FOO' as a real dependency
472+
# thus if FOO depends on other config options, these dependencies
473+
# will not be checked. To fix this, we simply emit all of FOO's
474+
# depends here as well.
475+
$package{$depend} and push @t_depends, [ $package{$depend}->{depends}, $condition ];
476+
477+
$m = "select";
478+
next if $only_dep;
479+
} else {
480+
if ($vdep = $package{$depend}->{vdepends}) {
481+
$depend = join("||", map { "PACKAGE_".$_ } @$vdep);
482+
}
483+
}
484+
$flags =~ /@/ or $depend = "PACKAGE_$depend";
485+
if ($condition) {
486+
if ($m =~ /select/) {
487+
next if $depend eq $condition;
488+
$depend = "$depend if $condition";
489+
} else {
490+
$depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select';
491+
}
482492
}
483493
$dep->{$depend} =~ /select/ or $dep->{$depend} = $m;
484494
}

0 commit comments

Comments
 (0)