[PUNGI PATCH] Add an option for only pulling the best provider

Bill Nottingham notting at redhat.com
Thu Feb 10 20:32:41 UTC 2011


This is so it doesn't pull 200 fonts for "font(:lang=en)", or all the MTAs.

Can easily change option name, etc. if necessary.

Bill
-------------- next part --------------
commit b4e40a079e918d95d3e59553375b945661b911df
Author: Bill Nottingham <notting at redhat.com>
Date:   Thu Feb 10 15:30:02 2011 -0500

    Add an option to allow only grabbing the best provides for a particular depenedency, instead of all.

diff --git a/src/bin/pungi.py b/src/bin/pungi.py
index 3e88ef8..7fa119d 100755
--- a/src/bin/pungi.py
+++ b/src/bin/pungi.py
@@ -77,6 +77,8 @@ def main():
     # Set debuginfo flag
     if opts.nodebuginfo:
         config.set('pungi', 'debuginfo', "False")
+    if opts.nogreedy:
+        config.set('pungi', 'alldeps', "False")
 
     # Actually do work.
     mypungi = pypungi.Pungi(config, ksparser)
@@ -178,6 +180,8 @@ if __name__ == '__main__':
           help='disable gathering of source packages (optional)')
         parser.add_option("--nodebuginfo", action="store_true", dest="nodebuginfo",
           help='disable gathering of debuginfo packages (optional)')
+        parser.add_option("--nogreedy", action="store_true", dest="nogreedy",
+          help='disable pulling of all providers of package dependencies (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("--force", default=False, action="store_true",
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index 2a778c2..506c848 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -285,6 +285,9 @@ class Pungi(pypungi.PungiBase):
                 self.logger.warn("Unresolvable dependency %s in %s.%s" % (r, po.name, po.arch))
                 continue
 
+            if not self.config.getboolean('pungi', 'alldeps'):
+                deps = self.ayum.bestPackagesFromList(deps)
+
             depsack = yum.packageSack.ListPackageSack(deps)
 
             for dep in depsack.returnNewestByNameArch():
diff --git a/src/pypungi/config.py b/src/pypungi/config.py
index 848a2d4..c8eb10d 100644
--- a/src/pypungi/config.py
+++ b/src/pypungi/config.py
@@ -42,4 +42,5 @@ class Config(SafeConfigParser):
         self.set('pungi', 'bugurl', 'https://bugzilla.redhat.com')
         self.set('pungi', 'cdsize', '695.0')
         self.set('pungi', 'debuginfo', "True")
+        self.set('pungi', 'alldeps', "True")
 


More information about the buildsys mailing list