Update license handling for pipewire recipe 49/26449/2
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Wed, 23 Jun 2021 19:33:43 +0000 (21:33 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 24 Jun 2021 07:43:52 +0000 (07:43 +0000)
We need to set LICENSE to multiple (MIT & GPL-2.0-only & LGPL-2.1-or-later) to satisfy
the current scheme required by bitbake.

But the licenses of the output packages are not all 3,
but mostly MIT and a few LGPL-2.1-or-later and one GPL-2.0-only.
To map the dynamically created output packages with the proper MIT license,
we need to call setVar after all dynamic packages are created.

Bug-AGL: SPEC-3844
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: I0900902af2527254869c125ec90239c9afb26f3c
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26449
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Reviewed-by: Georgios Kiagiadakis <george.kiagiadakis@collabora.com>
meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bb

index e52745a..b1a1aeb 100644 (file)
@@ -10,10 +10,7 @@ SUMMARY = "Multimedia processing server for Linux"
 DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices"
 HOMEPAGE = "https://pipewire.org/"
 BUGTRACKER  = "https://gitlab.freedesktop.org/pipewire/pipewire/issues"
-LICENSE = "MIT"
-LICENSE_${PN}-jack = "GPL-2.0-only"
-LICENSE_${PN}-alsa-card-profile = "LGPL-2.1-or-later"
-LICENSE_${PN}-spa-plugins-alsa = "LGPL-2.1-or-later"
+LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-or-later"
 
 LIC_FILES_CHKSUM = " \
     file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \
@@ -94,6 +91,7 @@ PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}
 
 PACKAGESPLITFUNCS_prepend = " split_dynamic_packages "
 PACKAGESPLITFUNCS_append = " set_dynamic_metapkg_rdepends "
+PACKAGESPLITFUNCS_append = " fixup_dynamic_pkg_licenses "
 
 SPA_SUBDIR = "spa-0.2"
 PW_MODULE_SUBDIR = "pipewire-0.3"
@@ -109,6 +107,26 @@ remove_unused_installed_files() {
 
 do_install[postfuncs] += "remove_unused_installed_files"
 
+python fixup_dynamic_pkg_licenses () {
+    #dynamic packages inherit currently whatever is specified in LICENSE (thus multiple)
+    packages = (d.getVar('PACKAGES') or "").split()
+
+    for pkg in packages:
+        # we manually assign the LICENSES here to cover all packages (even dynamically created ones)
+        d.setVar("LICENSE_" + pkg ,"MIT")
+
+        # next handle special cases
+        # ==> LICENSE_${PN}-spa-plugins-alsa = "LGPL-2.1-or-later"
+        if "pipewire-spa-plugins-alsa" in pkg:
+            d.setVar("LICENSE_pipewire-spa-plugins-alsa", "LGPL-2.1-or-later")
+        # ==> LICENSE_${PN}-alsa-card-profile = "LGPL-2.1-or-later"
+        if "pipewire-alsa-card-profile" in pkg:
+            d.setVar("LICENSE_pipewire-alsa-card-profile", "LGPL-2.1-or-later")
+        # ==> LICENSE_${PN}-jack = "GPL-2.0-only"
+        if "pipewire-jack" in pkg:
+            d.setVar("LICENSE_pipewire-jack", "GPL-2.0-only")
+}
+
 python split_dynamic_packages () {
     # Create packages for each SPA plugin. These plugins are located
     # in individual subdirectories, so a recursive search is needed.