Skip to contentSkip to conversation

PATCH] license: Fix directory layout issues

OE-core Mark Hatle 1 participant 1 message Oct 10, 2024

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

From: Richard Purdie <[email protected]>

There are several issues:

a) pointless empty directories were being created as a path wasn't fixed in a previous commit
b) SSTATE_PKGARCH wasn't being captured into the task signature since it is in the ignore list by default. We want to capture the absolute value, not the dependencies
c) with those issues fixed, cross/native issues became apparent so those need to be fixed too.

Backport from oe-core master: f68aed302a0e4b86fb8c16a6ef4e7295bed48b86

---
This is a backport from master to fix an issue with do_populate_lic.

do_populate_lic is not rerun when a package that is MACHINE_ARCH is run with two different machines, the sstate-cache only contains the entry for the first machine built. This results in the tmp/deploy/license being in the wrong directory and a possible QA warning from 'license-file-missing'.

 meta/classes-global/license.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
meta/classes-global/license.bbclass +8 -2
index b2e0d3f..d7c5d08 100644
@@ -18,8 +18,14 @@ LICENSE_CREATE_PACKAGE ??= "0"
 LICENSE_PACKAGE_SUFFIX ??= "-lic"
 LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/"
 
+LICENSE_DEPLOY_PATHCOMPONENT = "${SSTATE_PKGARCH}"
+LICENSE_DEPLOY_PATHCOMPONENT:class-cross = "native"
+LICENSE_DEPLOY_PATHCOMPONENT:class-native = "native"
+# Ensure the *value* of SSTATE_PKGARCH is captured as it is used in the output paths
+LICENSE_DEPLOY_PATHCOMPONENT[vardepvalue] += "${LICENSE_DEPLOY_PATHCOMPONENT}"
+
 addtask populate_lic after do_patch before do_build
-do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
+do_populate_lic[dirs] = "${LICSSTATEDIR}/${LICENSE_DEPLOY_PATHCOMPONENT}/${PN}"
 do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
 
 python do_populate_lic() {
@@ -29,7 +35,7 @@ python do_populate_lic() {
     lic_files_paths = find_license_files(d)
 
     # The base directory we wrangle licenses to
-    destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('SSTATE_PKGARCH'), d.getVar('PN'))
+    destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('LICENSE_DEPLOY_PATHCOMPONENT'), d.getVar('PN'))
     copy_license_files(lic_files_paths, destdir)
     info = get_recipe_info(d)
     with open(os.path.join(destdir, "recipeinfo"), "w") as f:
Signature · 1 line
1.8.3.1