From 52e97dc769858ce2d2e735a832f67972927dba8c Mon Sep 17 00:00:00 2001 From: Ian Ray Date: Mon, 20 Sep 2021 13:25:12 +0300 Subject: archiver: Configurable tarball compression In order to be more efficient, we use xz as compression method to create GPL sources archives. (From OE-Core rev: 877b27b0cbf4f4544f75e0f0a78a82baeb46b159) Signed-off-by: Fabien Lahoudere [V1 was https://patchwork.openembedded.org/patch/155985/] [Rebased] Signed-off-by: Ian Ray Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/classes/archiver.bbclass | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'meta/classes/archiver.bbclass') diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index dd31dc0cd8..411d459ed0 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -51,6 +51,7 @@ ARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches" ARCHIVER_MODE[dumpdata] ?= "0" ARCHIVER_MODE[recipe] ?= "0" ARCHIVER_MODE[mirror] ?= "split" +ARCHIVER_MODE[compression] ?= "gz" DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources" ARCHIVER_TOPDIR ?= "${WORKDIR}/archiver-sources" @@ -409,15 +410,16 @@ def create_tarball(d, srcdir, suffix, ar_outdir): # that we archive the actual directory and not just the link. srcdir = os.path.realpath(srcdir) + compression_method = d.getVarFlag('ARCHIVER_MODE', 'compression') bb.utils.mkdirhier(ar_outdir) if suffix: - filename = '%s-%s.tar.gz' % (d.getVar('PF'), suffix) + filename = '%s-%s.tar.%s' % (d.getVar('PF'), suffix, compression_method) else: - filename = '%s.tar.gz' % d.getVar('PF') + filename = '%s.tar.%s' % (d.getVar('PF'), compression_method) tarname = os.path.join(ar_outdir, filename) bb.note('Creating %s' % tarname) - tar = tarfile.open(tarname, 'w:gz') + tar = tarfile.open(tarname, 'w:%s' % compression_method) tar.add(srcdir, arcname=os.path.basename(srcdir), filter=exclude_useless_paths) tar.close() -- cgit v1.2.3-54-g00ecf