[yum-commits] plugins/auto-update-debuginfo

James Antill james at osuosl.org
Fri Dec 3 14:46:04 UTC 2010


 plugins/auto-update-debuginfo/auto-update-debuginfo.py |   19 +++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 21ed3e62e499ae7d1be638dca54242f4a69a8792
Author: James Antill <james at and.org>
Date:   Fri Dec 3 09:45:45 2010 -0500

    Obey manual --disablerepo in auto-up-di plugin.

diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
index f03841b..b5c6dcd 100644
--- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
+++ b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
@@ -22,11 +22,28 @@
 from yum.plugins import TYPE_CORE
 
 import os, os.path
+import re
+import fnmatch
 
 requires_api_version = '2.1'
 plugin_type = (TYPE_CORE,)
 
+def _check_man_disable(mdrs, di):
+    """ Was this repo. manually disabled. """
+    for match in mdrs:
+        if match(di):
+            return True
+    return False
+
 def enable_debuginfo_repos(yb, conduit):
+    mdrs = set()
+    opts, args = conduit.getCmdLine()
+    if opts is not None:
+        for opt, repoexp in opts.repos:
+            if opt == '--disablerepo':
+                mdrs.add(repoexp)
+    mdrs = [re.compile(fnmatch.translate(x)).match for x in mdrs]
+
     baserepos = {}
     for repo in yb.repos.listEnabled():
         baserepos[repo.id] = repo
@@ -34,6 +51,8 @@ def enable_debuginfo_repos(yb, conduit):
         di = '%s-debuginfo' % repoid
         if di in baserepos:
             continue
+        if _check_man_disable(mdrs, di):
+            continue
         baserepo = baserepos[repoid]
         for r in yb.repos.findRepos(di):
             conduit.info(3, 'Enabling %s: %s' % (r.id, r.name))


More information about the Yum-commits mailing list