archiver: move exclusion logic in a dedicated function
cover archiver: move exclusion logic in a dedicated function
While extending the archiver class to deploy licenses next to the other tarballs, I was forced to duplicate the logic in archiver's anonymous function in my own class. Instead move this logic in a separate function to avoid duplication.
If extending archiver to deploy the licenses of the packages in a tarball (by reusing the license bbclass) seems appropriate in the archiver class, I can of course send another patch.
Antonin Godard (1):
archiver: move exclusion logic in a dedicated function
meta/classes/archiver.bbclass | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
--
2.25.1
PATCH 1/1 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.
--- meta/classes/archiver.bbclass | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
meta/classes/archiver.bbclass +18 -12
@@ -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
--
2.25.1