Skip to contentSkip to conversation

archiver: Configurable tarball compression

PATCH Superseded Ian Ray 2 participants 2 messages Sep 20, 2021 – Sep 24, 2021

lore
Share & tools
lore

Ian Ray

author
#0 lore raw

PATCH v2 1/1 archiver: Configurable tarball compression

In order to be more efficient, we use xz as compression method to create GPL sources archives.

[V1 was https://patchwork.openembedded.org/patch/155985/]
[Rebased]
---
 meta/classes/archiver.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/classes/archiver.bbclass +5 -3
index dd31dc0..411d459 100644
@@ -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()
 
Signature · 1 line
2.10.1
#1 lore raw
Quoted 6 lines · Ian Ray

In order to be more efficient, we use xz as compression method to create GPL sources archives.

[V1 was https://patchwork.openembedded.org/patch/155985/]
[Rebased]

xz has its own mind when it comes to parallel threads, how do we control that here? Does it use the global setting to control the number of xz threads ?

Quoted 48 lines
---
  meta/classes/archiver.bbclass | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
meta/classes/archiver.bbclass +5 -4
index dd31dc0..411d459 100644
@@ -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()
 
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#156329): https://lists.openembedded.org/g/openembedded-core/message/156329
Mute This Topic: https://lists.openembedded.org/mt/85841980/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-