From abc9463ef435cee5a52889cde390b11cc50fadaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 8 May 2006 22:00:32 +0000 Subject: [PATCH] * 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 --- pisi/component.py | 2 +- pisi/operations.py | 7 +++++-- pisi/repodb.py | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pisi/component.py b/pisi/component.py index 4bc570b8..f0c07f46 100644 --- a/pisi/component.py +++ b/pisi/component.py @@ -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) diff --git a/pisi/operations.py b/pisi/operations.py index e329c0a5..0abace81 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -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')) diff --git a/pisi/repodb.py b/pisi/repodb.py index bb48b22f..58994be1 100644 --- a/pisi/repodb.py +++ b/pisi/repodb.py @@ -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