* fix: autoxml: do not intialize XmlFile at all. works somehow!

* fix: do not fail indexing and installation when components are not present
  - blank component created if not present
  - updated with description etc. later
  - call the command update_component rather than add_component suitably
* add reverse dependencies to info command
This commit is contained in:
Eray Özkural
2005-11-15 19:50:58 +00:00
parent 55bc23eeed
commit b55dc17d92
4 changed files with 14 additions and 6 deletions
+5 -1
View File
@@ -21,7 +21,9 @@ import pisi
import pisi.cli import pisi.cli
import pisi.context as ctx import pisi.context as ctx
from pisi.uri import URI from pisi.uri import URI
import pisi.util as util
import pisi.api as api
import pisi.packagedb as packagedb
class Error(pisi.Error): class Error(pisi.Error):
pass pass
@@ -536,6 +538,8 @@ Usage: info <package1> <package2> ... <packagen>
metadata, files = pisi.api.info(arg) metadata, files = pisi.api.info(arg)
ctx.ui.info(unicode(metadata.package)) ctx.ui.info(unicode(metadata.package))
revdeps = [x[0] for x in packagedb.get_rev_deps(arg)]
ctx.ui.info( _('Reverse Dependencies: ') + util.strlist(revdeps) )
if self.options.files or self.options.files_path: if self.options.files or self.options.files_path:
if files: if files:
ctx.ui.info(_('\nFiles:')) ctx.ui.info(_('\nFiles:'))
+6 -3
View File
@@ -91,6 +91,8 @@ class ComponentDB(object):
return self.d.has_key(name) return self.d.has_key(name)
def get_component(self, name): def get_component(self, name):
if not self.has_component(name):
self.d[name] = Component(name = name)
return self.d[name] return self.d[name]
def list_components(self): def list_components(self):
@@ -99,12 +101,13 @@ class ComponentDB(object):
list.append(pkg) list.append(pkg)
return list return list
def add_component(self, component): def update_component(self, component):
if self.d.has_key(component.name):
# preserve the list of packages
component.packages = self.d[component.name].packages
self.d[component.name] = component self.d[component.name] = component
def add_package(self, component_name, package): def add_package(self, component_name, package):
if not self.has_component(component_name):
raise Error(_('Information for component %s not available') % component_name)
component = self.get_component(component_name) component = self.get_component(component_name)
component.packages.append(package) component.packages.append(package)
self.d[component_name] = component # update self.d[component_name] = component # update
+1 -1
View File
@@ -80,7 +80,7 @@ class Index(XmlFile):
pkgdb = packagedb.get_db(repo) pkgdb = packagedb.get_db(repo)
pkgdb.clear() pkgdb.clear()
for comp in self.components: for comp in self.components:
ctx.componentdb.add_component(comp) ctx.componentdb.update_component(comp)
for pkg in self.packages: for pkg in self.packages:
pkgdb.add_package(pkg) pkgdb.add_package(pkg)
+2 -1
View File
@@ -306,7 +306,8 @@ class autoxml(oo.autosuper, oo.autoprop):
#XmlFile.__init__(self, tag = tag) #XmlFile.__init__(self, tag = tag)
#workaround: init only top level xmlfile, not the parts #workaround: init only top level xmlfile, not the parts
if not args.has_key('tag'): if not args.has_key('tag'):
XmlFile.__init__(self, tag = cls.tag) #XmlFile.__init__(self, tag = cls.tag)
pass # disable xmlfile support in constructor entirely!
for base in cls.autoxml_bases: for base in cls.autoxml_bases:
base.__init__(self) base.__init__(self)
#super(cls, self).__init__(tag = tag) cooperative shit disabled for now #super(cls, self).__init__(tag = tag) cooperative shit disabled for now