Add configurable compression type to pungi (default to xz)

This is for https://fedorahosted.org/rel-eng/ticket/5362#comment:17
This commit is contained in:
Ralph Bean 2014-04-28 15:56:34 -04:00 committed by Dennis Gilmore
parent 293143d8f1
commit 9acb9c58c5
2 changed files with 11 additions and 3 deletions

View File

@ -1202,7 +1202,8 @@ class Pungi(pypungi.PungiBase):
return subfile.replace(basedir + os.path.sep, '') return subfile.replace(basedir + os.path.sep, '')
def _makeMetadata(self, path, cachedir, comps=False, repoview=False, repoviewtitle=False, 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.""" """Create repodata and repoview."""
conf = createrepo.MetaDataConfig() conf = createrepo.MetaDataConfig()
@ -1221,6 +1222,8 @@ class Pungi(pypungi.PungiBase):
conf.basedir = basedir conf.basedir = basedir
if baseurl: if baseurl:
conf.baseurl = baseurl conf.baseurl = baseurl
if compress_type:
conf.compress_type = compress_type
repomatic = createrepo.MetaDataGenerator(conf) repomatic = createrepo.MetaDataGenerator(conf)
self.logger.info('Making repodata') self.logger.info('Making repodata')
repomatic.doPkgMetadata() repomatic.doPkgMetadata()
@ -1264,9 +1267,12 @@ class Pungi(pypungi.PungiBase):
self.tree_arch) self.tree_arch)
cachedir = self.config.get('pungi', 'cachedir') cachedir = self.config.get('pungi', 'cachedir')
compress_type = self.config.get('pungi', 'compress_type')
# setup the createrepo call # 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 # create repodata for debuginfo
if self.config.getboolean('pungi', 'debuginfo'): if self.config.getboolean('pungi', 'debuginfo'):
@ -1274,7 +1280,8 @@ class Pungi(pypungi.PungiBase):
if not os.path.isdir(path): if not os.path.isdir(path):
self.logger.debug("No debuginfo for %s" % self.tree_arch) self.logger.debug("No debuginfo for %s" % self.tree_arch)
return return
self._makeMetadata(path, cachedir, repoview=False) self._makeMetadata(path, cachedir, repoview=False,
compress_type=compress_type)
def doBuildinstall(self): def doBuildinstall(self):
"""Run lorax on the tree.""" """Run lorax on the tree."""

View File

@ -33,6 +33,7 @@ class Config(SafeConfigParser):
self.set('pungi', 'relnotepkgs', 'fedora-release fedora-release-notes') self.set('pungi', 'relnotepkgs', 'fedora-release fedora-release-notes')
self.set('pungi', 'product_path', 'Packages') self.set('pungi', 'product_path', 'Packages')
self.set('pungi', 'cachedir', '/var/cache/pungi') self.set('pungi', 'cachedir', '/var/cache/pungi')
self.set('pungi', 'compress_type', 'xz')
self.set('pungi', 'arch', yum.rpmUtils.arch.getBaseArch()) self.set('pungi', 'arch', yum.rpmUtils.arch.getBaseArch())
self.set('pungi', 'name', 'Fedora') self.set('pungi', 'name', 'Fedora')
self.set('pungi', 'iso_basename', 'Fedora') self.set('pungi', 'iso_basename', 'Fedora')