Deprecate the old SPI-GPIO driver.
[openwrt.git] / scripts / metadata.pl
index 43e5ccc6d0ea20caba880e7f855f84d9e946bb1e..fa30556205d260034bd12f7570acf877e4d88b10 100755 (executable)
@@ -375,7 +375,7 @@ sub mconf_depends {
        my $res;
        my $dep = shift;
        my $seen = shift;
-       my $condition = shift;
+       my $parent_condition = shift;
        $dep or $dep = {};
        $seen or $seen = {};
 
@@ -386,11 +386,12 @@ sub mconf_depends {
                $depend =~ s/^([@\+]+)//;
                my $flags = $1;
                my $vdep;
+               my $condition;
 
                if ($depend =~ /^(.+):(.+)$/) {
                        if ($1 ne "PACKAGE_$pkgname") {
-                               if ($condition) {
-                                       $condition = "$condition && $1";
+                               if ($parent_condition) {
+                                       $condition = "$parent_condition && $1";
                                } else {
                                        $condition = $1;
                                }
@@ -398,6 +399,7 @@ sub mconf_depends {
                        $depend = $2;
                }
                next if $seen->{$depend};
+               next if $package{$depend} and $package{$depend}->{buildonly};
                $seen->{$depend} = 1;
                if ($vdep = $package{$depend}->{vdepends}) {
                        $depend = join("||", map { "PACKAGE_".$_ } @$vdep);
@@ -442,6 +444,7 @@ sub print_package_config_category($) {
 
        foreach my $spkg (sort {uc($a) cmp uc($b)} keys %spkg) {
                foreach my $pkg (@{$spkg{$spkg}}) {
+                       next if $pkg->{buildonly};
                        my $menu = $pkg->{submenu};
                        if ($menu) {
                                $menu_dep{$menu} or $menu_dep{$menu} = $pkg->{submenudep};
@@ -543,6 +546,7 @@ sub gen_package_mk() {
                        $config = "\$(CONFIG_PACKAGE_$name)"
                }
                if ($config) {
+                       $pkg->{buildonly} and $config = "";
                        print "package-$config += $pkg->{subdir}$pkg->{src}\n";
                        $pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
                }
@@ -560,7 +564,7 @@ sub gen_package_mk() {
                }
 
                my $hasdeps = 0;
-               my $depline = "";
+               my %deplines;
                foreach my $deps (@srcdeps) {
                        my $idx;
                        my $condition;
@@ -588,9 +592,10 @@ sub gen_package_mk() {
                                }
                                undef $idx if $idx =~ /^(kernel)|(base-files)$/;
                                if ($idx) {
+                                       my $depline;
                                        next if $pkg->{src} eq $pkg_dep->{src};
                                        next if $dep{$pkg->{src}."->".$idx};
-                                       next if $dep{$pkg->{src}."->($dep)".$idx};
+                                       next if $dep{$pkg->{src}."->($dep)".$idx} and $pkg_dep->{vdepends};
                                        my $depstr;
 
                                        if ($pkg_dep->{vdepends}) {
@@ -602,16 +607,20 @@ sub gen_package_mk() {
                                        }
                                        if ($condition) {
                                                if ($condition =~ /^!(.+)/) {
-                                                       $depline .= " \$(if \$(CONFIG_$1),,$depstr)";
+                                                       $depline = "\$(if \$(CONFIG_$1),,$depstr)";
                                                } else {
-                                                       $depline .= " \$(if \$(CONFIG_$condition),$depstr)";
+                                                       $depline = "\$(if \$(CONFIG_$condition),$depstr)";
                                                }
                                        } else {
-                                               $depline .= " $depstr";
+                                               $depline = $depstr;
+                                       }
+                                       if ($depline) {
+                                               $deplines{$idx.$dep} = $depline;
                                        }
                                }
                        }
                }
+               my $depline = join(" ", values %deplines);
                if ($depline) {
                        $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/compile += $depline\n";
                }