From 08c4b7f46d0992c90619c2484e676309a5f5b36e Mon Sep 17 00:00:00 2001 From: Antonin Godard Date: Tue, 16 May 2023 15:56:39 +0000 Subject: [PATCH] archiver: move exclusion logic in a dedicated function 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. (From OE-Core rev: 292c626526b2ba6d3a66463c0c7ab59eb8903ab4) Signed-off-by: Antonin Godard Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/classes/archiver.bbclass | 40 ++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 4049694d85..0eee1abefa 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -76,6 +76,28 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}" # This is a convenience for the shell script to use it +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 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 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') @@ -86,23 +108,7 @@ python () { pn = p break - included, reason = copyleft_should_include(d) - if not included: - bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason)) - return - 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 - - # 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) + if not include_package(d, pn): return # TARGET_SYS in ARCHIVER_ARCH will break the stamp for gcc-source in multiconfig