]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
create-spdx-2-2: Fix packagedata usage to work with SDK packages
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 31 May 2023 10:25:29 +0000 (11:25 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 2 Jun 2023 14:16:37 +0000 (15:16 +0100)
There are two seperate PKGDATA_DIR directories, one for the target and one for
the SDK. Rather than fail when a package can't be found, try the SDK first.

We use a datastore copy to keep the code simple, rather than havng to parameterise
all the packagedata functions.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/create-spdx-2.2.bbclass

index f9cb3add387f52bab489b79ce294d09418901651..b8728c5705b657546c83dd47375fe29b0b76f57e 100644 (file)
@@ -714,11 +714,16 @@ def collect_package_providers(d):
     deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME")))
 
     for dep_pn, dep_hashfn in deps:
-        recipe_data = oe.packagedata.read_pkgdata(dep_pn, d)
+        localdata = d
+        recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
+        if not recipe_data:
+            localdata = bb.data.createCopy(d)
+            localdata.setVar("PKGDATA_DIR", "${PKGDATA_DIR_SDK}")
+            recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
 
         for pkg in recipe_data.get("PACKAGES", "").split():
 
-            pkg_data = oe.packagedata.read_subpkgdata_dict(pkg, d)
+            pkg_data = oe.packagedata.read_subpkgdata_dict(pkg, localdata)
             rprovides = set(n for n, _ in bb.utils.explode_dep_versions2(pkg_data.get("RPROVIDES", "")).items())
             rprovides.add(pkg)