Permalink
Browse files

yum-multiverse first-code

  • Loading branch information...
0 parents commit d6da3b35ddea4009abf176a270702ed1f887ae94 @t3rmin4t0r committed Mar 13, 2012
Showing with 24 additions and 0 deletions.
  1. +2 −0 multiverse.conf
  2. +22 −0 multiverse.py
@@ -0,0 +1,2 @@
+[main]
+enabled = 1
@@ -0,0 +1,22 @@
+# ---
+# I should live here:
+# /usr/lib/yum-plugins/multiverse.py
+
+import re
+from yum import config
+from yum.plugins import TYPE_CORE
+
+requires_api_version = '2.4'
+plugin_type = TYPE_CORE
+
+def config_hook(conduit):
+ config.RepoConf.multiversions = config.ListOption()
+
+def postreposetup_hook(conduit):
+ base = conduit._base
+ for repo in conduit.getRepos().listEnabled():
+ patterns = [pkg.replace("*", '.*') for pkg in repo.multiversions]
+ regex = re.compile("^(" + ( ")|(".join(patterns) ) + ")$")
+ pkgs = [pkg.name for pkg in base.pkgSack.returnPackages(repo.id) if regex.match(pkg.name)]
+ base.conf.installonlypkgs.extend(pkgs)
+ #print base.conf.installonlypkgs

0 comments on commit d6da3b3

Please sign in to comment.