* install'u tersten orersek, remove yapariz. cok basit!
bilibiliblibliib
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
|
||||
+7
-4
@@ -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()
|
||||
|
||||
@@ -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():
|
||||
|
||||
+11
-10
@@ -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 :)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user