* fix: report all repositories of a component, not just the first

This commit is contained in:
Eray Özkural
2006-05-07 14:04:28 +00:00
parent 7f623ba3a3
commit 94962c2bc3
3 changed files with 20 additions and 5 deletions
+2 -3
View File
@@ -637,10 +637,9 @@ Usage: info <package1> <package2> ... <packagen>
for arg in self.args:
if ctx.componentdb.has_component(arg):
component, repo = ctx.componentdb.get_component_repo(arg)
component = ctx.componentdb.get_union_comp(arg)
#if self.options.long:
if repo != pisi.itembyrepodb.installed:
ctx.ui.info(unicode(component))
ctx.ui.info(unicode(component))
else: # then assume it was a package
self.info_package(arg)
self.finalize()
+14
View File
@@ -119,6 +119,20 @@ class ComponentDB(object):
except pisi.itembyrepodb.NotfoundError, e:
raise Error(_('Component %s not found') % name)
def get_union_comp(self, name, txn = None, tracking = False):
"""get a union of all repository components packages, not just the first repo in order.
get only basic repo info from the first repo"""
def proc(txn):
s = self.d.d.get(name, txn=txn)
pkgs = set()
for repostr in self.d.order(tracking = tracking):
if s.has_key(repostr):
pkgs |= set(s[repostr].packages)
comp = self.get_component(name)
comp.packages = list(pkgs)
return comp
return self.d.txn_proc(proc, txn)
def list_components(self, repo=None, show_tracking=False):
return self.d.list(repo, show_tracking=show_tracking)
+4 -2
View File
@@ -80,9 +80,11 @@ class ItemByRepoDB(object):
return [ k for k,data in self.d.items() if pred(k, data)]
# TODO: carry this to repodb, really :/
def order(self):
def order(self, tracking = True):
import pisi.repodb
order = [ 'repo-' + x for x in ctx.repodb.list() ] + ['trdparty', 'inst']
order = [ 'repo-' + x for x in ctx.repodb.list() ]
if tracking:
order += ['trdparty', 'inst']
return order
# def list_repo(self, repo):