diff options
author | John Crispin <john@openwrt.org> | 2014-10-26 16:57:33 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2014-10-26 16:57:33 +0000 |
commit | eb738f52750451fc1083f38f8c5cb77220e49d84 (patch) | |
tree | 650f6810ef068bcc24cf964afb561ca67e9f1796 | |
parent | f9a06347df9645f0587990135ebb7dd671371015 (diff) | |
download | upstream-eb738f52750451fc1083f38f8c5cb77220e49d84.tar.gz upstream-eb738f52750451fc1083f38f8c5cb77220e49d84.tar.bz2 upstream-eb738f52750451fc1083f38f8c5cb77220e49d84.zip |
generate list of license information for packages
Many packages define already metadata about their license (PKG_LICENSE),
but this is only included in the ipk files.
This change allows to create the information also on the build-host,
to get an overview on the used licenses.
In the full list, also all packages without this info are shown
Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
SVN-Revision: 43070
-rw-r--r-- | include/package-dumpinfo.mk | 4 | ||||
-rwxr-xr-x | scripts/metadata.pl | 26 | ||||
-rw-r--r-- | scripts/metadata.pm | 2 |
3 files changed, 31 insertions, 1 deletions
diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 26c8d3199d..b6e2f0f794 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -45,7 +45,9 @@ Title: $(TITLE) Maintainer: $(MAINTAINER) $(if $(USERID),Require-User: $(USERID) )Source: $(PKG_SOURCE) -Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg)) +$(if $(PKG_LICENSE),License: $(PKG_LICENSE) +)$(if $(PKG_LICENSE_FILES),LicenseFiles: $(PKG_LICENSE_FILES) +)Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg)) $(if $(KCONFIG),Kernel-Config: $(KCONFIG) )$(if $(BUILDONLY),Build-Only: $(BUILDONLY) )$(if $(HIDDEN),Hidden: $(HIDDEN) diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 366e61cb63..f3d04dba2d 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -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 } diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 16acb8ea8f..fc8657322e 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -97,6 +97,8 @@ sub parse_package_metadata($) { /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1; /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1; /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1; + /^License: \s*(.+)\s*$/ and $pkg->{license} = $1; + /^LicenseFiles: \s*(.+)\s*$/ and $pkg->{licensefiles} = $1; /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1; /^Provides: \s*(.+)\s*$/ and do { my @vpkg = split /\s+/, $1; |