* fix: do not fail info command if files.xml is not available

* fix: add missing repo parameter to PGraph (necessary because you
  might want to look at a specific repo, or only installed guys,
  or only repos, etc.)
* fix: look at only graph of installed repo when considering remove op
* fix: catch and translate exception in download of readxml
This commit is contained in:
Eray Özkural
2006-05-08 21:24:42 +00:00
parent 3e75ac1f62
commit 3ba560569f
4 changed files with 22 additions and 14 deletions
+5 -1
View File
@@ -287,7 +287,11 @@ def info_name(package_name, installed=False):
metadata.source = None
#TODO: fetch the files from server if possible (wow, you maniac -- future exa)
if installed and ctx.installdb.is_installed(package.name):
files = ctx.installdb.files(package.name)
try:
files = ctx.installdb.files(package.name)
except pisi.Error, e:
ctx.ui.warning(e)
files = None
else:
files = None
return metadata, files
+2 -2
View File
@@ -114,7 +114,7 @@ in the respective order to satisfy extra dependencies:
install_pkg_names(extra_packages)
class PackageDB:
def get_package(self, key):
def get_package(self, key, repo = None):
return d_t[str(key)]
packagedb = PackageDB()
@@ -546,7 +546,7 @@ def plan_remove(A):
# try to construct a pisi graph of packages to
# install / reinstall
G_f = pgraph.PGraph(ctx.packagedb) # construct G_f
G_f = pgraph.PGraph(ctx.packagedb, pisi.itembyrepodb.installed) # construct G_f
# find the (install closure) graph of G_f by package
# set A using packagedb
+11 -10
View File
@@ -18,22 +18,23 @@ from graph import *
class PGraph(Digraph):
def __init__(self, packagedb):
def __init__(self, packagedb, repo = pisi.itembyrepodb.repos):
super(PGraph, self).__init__()
self.packagedb = packagedb
self.repo = repo
def add_package(self, pkg):
pkg1 = self.packagedb.get_package(pkg)
pkg1 = self.packagedb.get_package(pkg, self.repo)
self.add_vertex(str(pkg), (pkg1.version, pkg1.release))
def add_plain_dep(self, pkg1name, pkg2name):
pkg1data = None
if not pkg1name in self.vertices():
pkg1 = self.packagedb.get_package(pkg1name)
pkg1 = self.packagedb.get_package(pkg1name, self.repo)
pkg1data = (pkg1.version, pkg1.release)
pkg2data = None
if not pkg2name in self.vertices():
pkg2 = self.packagedb.get_package(pkg2name)
pkg2 = self.packagedb.get_package(pkg2name, self.repo)
pkg2data = (pkg2.version, pkg2.release)
self.add_edge(str(pkg1name), str(pkg2name), ('d', None),
pkg1data, pkg2data )
@@ -41,11 +42,11 @@ class PGraph(Digraph):
def add_dep(self, pkg, depinfo):
pkg1data = None
if not pkg in self.vertices():
pkg1 = self.packagedb.get_package(pkg)
pkg1 = self.packagedb.get_package(pkg, self.repo)
pkg1data = (pkg1.version, pkg1.release)
pkg2data = None
if not depinfo.package in self.vertices():
pkg2 = self.packagedb.get_package(depinfo.package)
pkg2 = self.packagedb.get_package(depinfo.package, self.repo)
pkg2data = (pkg2.version, pkg2.release)
self.add_edge(str(pkg), str(depinfo.package), ('d', depinfo),
pkg1data, pkg2data )
@@ -53,11 +54,11 @@ class PGraph(Digraph):
def add_rev_dep(self, depinfo, pkg):
pkg1data = None
if not pkg in self.vertices():
pkg1 = self.packagedb.get_package(depinfo.package)
pkg1 = self.packagedb.get_package(depinfo.package, self.repo)
pkg1data = (pkg1.version, pkg1.release)
pkg2data = None
if not depinfo.package in self.vertices():
pkg2 = self.packagedb.get_package(pkg)
pkg2 = self.packagedb.get_package(pkg, self.repo)
pkg2data = (pkg2.version, pkg2.release)
self.add_edge(str(depinfo.package), str(pkg), ('d', depinfo),
pkg1data, pkg2data )
@@ -65,11 +66,11 @@ class PGraph(Digraph):
def add_conflict(self, pkg, conflinfo):
pkg1data = None
if not pkg in self.vertices():
pkg1 = self.packagedb.get_package(pkg)
pkg1 = self.packagedb.get_package(pkg, self.repo)
pkg1data = (pkg1.version, pkg1.release)
pkg2data = None
if not pkg in self.vertices():
pkg2 = self.packagedb.get_package(conflinfo.package)
pkg2 = self.packagedb.get_package(conflinfo.package, self.repo)
pkg2data = (pkg2.version, pkg2.release)
self.add_biedge(str(pkg), str(conflinfo.package), ('c', conflinfo)
+4 -1
View File
@@ -57,7 +57,10 @@ class XmlFile(object):
def readxml(self, uri, tmpDir='/tmp', sha1sum=False, compress=None, sign=None):
uri = File.make_uri(uri)
localpath = File.download(uri, tmpDir,sha1sum=sha1sum,compress=compress,sign=sign)
try:
localpath = File.download(uri, tmpDir,sha1sum=sha1sum,compress=compress,sign=sign)
except Exception, e:
raise Error(_("Cannot access URI %s") % (uri) )
try:
self.doc = iks.parse(localpath)
return self.doc