From c158fd38ae4318cf85451b0a186bc21b2e75fa1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Fri, 29 Jul 2005 15:11:24 +0000 Subject: [PATCH] * install'u tersten orersek, remove yapariz. cok basit! bilibiliblibliib --- pisi/operations.py | 2 +- pisi/packagedb.py | 11 +++++++---- pisi/pgraph.py | 12 ++++++++++++ pisi/toplevel.py | 21 +++++++++++---------- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/pisi/operations.py b/pisi/operations.py index 152ea07e..2f8d73a8 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -60,7 +60,7 @@ def install_single_name(name): pkg = packagedb.get_package(name) ui.info("Installing %s from repository %s\n" %(name, repo)) ui.debug("Package URI: %s\n" % pkg.packageURI) - install_single_uri(pkg.packageURI) + install_single_file(pkg.packageURI) else: ui.error("Package %s not found in the repository file.\n" % pkg) diff --git a/pisi/packagedb.py b/pisi/packagedb.py index 4481efb8..5b441f0f 100644 --- a/pisi/packagedb.py +++ b/pisi/packagedb.py @@ -45,18 +45,21 @@ class PackageDB(object): def get_rev_deps(self, name): name = str(name) - a = self.dr[name] - return a + if self.dr.has_key(name): + return self.dr[name] + else: + return [] def add_package(self, package_info): name = str(package_info.name) self.d[name] = package_info for dep in package_info.runtimeDeps: dep_name = str(dep.package) + print '!!', name, dep.package if self.dr.has_key(dep_name): - self.dr[dep_name].append(dep) + self.dr[dep_name].append( (name, dep) ) else: - self.dr[dep_name] = [dep] + self.dr[dep_name] = [ (name, dep) ] def clear(self): self.d.clear() diff --git a/pisi/pgraph.py b/pisi/pgraph.py index 4a1d30d0..62ed53dc 100644 --- a/pisi/pgraph.py +++ b/pisi/pgraph.py @@ -15,6 +15,18 @@ class PGraph(digraph): pkg1 = packagedb.get_package(pkg) 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 = packagedb.get_package(pkg1name) + pkg1data = (pkg1.version, pkg1.release) + pkg2data = None + if not pkg2name in self.vertices(): + pkg2 = packagedb.get_package(pkg2name) + pkg2data = (pkg2.version, pkg2.release) + self.add_edge(str(pkg1name), str(pkg2name), ('d', None), + pkg1data, pkg2data ) + def add_dep(self, pkg, depinfo): pkg1data = None if not pkg in self.vertices(): diff --git a/pisi/toplevel.py b/pisi/toplevel.py index a160d9e7..dcd0fc45 100644 --- a/pisi/toplevel.py +++ b/pisi/toplevel.py @@ -13,6 +13,7 @@ from ui import ui from purl import PUrl import util, dependency, pgraph, operations, packagedb from repodb import repodb +from installdb import installdb from index import Index def install(packages): @@ -122,22 +123,22 @@ def remove(A): Bp = set() for x in B: pkg = packagedb.get_package(x) - print pkg + print 'processing', pkg.name rev_deps = packagedb.get_rev_deps(x) - for dep in rev_deps: - print 'checking ', dep - # we don't deal with satisfied dependencies - if not dependency.satisfiesDep(dep.package, dep): - if not dep.package in G_f.vertices(): - Bp.add(str(dep.package)) - G_f.add_rev_dep(dep, x) + for (rev_dep, depinfo) in rev_deps: + print 'checking ', rev_dep + # we don't deal with unsatisfied dependencies + if dependency.satisfiesDep(rev_dep, depinfo): + if not rev_dep in G_f.vertices(): + Bp.add(rev_dep) + G_f.add_plain_dep(rev_dep, x) B = Bp G_f.write_graphviz(sys.stdout) l = G_f.topological_sort() print l for x in l: - #operations.remove_single_name(x) - pass + if installdb.is_installed(x): + operations.remove_single(x) return True # everything went OK :)