]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
archiver: move exclusion logic in a dedicated function
authorAntonin Godard <antoningodard@pm.me>
Tue, 16 May 2023 15:56:39 +0000 (15:56 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 May 2023 09:29:04 +0000 (10:29 +0100)
Extending archiver is not possible without duplicating the anonymous
function's logic. Move this logic in a separate function
"include_package" which returns a bool.

Signed-off-by: Antonin Godard <antoningodard@pm.me>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/archiver.bbclass

index 4049694d8564179318c48f4856600e6890647577..0eee1abefab9ec45b5c2c7af04f598f354c127e2 100644 (file)
@@ -76,33 +76,39 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
 
 # This is a convenience for the shell script to use it
 
-
-python () {
-    pn = d.getVar('PN')
-    assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
-    if pn in assume_provided:
-        for p in d.getVar("PROVIDES").split():
-            if p != pn:
-                pn = p
-                break
+def include_package(d, pn):
 
     included, reason = copyleft_should_include(d)
     if not included:
         bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason))
-        return
+        return False
+
     else:
         bb.debug(1, 'archiver: %s is included: %s' % (pn, reason))
 
-
     # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted,
     # so avoid archiving source here.
     if pn.startswith('glibc-locale'):
-        return
+        return False
 
     # We just archive gcc-source for all the gcc related recipes
     if d.getVar('BPN') in ['gcc', 'libgcc'] \
             and not pn.startswith('gcc-source'):
         bb.debug(1, 'archiver: %s is excluded, covered by gcc-source' % pn)
+        return False
+
+    return True
+
+python () {
+    pn = d.getVar('PN')
+    assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
+    if pn in assume_provided:
+        for p in d.getVar("PROVIDES").split():
+            if p != pn:
+                pn = p
+                break
+
+    if not include_package(d, pn):
         return
 
     # TARGET_SYS in ARCHIVER_ARCH will break the stamp for gcc-source in multiconfig