summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2016-11-02 01:45:06 +0100
committerJo-Philipp Wich <jo@mein.io>2016-11-02 02:02:44 +0100
commit12d15fa8a5096913927d75958d0ed3af9d963e73 (patch)
tree9f5cf42eb72990d507d3d216e450fd246d2ead45
parent5e0441aaf0531e18222093e4084f4795fcba2343 (diff)
downloadmtk-20170518-12d15fa8a5096913927d75958d0ed3af9d963e73.zip
mtk-20170518-12d15fa8a5096913927d75958d0ed3af9d963e73.tar.gz
mtk-20170518-12d15fa8a5096913927d75958d0ed3af9d963e73.tar.bz2
scripts/package-metadata.pl: honour DEFAULT_VARIANT
So far, package-metadata.pl always considered the first provider of a virtual package to be the default variant which might deviate from what buildroot considers to be the default. Change the Kconfig dependency / select code generation for virtual package providers to consider the DEFAULT_VARIANT to be the primary provider and only fall back to the first provider if no default variant was explicitely tagged. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rwxr-xr-xscripts/package-metadata.pl17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 1a4f103..f8f16f0 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -176,8 +176,21 @@ sub mconf_depends {
next if $package{$depend} and $package{$depend}->{buildonly};
if ($flags =~ /\+/) {
if ($vdep = $package{$depend}->{vdepends}) {
- my @vdeps = @$vdep;
- $depend = shift @vdeps;
+ my @vdeps;
+ $depend = undef;
+
+ foreach my $v (@$vdep) {
+ if ($package{$v} && $package{$v}->{variant_default}) {
+ $depend = $v;
+ } else {
+ push @vdeps, $v;
+ }
+ }
+
+ if (!$depend) {
+ $depend = shift @vdeps;
+ }
+
if (@vdeps > 1) {
$condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
} elsif (@vdeps > 0) {