[yum-commits] repoquery.py

James Antill james at osuosl.org
Wed Jun 29 19:43:06 UTC 2011


 repoquery.py |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 16c5dfc31220ba0b53df09d46f08a7248190b270
Author: James Antill <james at and.org>
Date:   Wed Jun 29 15:39:28 2011 -0400

    Allow @foo groups as a packages selector in repoquery.

diff --git a/repoquery.py b/repoquery.py
index 75846cb..2be0971 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -907,6 +907,20 @@ class YumBaseQuery(yum.YumBase):
         
         return self.queryPkgFactory(pkgs)
         
+    def _at_grps(self, items):
+        #  We want to move from @foo => lists of package names here, to make
+        # a bunch of things easier. Ie. pkgs. ops. on lists of packages from
+        # groups.
+        nitems = []
+        for item in items:
+            if item and item[0] == '@':
+                for grp in self.matchGroups([item[1:]]):
+                    nitems.extend(grp.group.packages)
+                # Give warning when no matches?
+                continue
+            nitmes.append(item)
+        return nitems
+
     def runQuery(self, items):
         plain_pkgs = False
         if self.options.group:
@@ -926,6 +940,7 @@ class YumBaseQuery(yum.YumBase):
             except queryError, e:
                 self.logger.error(e)
         else:
+            items = self._at_grps(items)
             if self.options.srpm:
                 pkgs = self.matchSrcPkgs(items)
 


More information about the Yum-commits mailing list