Commit 5ff5d29e authored by James Antill's avatar James Antill

Minor speedup when filtering on committer as well as another thing(s)

parent 80de68b2
...@@ -85,14 +85,30 @@ def fd_free_group_data(): ...@@ -85,14 +85,30 @@ def fd_free_group_data():
def fd_should_filter_pkg(base, opts, pkg, used_map): def fd_should_filter_pkg(base, opts, pkg, used_map):
""" Do the package filtering for. """ """ 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'), for (attrs, attr) in [('vendors', 'vendor'),
('rpm-groups', 'group'), ('rpm-groups', 'group'),
('packagers', 'packager'), ('packagers', 'packager'),
('licenses', 'license'), ('licenses', 'license'),
('arches', 'arch'), ('arches', 'arch'),
('committers', 'committer'),
('buildhosts', 'buildhost'), ('buildhosts', 'buildhost'),
('urls', 'url')]: ('urls', 'url'), # The above are all in primary
('committers', 'committer')]
pats = getattr(opts, 'filter_' + attrs.replace('-', '_')) pats = getattr(opts, 'filter_' + attrs.replace('-', '_'))
filt = len(pats) filt = len(pats)
if not filt: # Don't load the data needed for all the attrs. 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): ...@@ -106,22 +122,6 @@ def fd_should_filter_pkg(base, opts, pkg, used_map):
if filt: if filt:
return (attrs, attr) 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 len(opts.filter_groups):
if pkg.name not in all_yum_grp_mbrs: if pkg.name not in all_yum_grp_mbrs:
return ('groups', None) return ('groups', None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment