From 9acb9c58c501d611350a177dee6ab07a7f6536e8 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mon, 28 Apr 2014 15:56:34 -0400 Subject: [PATCH] Add configurable compression type to pungi (default to xz) 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 e719f1a4..7595b4e3 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 f35e1c6f..68759a8a 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')