[PATCH] Add configurable compression type to pungi (default to xz)

Ralph Bean rbean at redhat.com
Mon Apr 28 19:56:34 UTC 2014


This is for https://fedorahosted.org/rel-eng/ticket/5362#comment:17
---
 src/pypungi/__init__.py | 13 ++++++++++---
 src/pypungi/config.py   |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index e719f1a..7595b4e 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -1202,7 +1202,8 @@ class Pungi(pypungi.PungiBase):
             return subfile.replace(basedir + os.path.sep, '')
         
     def _makeMetadata(self, path, cachedir, comps=False, repoview=False, repoviewtitle=False,
-                      baseurl=False, output=False, basedir=False, update=True):
+                      baseurl=False, output=False, basedir=False, update=True,
+                      compress_type=None):
         """Create repodata and repoview."""
         
         conf = createrepo.MetaDataConfig()
@@ -1221,6 +1222,8 @@ class Pungi(pypungi.PungiBase):
             conf.basedir = basedir
         if baseurl:
             conf.baseurl = baseurl
+        if compress_type:
+            conf.compress_type = compress_type
         repomatic = createrepo.MetaDataGenerator(conf)
         self.logger.info('Making repodata')
         repomatic.doPkgMetadata()
@@ -1264,9 +1267,12 @@ class Pungi(pypungi.PungiBase):
                                         self.tree_arch)
 
         cachedir = self.config.get('pungi', 'cachedir')
+        compress_type = self.config.get('pungi', 'compress_type')
 
         # setup the createrepo call
-        self._makeMetadata(self.topdir, cachedir, compsfile, repoview=True, repoviewtitle=repoviewtitle)
+        self._makeMetadata(self.topdir, cachedir, compsfile,
+                           repoview=True, repoviewtitle=repoviewtitle,
+                           compress_type=compress_type)
 
         # create repodata for debuginfo
         if self.config.getboolean('pungi', 'debuginfo'):
@@ -1274,7 +1280,8 @@ class Pungi(pypungi.PungiBase):
             if not os.path.isdir(path):
                 self.logger.debug("No debuginfo for %s" % self.tree_arch)
                 return
-            self._makeMetadata(path, cachedir, repoview=False)
+            self._makeMetadata(path, cachedir, repoview=False,
+                               compress_type=compress_type)
 
     def doBuildinstall(self):
         """Run lorax on the tree."""
diff --git a/src/pypungi/config.py b/src/pypungi/config.py
index f35e1c6..68759a8 100644
--- a/src/pypungi/config.py
+++ b/src/pypungi/config.py
@@ -33,6 +33,7 @@ class Config(SafeConfigParser):
         self.set('pungi', 'relnotepkgs', 'fedora-release fedora-release-notes')
         self.set('pungi', 'product_path', 'Packages')
         self.set('pungi', 'cachedir', '/var/cache/pungi')
+        self.set('pungi', 'compress_type', 'xz')
         self.set('pungi', 'arch', yum.rpmUtils.arch.getBaseArch())
         self.set('pungi', 'name', 'Fedora')
         self.set('pungi', 'iso_basename', 'Fedora')
-- 
1.9.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/buildsys/attachments/20140428/98ce71e4/attachment.sig>


More information about the buildsys mailing list