flex: update to 2.6.4 (FS#809)
[openwrt/openwrt.git] / scripts / package-metadata.pl
index 92c989d3a292416e548cd3e306471ecb29f3da5e..2da32c770ef3333bfcc18922ede556f9734510c7 100755 (executable)
@@ -176,12 +176,25 @@ 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 = '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
+                                       $condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
                                } elsif (@vdeps > 0) {
-                                       $condition = '!PACKAGE_'.$vdeps[0];
+                                       $condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0];
                                }
                        }
 
@@ -193,17 +206,22 @@ sub mconf_depends {
 
                        $m = "select";
                        next if $only_dep;
+
+                       $flags =~ /@/ or $depend = "PACKAGE_$depend";
                } else {
                        if ($vdep = $package{$depend}->{vdepends}) {
                                $depend = join("||", map { "PACKAGE_".$_ } @$vdep);
+                       } else {
+                               $flags =~ /@/ or $depend = "PACKAGE_$depend";
                        }
                }
-               $flags =~ /@/ or $depend = "PACKAGE_$depend";
+
                if ($condition) {
                        if ($m =~ /select/) {
                                next if $depend eq $condition;
                                $depend = "$depend if $condition";
                        } else {
+                               next if $dep->{"$depend if $condition"};
                                $depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select';
                        }
                }
@@ -272,6 +290,7 @@ sub print_package_config_category($) {
                        print "menu \"$menu\"\n";
                }
                foreach my $pkg (@pkgs) {
+                       next if $pkg->{ignore};
                        my $title = $pkg->{name};
                        my $c = (72 - length($pkg->{name}) - length($pkg->{title}));
                        if ($c > 0) {
@@ -347,7 +366,7 @@ sub print_package_overrides() {
        keys %overrides > 0 or return;
        print "\tconfig OVERRIDE_PKGS\n";
        print "\t\tstring\n";
-       print "\t\tdefault \"".join(" ", keys %overrides)."\"\n\n";
+       print "\t\tdefault \"".join(" ", sort keys %overrides)."\"\n\n";
 }
 
 sub gen_package_config() {