[yum-git] docs/yum-filter-data.1 docs/yum-list-data.1 plugins/filter-data plugins/list-data

James Antill james at linux.duke.edu
Tue Feb 5 16:38:20 UTC 2008


 docs/yum-filter-data.1             |   18 ++++++----
 docs/yum-list-data.1               |   16 ++++-----
 plugins/filter-data/filter-data.py |   61 ++++++++++++++++++++-----------------
 plugins/list-data/list-data.py     |    4 +-
 4 files changed, 54 insertions(+), 45 deletions(-)

New commits:
commit de1ff54c76e0d615423223d5a6ff012f67622da9
Author: James Antill <james at and.org>
Date:   Tue Feb 5 11:30:05 2008 -0500

     Change groups => rpm-groups, yum-groups => groups. Minor fixes

diff --git a/docs/yum-filter-data.1 b/docs/yum-filter-data.1
index 0c4f1be..43348bf 100644
--- a/docs/yum-filter-data.1
+++ b/docs/yum-filter-data.1
@@ -21,11 +21,11 @@ This option includes packages which have a vendor which matches one of the
 passed vendor wildcard strings, or is unknown. Note that vendors can have
 spaces in their value, so "," is the only way to specify multiple vendors as one
 option argument.
-.IP "\fB\--filter-groups\fP"
+.IP "\fB\--filter-rpm-groups\fP"
 This option includes packages which have a group which matches one of the
-passed group wildcard strings, or is unknown. Note that groups can have
-spaces in their value, so "," is the only way to specify multiple groups as one
-option argument.
+passed rpm group wildcard strings, or is unknown. Note that rpm groups can have
+spaces in their value, so "," is the only way to specify multiple rpm groups as
+one option argument.
 .IP "\fB\--filter-packagers\fP"
 This option includes packages which have a packager which matches one of the
 passed packager wildcard strings, or is unknown. Note that vendors can have
@@ -61,7 +61,7 @@ the passed archivesize ranges, or is unknown.
 .IP "\fB\--filter-installed-sizes\fP"
 This option includes packages which have a installedsize which is within one of
 the passed installedsize ranges, or is unknown.
-.IP "\fB\--filter-yum-groups\fP"
+.IP "\fB\--filter-groups\fP"
 This option includes packages which are in a yum group which matches one of the
 passed yum group id strings, or is unknown. Note that yum groups can have
 spaces in their value, so "," is the only way to specify multiple yum groups as
@@ -81,11 +81,15 @@ yum --filter-committers='Dan Walsh *' update
 .PP
 To list updates for a specific group use:
 .IP
-yum --filter-groups='App*/Sys*' list updates
+yum --filter-rpm-groups='App*/Sys*' list updates
 .PP
 To apply updates to a specific set of groups use:
 .IP
-yum --filter-groups='App*/System,Devel*/Lib*,System Environment/Base' update
+yum --filter-rpm-groups='App*/System,Devel*/Lib*,System Environment/Base' update
+.PP
+To list updates for a set of yum groups use:
+.IP
+yum --filter-yum-groups='PostgreSQL Database,Web Server' list updates
 .PP
 To apply updates to a specific set of yum groups use:
 .IP
diff --git a/docs/yum-list-data.1 b/docs/yum-list-data.1
index c5826e8..aac871f 100644
--- a/docs/yum-list-data.1
+++ b/docs/yum-list-data.1
@@ -14,9 +14,9 @@ added yum \fIcommand\fPs are:
 .br 
 .I \fR * info-vendors
 .br 
-.I \fR * list-groups
+.I \fR * list-rpm-groups
 .br 
-.I \fR * info-groups
+.I \fR * info-rpm-groups
 .br 
 .I \fR * list-packagers
 .br 
@@ -54,9 +54,9 @@ added yum \fIcommand\fPs are:
 .br 
 .I \fR * info-installed-sizes
 .br 
-.I \fR * list-yum-groups
+.I \fR * list-groups
 .br 
-.I \fR * info-yum-groups
+.I \fR * info-groups
 .br 
 .PP 
 all of which take the same arguments as the list and info yum commands. The
@@ -70,7 +70,7 @@ all the packages under each agregation.
 Is used to list the aggregate of the vendor attribute on the packages, examples
 are "Fedora Project" and "Red Hat, Inc.".
 .IP
-.IP "\fBlist-groups\fP" "\fBinfo-groups\fP"
+.IP "\fBlist-rpm-groups\fP" "\fBinfo-rpm-groups\fP"
 Is used to list the aggregate of the group attribute on the packages, examples
 are "Applications/System", "Development/Tools" and "System Environment/Base"
 .IP
@@ -111,7 +111,7 @@ the packages, examples are "[    1B -  10KB ]" and "[ 750KB -   1MB ]".
 Is used to list the aggregate of specified ranges the installedsize attribute on
 the packages, examples are "[    1B -  10KB ]" and "[ 750KB -   1MB ]".
 .IP
-.IP "\fBlist-yum-groups\fP" "\fBinfo-yum-groups\fP"
+.IP "\fBlist-groups\fP" "\fBinfo-groups\fP"
 Is used to list the aggregate of the yum groups that the packages are in,
 examples are in "yum grouplist". Note that in yum groups a package can be in
 more than one group at a time.
@@ -123,7 +123,7 @@ which point a seperate aggregation called "-- Unknown --" is listed.
 .PP
 To list all the groups that have an update, along with the number of packages in each group, use:
 .IP
-yum list-groups updates
+yum list-rpm-groups updates
 .PP
 To list all the committers to packages that have yum in their name, use:
 .IP
@@ -135,7 +135,7 @@ yum list-package-sizes
 .PP
 To list yum groups that have an update, use:
 .IP
-yum list-yum-groups
+yum list-groups
 
 
 .SH "SEE ALSO"
diff --git a/plugins/filter-data/filter-data.py b/plugins/filter-data/filter-data.py
index 4e9cbf3..d8fe136 100644
--- a/plugins/filter-data/filter-data.py
+++ b/plugins/filter-data/filter-data.py
@@ -66,7 +66,7 @@ all_yum_grp_mbrs = {}
 def fd_make_group_data(base, opts):
     global all_yum_grp_mbrs
 
-    for pat in opts.filter_yum_groups:
+    for pat in opts.filter_groups:
 
         group = base.comps.return_group(pat)
         if not group:
@@ -90,17 +90,17 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
     """ Do the package filtering for. """
 
     for (attrs, attr) in [('vendors', 'vendor'),
-                          ('groups', 'group'),
+                          ('rpm-groups', 'group'),
                           ('packagers', 'packager'),
                           ('licenses', 'license'),
                           ('arches', 'arch'),
                           ('committers', 'committer'),
                           ('buildhosts', 'buildhost'),
                           ('urls', 'url')]:
-        pats = getattr(opts, 'filter_' + attrs)
+        pats = getattr(opts, 'filter_' + attrs.replace('-', '_'))
         filt = len(pats)
+        data = fd__get_data(pkg, attr)
         for pat in pats:
-            data = fd__get_data(pkg, attr)
             if data == fd__unknown or fnmatch.fnmatch(data, pat):
                 used_map[attrs][pat] = True
                 filt = False
@@ -113,8 +113,8 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
                           ('installed-sizes', 'installedsize')]:
         rangs = getattr(opts, 'filter_' + attrs.replace('-', '_'))
         filt = len(rangs)
+        data = fd__get_data(pkg, attr, strip=False)
         for rang in rangs:
-            data = fd__get_data(pkg, attr, strip=False)
             if data == fd__unknown or range_match(data, rang):
                 used_map[attrs][rang] = True
                 filt = False
@@ -122,19 +122,20 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
         if filt:
             return (attrs, attr)
 
-    if pkg.name not in all_yum_grp_mbrs:
-        return ('yum-groups', None)
+    if len(opts.filter_groups):
+        if pkg.name not in all_yum_grp_mbrs:
+            return ('groups', None)
 
-    for pat in all_yum_grp_mbrs[pkg.name]:
-        used_map['yum-groups'][pat] = True
-        break
+        for pat in all_yum_grp_mbrs[pkg.name]:
+            used_map['groups'][pat] = True
+            break
 
     return None
 
 def fd_gen_used_map(opts):
     used_map = {}
     for (attrs, attr) in [('vendors', 'vendor'),
-                          ('groups', 'group'),
+                          ('rpm-groups', 'group'),
                           ('packagers', 'packager'),
                           ('licenses', 'license'),
                           ('arches', 'arch'),
@@ -144,7 +145,7 @@ def fd_gen_used_map(opts):
                           ('package-sizes', 'packagesize'),
                           ('archive-sizes', 'archivesize'),
                           ('installed-sizes', 'installedsize'),
-                          ('yum-groups', None)]:
+                          ('groups', None)]:
         used_map[attrs] = {}
         vattrs = attrs.replace('-', '_')
         for i in getattr(opts, 'filter_' + vattrs):
@@ -154,7 +155,7 @@ def fd_gen_used_map(opts):
 
 def fd_chk_used_map(used_map, msg):
     for (attrs, attr) in [('vendors', 'vendor'),
-                          ('groups', 'group'),
+                          ('rpm-groups', 'rpm group'),
                           ('packagers', 'packager'),
                           ('licenses', 'license'),
                           ('arches', 'arch'),
@@ -178,8 +179,8 @@ def fd_chk_used_map(used_map, msg):
                     msg(attrs[:-1].capitalize() +
                         ' range \"%d-%d\" did not match any packages' % i)
 
-    for i in used_map['yum-groups']:
-        if not used_map['yum-groups'][i]:
+    for i in used_map['groups']:
+        if not used_map['groups'][i]:
             msg('Yum group \"%s\" did not contain any packages' % i)
 
         
@@ -201,7 +202,7 @@ def fd_check_func_enter(conduit):
     # Quick match, so we don't do lots of work when nothing has been specified
     ndata = True
     for (attrs, attr) in [('vendors', 'vendor'),
-                          ('groups', 'group'),
+                          ('rpm-groups', 'group'),
                           ('packagers', 'packager'),
                           ('licenses', 'license'),
                           ('arches', 'arch'),
@@ -214,7 +215,7 @@ def fd_check_func_enter(conduit):
         vattrs = attrs.replace('-', '_')
         if len(getattr(opts, 'filter_' + vattrs)):
             ndata = False
-    if len(opts.filter_yum_groups):
+    if len(opts.filter_groups):
         ndata = False
     
     ret = None
@@ -227,9 +228,10 @@ def fd_check_func_enter(conduit):
 
     # FIXME: delPackage() only works for updates atm.
     valid_list_cmds = ["list", "info"]
-    for cmd in ["vendors", 'groups', 'packagers', 'licenses', 'arches',
+    for cmd in ["vendors", 'rpm-groups', 'packagers', 'licenses', 'arches',
                 'committers', 'buildhosts', 'baseurls', 'package-sizes',
-                'archive-sizes', 'installed-sizes', 'security', 'sec']:
+                'archive-sizes', 'installed-sizes', 'security', 'sec',
+                'groups']:
         valid_list_cmds.append("list-" + cmd)
         valid_list_cmds.append("info-" + cmd)
 
@@ -297,7 +299,7 @@ def exclude_hook(conduit):
             pkgs.extend(data.updates)
             del data
 
-    if opts.filter_yum_groups:
+    if opts.filter_groups:
         fd_make_group_data(conduit._base, opts)
     tot = 0
     cnt = 0
@@ -338,7 +340,7 @@ def preresolve_hook(conduit):
                      (tspkg.po, tspkg.po.repoid, which[0]))
         tsinfo.remove(tspkg.pkgtup)
 
-    if opts.filter_yum_groups:
+    if opts.filter_groups:
         fd_make_group_data(conduit._base, opts)
     tot = 0
     cnt = 0
@@ -371,7 +373,7 @@ def config_hook(conduit):
         return
 
     parser.values.filter_vendors         = []
-    parser.values.filter_groups          = []
+    parser.values.filter_rpm_groups      = []
     parser.values.filter_packagers       = []
     parser.values.filter_licenses        = []
     parser.values.filter_arches          = []
@@ -381,17 +383,19 @@ def config_hook(conduit):
     parser.values.filter_packages_sizes  = []
     parser.values.filter_archive_sizes   = []
     parser.values.filter_installed_sizes = []
-    parser.values.filter_yum_groups      = []
-    def ogroups(opt, key, val, parser):
-        parser.values.filter_groups.extend(str(val).split(","))
+    parser.values.filter_groups          = []
     def make_sopt(attrs):
+        attrs = attrs.replace("-", "_")
         def func(opt, key, val, parser):
             vals = str(val).split(",")
+            vals = filter(len, vals)
             getattr(parser.values, 'filter_' + attrs).extend(vals)
         return func
     def make_nopt(attrs):
+        attrs = attrs.replace("-", "_")
         def func(opt, key, val, parser):
             vals = str(val).replace(",", " ").split()
+            vals = filter(len, vals)
             getattr(parser.values, 'filter_' + attrs).extend(vals)
         return func
     def make_szopt(attrs):
@@ -407,6 +411,7 @@ def config_hook(conduit):
                     x = x[:-1]
                 return int(x) * mul
             vals = str(val).replace(",", " ").split()
+            vals = filter(len, vals)
             for val in vals:
                 rang = val.split("-")
                 if len(rang) > 2:
@@ -422,7 +427,7 @@ def config_hook(conduit):
 
     # These have spaces in their values, so we can't split on space
     for (attrs, attr) in [('vendors', 'vendor'),
-                          ('groups', 'group'),
+                          ('rpm-groups', 'group'),
                           ('packagers', 'packager'),
                           ('licenses', 'license'),
                           ('committers', 'committer')]:
@@ -446,8 +451,8 @@ def config_hook(conduit):
                           % attr)
 
     # This is kind of odd man out, but...
-    parser.add_option('--filter-yum-groups', action="callback",
-                      callback=make_sopt('yum_groups'),default=[],type="string",
+    parser.add_option('--filter-groups', action="callback",
+                      callback=make_sopt('groups'),default=[],type="string",
                       help='Filter to packages within a matching yum group')
 
 if __name__ == '__main__':
diff --git a/plugins/list-data/list-data.py b/plugins/list-data/list-data.py
index b84fb1b..539290c 100755
--- a/plugins/list-data/list-data.py
+++ b/plugins/list-data/list-data.py
@@ -270,7 +270,7 @@ def config_hook(conduit):
     '''
 
     for data in [('vendors', 'vendor'),
-                 ('groups', 'group'),
+                 ('rpm-groups', 'group'),
                  ('packagers', 'packager'),
                  ('licenses', 'license'),
                  ('arches', 'arch'),
@@ -285,7 +285,7 @@ def config_hook(conduit):
     _list_data_custom(conduit, ('installed-sizes', 'installedsize'),
                       size_get_data)
     
-    _list_data_custom(conduit, ('yum-groups', conduit._base),
+    _list_data_custom(conduit, ('groups', conduit._base),
                       yum_group_get_data,
                       beg=yum_group_make_data, end=yum_group_free_data)
     



More information about the Yum-cvs-commits mailing list