[yum-git] 3 commits - plugins/filter-data yum-utils.spec
James Antill
james at linux.duke.edu
Thu Aug 14 15:55:17 UTC 2008
plugins/filter-data/filter-data.py | 49 +++++++++++++++++++++----------------
yum-utils.spec | 2 -
2 files changed, 29 insertions(+), 22 deletions(-)
New commits:
commit 5ff5d29edb86c05044c74f884947c2599280ffcd
Author: James Antill <james at and.org>
Date: Thu Aug 14 11:52:37 2008 -0400
Minor speedup when filtering on committer as well as another thing(s)
diff --git a/plugins/filter-data/filter-data.py b/plugins/filter-data/filter-data.py
index c0d1180..37c9766 100644
--- a/plugins/filter-data/filter-data.py
+++ b/plugins/filter-data/filter-data.py
@@ -85,14 +85,30 @@ def fd_free_group_data():
def fd_should_filter_pkg(base, opts, pkg, used_map):
""" Do the package filtering for. """
+ for (attrs, attr) in [('package-sizes', 'packagesize'),
+ ('archive-sizes', 'archivesize'),
+ ('installed-sizes', 'installedsize')]:
+ rangs = getattr(opts, 'filter_' + attrs.replace('-', '_'))
+ filt = len(rangs)
+ if not filt: # Don't load the data needed for all the attrs.
+ continue
+ data = fd__get_data(pkg, attr, strip=False)
+ for rang in rangs:
+ if data == fd__unknown or range_match(data, rang):
+ used_map[attrs][rang] = True
+ filt = False
+ break
+ if filt:
+ return (attrs, attr)
+
for (attrs, attr) in [('vendors', 'vendor'),
('rpm-groups', 'group'),
('packagers', 'packager'),
('licenses', 'license'),
('arches', 'arch'),
- ('committers', 'committer'),
('buildhosts', 'buildhost'),
- ('urls', 'url')]:
+ ('urls', 'url'), # The above are all in primary
+ ('committers', 'committer')]
pats = getattr(opts, 'filter_' + attrs.replace('-', '_'))
filt = len(pats)
if not filt: # Don't load the data needed for all the attrs.
@@ -106,22 +122,6 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
if filt:
return (attrs, attr)
- for (attrs, attr) in [('package-sizes', 'packagesize'),
- ('archive-sizes', 'archivesize'),
- ('installed-sizes', 'installedsize')]:
- rangs = getattr(opts, 'filter_' + attrs.replace('-', '_'))
- filt = len(rangs)
- if not filt: # Don't load the data needed for all the attrs.
- continue
- data = fd__get_data(pkg, attr, strip=False)
- for rang in rangs:
- if data == fd__unknown or range_match(data, rang):
- used_map[attrs][rang] = True
- filt = False
- break
- if filt:
- return (attrs, attr)
-
if len(opts.filter_groups):
if pkg.name not in all_yum_grp_mbrs:
return ('groups', None)
commit 80de68b2a5488d838782041b51f851edf1330d08
Author: James Antill <james at and.org>
Date: Thu Aug 14 11:50:41 2008 -0400
Use to_str instead of just str() so we don't try and go from unicode to str
diff --git a/plugins/filter-data/filter-data.py b/plugins/filter-data/filter-data.py
index 8d8dd26..c0d1180 100644
--- a/plugins/filter-data/filter-data.py
+++ b/plugins/filter-data/filter-data.py
@@ -26,6 +26,7 @@
# yum --filter-groups='App*/Sys*' list updates
from yum.plugins import TYPE_INTERACTIVE
+from yum.misc import to_unicode, to_utf8, to_str
import fnmatch
@@ -45,12 +46,12 @@ def fd__get_data(pkg, attr, strip=True):
if type(val) == type([]):
return fd__unknown
- tval = str(val).strip()
+ tval = to_str(val).strip()
if tval == "":
return fd__unknown
if strip:
- return tval
+ return to_utf8(tval)
return val
diff --git a/yum-utils.spec b/yum-utils.spec
index d1a967b..04c9b0e 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -222,7 +222,7 @@ installed-sizes.
%package -n yum-filter-data
Summary: Yum plugin to list filter based on package data
Group: System Environment/Base
-Requires: yum >= 3.0.5
+Requires: yum >= 3.2.17
%description -n yum-filter-data
This plugin adds the options --filter- vendors, groups, packagers, licenses,
commit 3ae4b44c80df157d7b33dd808d1f7dfcc95bf9c9
Author: James Antill <james at and.org>
Date: Thu Aug 14 11:41:10 2008 -0400
Allow available/recent list commands.
Don't require other MD download if we aren't using it.
diff --git a/plugins/filter-data/filter-data.py b/plugins/filter-data/filter-data.py
index 76e437e..8d8dd26 100644
--- a/plugins/filter-data/filter-data.py
+++ b/plugins/filter-data/filter-data.py
@@ -94,6 +94,8 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
('urls', 'url')]:
pats = getattr(opts, 'filter_' + attrs.replace('-', '_'))
filt = len(pats)
+ if not filt: # Don't load the data needed for all the attrs.
+ continue
data = fd__get_data(pkg, attr)
for pat in pats:
if data == fd__unknown or fnmatch.fnmatch(data, pat):
@@ -108,6 +110,8 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
('installed-sizes', 'installedsize')]:
rangs = getattr(opts, 'filter_' + attrs.replace('-', '_'))
filt = len(rangs)
+ if not filt: # Don't load the data needed for all the attrs.
+ continue
data = fd__get_data(pkg, attr, strip=False)
for rang in rangs:
if data == fd__unknown or range_match(data, rang):
@@ -221,8 +225,9 @@ def fd_check_func_enter(conduit):
ret = {"skip": ndata, "list_cmd": True,
"ret_pkg_lists": ["updates"] + args[1:]}
- # FIXME: delPackage() only works for updates atm.
- valid_list_cmds = ["list", "info"]
+ # FIXME: delPackage() only works for pkgSack only atm.
+ valid_list_cmds = ["list", "info"]
+ valid_list_sub_cmds = ["updates", "available", "recent"]
for cmd in ["vendors", 'rpm-groups', 'packagers', 'licenses', 'arches',
'committers', 'buildhosts', 'baseurls', 'package-sizes',
'archive-sizes', 'installed-sizes', 'security', 'sec',
@@ -230,7 +235,8 @@ def fd_check_func_enter(conduit):
valid_list_cmds.append("list-" + cmd)
valid_list_cmds.append("info-" + cmd)
- if (len(args) >= 2 and args[0] in valid_list_cmds and args[1] == "updates"):
+ if (len(args) >= 2 and args[0] in valid_list_cmds and
+ args[1] in valid_list_sub_cmds):
ret = {"skip": ndata, "list_cmd": True, "ret_pkg_lists": args[1:]}
if ret:
More information about the Yum-cvs-commits
mailing list