* [[PATCHv2][Rebased] 1/2] license.bbclass: Don't copy again LICENSE already handled as no-generic
@ 2017-02-16 16:45 Aníbal Limón
2017-02-16 16:45 ` [[PATCHv2][Rebased] 2/2] classes/license.bbclass: Don't copy unneeded licenses by package Aníbal Limón
0 siblings, 1 reply; 2+ messages in thread
From: Aníbal Limón @ 2017-02-16 16:45 UTC (permalink / raw)
To: openembedded-core
The NO_GENERIC_LICENSE mapping was added [1] to enable copy LICENSES
from upstream source code into recipe licenses, previously that only
common-licenses was processed.
This result on copy twice the NO_GENERIC_LICENSE specified because there
is a mapping between license in LIC_CHKSUM and NO_GENERIC_LICENSE.
In order to avoid double copy one as generic_ and other as LICENSE. keep
track of licenses already copied.
For linux-firmware the result will be only generic_ licenses into
common-licenses.
[YOCTO #10325]
[1]
http://lists.openembedded.org/pipermail/openembedded-core/2015-April/104222.html
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
meta/classes/license.bbclass | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 9923aac..2b980c0 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -406,6 +406,8 @@ def find_license_files(d):
generic_directory = d.getVar('COMMON_LICENSE_DIR')
# List of basename, path tuples
lic_files_paths = []
+ # hash for keep track generic lics mappings
+ non_generic_lics = {}
# Entries from LIC_FILES_CHKSUM
lic_chksums = {}
license_source_dirs = []
@@ -468,6 +470,7 @@ def find_license_files(d):
# of the package rather than the license_source_dirs.
lic_files_paths.append(("generic_" + license_type,
os.path.join(srcdir, non_generic_lic), None, None))
+ non_generic_lics[non_generic_lic] = license_type
else:
# Add explicity avoid of CLOSED license because this isn't generic
if license_type != 'CLOSED':
@@ -503,6 +506,9 @@ def find_license_files(d):
lic_chksum_paths[os.path.basename(path)][data] = (os.path.join(srcdir, path), data[1], data[2])
for basename, files in lic_chksum_paths.items():
if len(files) == 1:
+ # Don't copy again a LICENSE already handled as non-generic
+ if basename in non_generic_lics:
+ continue
data = list(files.values())[0]
lic_files_paths.append(tuple([basename] + list(data)))
else:
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [[PATCHv2][Rebased] 2/2] classes/license.bbclass: Don't copy unneeded licenses by package
2017-02-16 16:45 [[PATCHv2][Rebased] 1/2] license.bbclass: Don't copy again LICENSE already handled as no-generic Aníbal Limón
@ 2017-02-16 16:45 ` Aníbal Limón
0 siblings, 0 replies; 2+ messages in thread
From: Aníbal Limón @ 2017-02-16 16:45 UTC (permalink / raw)
To: openembedded-core
Usually a recipe only provides one package but when provides more
than one package the LICENSE variable per package (i.e. linux-firmware)
needs to take into account to avoid unnecesary copy of licenses into
packages.
The patch validates if LICENSE exists in package LICENSES in order to
don't copy unneeded licenses.
As result of this patch some packages will not contain licenses there
are not into LICENSE variable.
For example:
acl contains GPLv2+ instead of GPLv2+ and LGPLv2.1+
libacl contains LGPLv2+ instead of GPLv2+ and LGPLv2.1+
This behaviour is declared on the acl recipe as:
SUMMARY = "Utilities for managing POSIX Access Control Lists"
HOMEPAGE = "http://savannah.nongnu.org/projects/acl/"
SECTION = "libs"
LICENSE = "LGPLv2.1+ & GPLv2+"
LICENSE_${PN} = "GPLv2+"
LICENSE_lib${BPN} = "LGPLv2.1+"
[YOCTO #10325]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
meta/classes/license.bbclass | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 2b980c0..bbc578c 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -131,6 +131,10 @@ def write_license_files(d, license_manifest, pkg_dic):
bb.utils.mkdirhier(pkg_rootfs_license_dir)
pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
pkg_dic[pkg]["PN"])
+
+ pkg_manifest_licenses = [canonical_license(d, lic) \
+ for lic in pkg_dic[pkg]["LICENSES"]]
+
licenses = os.listdir(pkg_license_dir)
for lic in licenses:
rootfs_license = os.path.join(rootfs_license_dir, lic)
@@ -138,9 +142,18 @@ def write_license_files(d, license_manifest, pkg_dic):
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
if re.match("^generic_.*$", lic):
- generic_lic = re.search("^generic_(.*)$", lic).group(1)
- if oe.license.license_ok(canonical_license(d,
- generic_lic), bad_licenses) == False:
+ generic_lic = canonical_license(d,
+ re.search("^generic_(.*)$", lic).group(1))
+
+ # Do not copy generic license into package if isn't
+ # declared into LICENSES of the package.
+ if not re.sub('\+$', '', generic_lic) in \
+ [re.sub('\+', '', lic) for lic in \
+ pkg_manifest_licenses]:
+ continue
+
+ if oe.license.license_ok(generic_lic,
+ bad_licenses) == False:
continue
if not os.path.exists(rootfs_license):
@@ -499,7 +512,6 @@ def find_license_files(d):
bb.fatal('%s: %s' % (d.getVar('PF'), exc))
except SyntaxError:
bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF')))
-
# Add files from LIC_FILES_CHKSUM to list of license files
lic_chksum_paths = defaultdict(OrderedDict)
for path, data in lic_chksums.items():
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-16 16:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16 16:45 [[PATCHv2][Rebased] 1/2] license.bbclass: Don't copy again LICENSE already handled as no-generic Aníbal Limón
2017-02-16 16:45 ` [[PATCHv2][Rebased] 2/2] classes/license.bbclass: Don't copy unneeded licenses by package Aníbal Limón
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox