[yum-commits] repoquery.py

skvidal at osuosl.org skvidal at osuosl.org
Thu Sep 9 22:00:14 UTC 2010


 repoquery.py |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 28d6c5a2f8b9aeaa1a389fc2431ec40696c2aeb9
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Thu Sep 9 17:58:54 2010 -0400

    when --groupmember is specified output the groups per pkg not just as one lump intermixed
    
    pkgname
      @groupname
      @groupname2
    pkgname2
      @groupname
      @groupname3
    
    etc

diff --git a/repoquery.py b/repoquery.py
index f332294..4f42061 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -753,6 +753,13 @@ class YumBaseQuery(yum.YumBase):
         plain_pkgs = False
         if self.options.group:
             pkgs = self.matchGroups(items)
+        elif self.options.groupmember:
+            pkglist = self.matchPkgs(items, plain_pkgs=True)
+            for pkg in pkglist:
+                print to_unicode(pkg)
+                for group in self.find_groupmember(pkg.name):
+                    print to_unicode('  @%s' % group)
+            pkgs = []
         else:
             if self.options.srpm:
                 pkgs = self.matchSrcPkgs(items)
@@ -805,7 +812,7 @@ class YumBaseQuery(yum.YumBase):
     def doQuery(self, method, *args, **kw):
         return getattr(self, "fmt_%s" % method)(*args, **kw)
 
-    def fmt_groupmember(self, name, **kw):
+    def find_groupmember(self, name, **kw):
         grps = []
         for group in self.comps.get_groups():
             if name in group.packages:
@@ -1062,7 +1069,6 @@ def main(args):
     if opts.location:
         pkgops.append("location")
     if opts.groupmember:
-        sackops.append("groupmember")
         needgroup = 1
     if opts.group:
         needgroup = 1


More information about the Yum-commits mailing list