In the absence of kickstart support for specifying repo priorities,
perhaps the best we can do is make the order of repos imply their
priority.
This patch adds a --prioritize command line option which causes
pungi to assign priorities to each repo based on the order they
were supplied.
Signed-off-by: Mark McLoughlin <markmc(a)redhat.com>
Index: pungi/pypungi/gather.py
===================================================================
--- pungi.orig/pypungi/gather.py
+++ pungi/pypungi/gather.py
@@ -47,7 +47,7 @@ class PungiYum(yum.YumBase):
pass
class Gather(pypungi.PungiBase):
- def __init__(self, config, ksparser):
+ def __init__(self, config, ksparser, prioritize = False):
pypungi.PungiBase.__init__(self, config)
# Set our own logging name space
@@ -119,6 +119,12 @@ class Gather(pypungi.PungiBase):
thisrepo.enablegroups = True
if not repo.priority is None:
thisrepo.priority = repo.priority
+ elif prioritize:
+ if hasattr(thisrepo, "priority"):
+ thisrepo.priority = len(self.ayum.repos.repos)
+ else:
+ self.logger.warning('The yum-priorities plugin is needed to
support prioritizing repos')
+ prioritize = False
self.ayum.repos.add(thisrepo)
self.ayum.repos.enableRepo(thisrepo.id)
self.ayum._getRepos(thisrepo=thisrepo.id, doSetup = True)
Index: pungi/pungi
===================================================================
--- pungi.orig/pungi
+++ pungi/pungi
@@ -62,7 +62,7 @@ def main():
# Actually do work.
if not opts.sourceisos:
if opts.do_all or opts.do_gather:
- mygather = pypungi.gather.Gather(config, ksparser)
+ mygather = pypungi.gather.Gather(config, ksparser, opts.prioritize)
mygather.getPackageObjects()
mygather.downloadPackages()
mygather.makeCompsFile()
@@ -143,6 +143,8 @@ if __name__ == '__main__':
help='disable gathering of source packages (optional)')
parser.add_option("--sourceisos", default=False,
action="store_true", dest="sourceisos",
help='Create the source isos (other arch runs must be done)')
+ parser.add_option("--prioritize", default=False,
action="store_true", dest="prioritize",
+ help='Prioritize yum repositories in the order they are specified')
parser.add_option("-c", "--config", dest="config",
help='Path to kickstart config file')
--
Show replies by date