binutils: break-out libbfd, libopcodes and ar
[openwrt/staging/chunkeey.git] / scripts / metadata.pl
index e408beb507a695607a100586a2763530d7888853..f3d04dba2dd7e0d433bedc3ee4e8eda03557124d 100755 (executable)
@@ -522,6 +522,18 @@ sub mconf_depends {
        return $res;
 }
 
+sub mconf_conflicts {
+       my $pkgname = shift;
+       my $depends = shift;
+       my $res = "";
+
+       foreach my $depend (@$depends) {
+               next unless $package{$depend};
+               $res .= "\t\tdepends on m || (PACKAGE_$depend != y)\n";
+       }
+       return $res;
+}
+
 sub print_package_config_category($) {
        my $cat = shift;
        my %menus;
@@ -583,6 +595,7 @@ sub print_package_config_category($) {
                        }
                        print mconf_depends($pkg->{name}, $pkg->{depends}, 0);
                        print mconf_depends($pkg->{name}, $pkg->{mdepends}, 0);
+                       print mconf_conflicts($pkg->{name}, $pkg->{conflicts});
                        print "\t\thelp\n";
                        print $pkg->{description};
                        print "\n";
@@ -684,7 +697,7 @@ sub gen_package_mk() {
                        $pkg->{buildonly} and $config = "";
                        print "package-$config += $pkg->{subdir}$pkg->{src}\n";
                        if ($pkg->{variant}) {
-                               if (!defined($done{$pkg->{src}})) {
+                               if (!defined($done{$pkg->{src}}) or $pkg->{variant_default}) {
                                        print "\$(curdir)/$pkg->{subdir}$pkg->{src}/default-variant := $pkg->{variant}\n";
                                }
                                print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"
@@ -848,6 +861,38 @@ sub gen_package_source() {
        }
 }
 
+sub gen_package_feeds() {
+       parse_package_metadata($ARGV[0]) or exit 1;
+       foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
+               my $pkg = $package{$name};
+               if ($pkg->{name} && $pkg->{feed}) {
+                       print "Package/$name/feed = $pkg->{feed}\n";
+               }
+       }
+}
+
+sub gen_package_license($) {
+       my $level = shift;
+       parse_package_metadata($ARGV[0]) or exit 1;
+       foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
+               my $pkg = $package{$name};
+               if ($pkg->{name}) {
+                       if ($pkg->{license}) {
+                               print "$pkg->{name}: ";
+                               print "$pkg->{license}\n";
+                               if ($pkg->{licensefiles} && $level == 0) {
+                                       print "\tFiles: $pkg->{licensefiles}\n";
+                               }
+                       } else {
+                               if ($level == 1) {
+                                       print "$pkg->{name}: Missing license! ";
+                                       print "Please fix $pkg->{makefile}\n";
+                               }
+                       }
+               }
+       }
+}
+
 sub parse_command() {
        my $cmd = shift @ARGV;
        for ($cmd) {
@@ -856,6 +901,9 @@ sub parse_command() {
                /^package_config$/ and return gen_package_config();
                /^kconfig/ and return gen_kconfig_overrides();
                /^package_source$/ and return gen_package_source();
+               /^package_feeds$/ and return gen_package_feeds();
+               /^package_license$/ and return gen_package_license(0);
+               /^package_licensefull$/ and return gen_package_license(1);
        }
        print <<EOF
 Available Commands:
@@ -864,6 +912,9 @@ Available Commands:
        $0 package_config [file]        Package metadata in Kconfig format
        $0 kconfig [file] [config]      Kernel config overrides
        $0 package_source [file]        Package source file information
+       $0 package_feeds [file]         Package feed information in makefile format
+       $0 package_license [file]       Package license information
+       $0 package_licensefull [file]   Package license information (full list)
 
 EOF
 }