[game-data-packager] 01/02: Add support for non-default compression algorithms

Simon McVittie smcv at debian.org
Sat Feb 7 18:32:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 9b8e51bab3dd8d1a162d0ca6a440ecc001d3dfe4
Author: Simon McVittie <smcv at debian.org>
Date:   Sat Feb 7 18:24:30 2015 +0000

    Add support for non-default compression algorithms
---
 debian/changelog               |  1 +
 game_data_packager/__init__.py | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4f23fce..13c37ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,7 @@ game-data-packager (40) UNRELEASED; urgency=medium
     /etc/game-data-packager/idstuff-mirrors is sufficient.
   * Estimate Installed-Size with the algorithm planned for dpkg 1.18,
     rather than using du which is filesystem-dependent
+  * Add support for non-default compression algorithms
 
  -- Simon McVittie <smcv at debian.org>  Thu, 22 Jan 2015 23:54:12 +0000
 
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index d8d1133..4505fef 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -451,7 +451,11 @@ class GameData(object):
         # Subset of packages.values() with nonempty rip_cd
         self.rip_cd_packages = set()
 
-        # If true, we may compress the .deb. If false, don't.
+        # How to compress the .deb:
+        # True: dpkg-deb's default
+        # False: -Znone
+        # str: -Zstr (gzip, xz or none)
+        # list: arbitrary options (e.g. -z9 -Zgz -Sfixed)
         self.compress_deb = True
 
         self.help_text = ''
@@ -2210,12 +2214,17 @@ class GameData(object):
 
         outfile = os.path.join(os.path.abspath(destination), deb_basename)
 
-        # only compress if the caller says we should and the YAML
-        # says it's worthwhile
-        if compress and self.compress_deb and not package.rip_cd:
-            dpkg_deb_args = []
-        else:
+        # only compress if the caller says we should, the YAML
+        # says it's worthwhile, and this isn't a ripped CD (Vorbis
+        # is already compressed)
+        if not compress or not self.compress_deb or package.rip_cd:
             dpkg_deb_args = ['-Znone']
+        elif self.compress_deb is True:
+            dpkg_deb_args = []
+        elif isinstance(self.compress_deb, str):
+            dpkg_deb_args = ['-Z' + self.compress_deb]
+        elif isinstance(self.compress_deb, list):
+            dpkg_deb_args = self.compress_deb
 
         try:
             subprocess.check_output(['fakeroot', 'dpkg-deb'] +

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list