[Piuparts-devel] [Git][debian/piuparts][helmutg/feature-tar-compression] allow using tarballs compressed with non-gzip

Helmut Grohne (@helmutg) gitlab at salsa.debian.org
Wed Nov 8 11:06:24 GMT 2023



Helmut Grohne pushed to branch helmutg/feature-tar-compression at Debian / piuparts


Commits:
eb94e796 by Helmut Grohne at 2023-11-08T12:03:18+01:00
allow using tarballs compressed with non-gzip

The extension of the filename given to --basetgz with or without --save
will be checked for known compression formats by tar. Therefore gzip
tarballs must now have a suffix of .gz or .tgz.

- - - - -


2 changed files:

- docs/piuparts/piuparts.1.txt
- piuparts.py


Changes:

=====================================
docs/piuparts/piuparts.1.txt
=====================================
@@ -61,7 +61,7 @@ Options must come before the other command line arguments.
 
   Use :file:`tarball` as the contents of the initial chroot, instead of building a new one with :program:`debootstrap`.
 
-  The tarball can be created with the :option:`-s` option, or you can use one that :program:`pbuilder` has created (see :option:`-p`). If you create one manually, make sure the root of the chroot is the root of the tarball.
+  The tarball can be created with the :option:`-s` option, or you can use one that :program:`pbuilder` has created (see :option:`-p`). If you create one manually, make sure the root of the chroot is the root of the tarball. Despite the option name implying gzip compression, the compression scheme is deduced by :program:`tar` from the filename suffix.
 
 .. option:: --bindmount dir
 


=====================================
piuparts.py
=====================================
@@ -893,7 +893,7 @@ class Chroot:
         cleanup_tmpfile = lambda: os.remove(tmpfile)
         panic_handler_id = do_on_panic(cleanup_tmpfile)
 
-        run(['tar', '-czf', tmpfile, '--one-file-system', '--exclude', 'tmp/scripts', '-C', self.name, './'])
+        run(['tar', '--auto-compress', '-cf', tmpfile, '--one-file-system', '--exclude', 'tmp/scripts', '-C', self.name, './'])
 
         os.chmod(tmpfile, 0o644)
         os.rename(tmpfile, result)
@@ -905,7 +905,7 @@ class Chroot:
         prefix = []
         if settings.eatmydata and os.path.isfile('/usr/bin/eatmydata'):
             prefix.append('eatmydata')
-        run(prefix + ["tar", "-C", self.name, "-zxf", tarball])
+        run(prefix + ["tar", "-C", self.name, "--auto-compress", "-xf", tarball])
 
     def setup_from_schroot(self, schroot):
         self.schroot_session = schroot.split(":", 1)[-1] + "-" + str(uuid.uuid1()) + "-piuparts"



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/commit/eb94e796a798576fa58bd1b1c6185a0abb8eb0d4

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/commit/eb94e796a798576fa58bd1b1c6185a0abb8eb0d4
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20231108/07f6f2ac/attachment-0001.htm>


More information about the Piuparts-devel mailing list