mxs: fix automatic status led detection
[openwrt/openwrt.git] / scripts / metadata.pl
index 366e61cb63030843a9cd3a6f7e10a8cfe036a4ad..f3d04dba2dd7e0d433bedc3ee4e8eda03557124d 100755 (executable)
@@ -871,6 +871,28 @@ sub gen_package_feeds() {
        }
 }
 
+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) {
@@ -880,6 +902,8 @@ sub parse_command() {
                /^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:
@@ -889,6 +913,8 @@ Available Commands:
        $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
 }