* fix: really remove repo in componentdb when removing a repo

* fix: look at system.base of repo (not installed) in safety switch
  when removing guys
This commit is contained in:
Eray Özkural
2006-05-08 22:00:32 +00:00
parent 3ba560569f
commit abc9463ef4
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ class ComponentDB(object):
def destroy(self):
self.d.destroy()
def has_component(self, name, repo = None, txn = None):
def has_component(self, name, repo = pisi.itembyrepodb.repos, txn = None):
#name = shelve.LockedDBShelf.encodekey(name)
name = str(name)
return self.d.has_key(name, repo, txn)
+5 -2
View File
@@ -492,16 +492,19 @@ def plan_upgrade(A, ignore_build = False):
def remove(A):
"""remove set A of packages from system (A is a list of package names)"""
A = [str(x) for x in A]
# filter packages that are not installed
A_0 = A = expand_components(set(A))
if not ctx.get_option('bypass_safety'):
if ctx.componentdb.has_component('system.base'):
refused = A.intersection(set(ctx.componentdb.get_component('system.base').packages))
systembase = set(ctx.componentdb.get_union_comp('system.base').packages)
refused = A.intersection(systembase)
if refused:
ctx.ui.warning(_('Safety switch: cannot remove the following packages in system.base: ') +
util.strlist(refused))
A = A - set(ctx.componentdb.get_component('system.base').packages)
A = A - systembase
else:
ctx.ui.warning(_('Safety switch: the component system.base cannot be found'))
+1
View File
@@ -100,6 +100,7 @@ class RepoDB(object):
self.d.put("order", list, txn)
ctx.packagedb.remove_repo(name, txn=txn)
ctx.sourcedb.remove_repo(name, txn=txn)
ctx.componentdb.remove_repo(name, txn=txn)
self.d.txn_proc(proc, txn)
db = None