DON'T ASK ME HOW I FIXED THIS

This commit is contained in:
Eray Özkural
2006-03-24 14:19:32 +00:00
parent bbb0fe3abe
commit 43f33a65d0
2 changed files with 14 additions and 11 deletions
+11 -8
View File
@@ -142,13 +142,10 @@ class ItemByRepoDB(object):
self.d.put(name, s, txn) self.d.put(name, s, txn)
self.d.txn_proc(proc, txn) self.d.txn_proc(proc, txn)
def remove_item(self, name, repo, txn = None): def remove_item_repo(self, name, repo, txn = None):
name = str(name) name = str(name)
def proc(txn): def p(txn):
if repo: s = self.d.get(name, txn)
s = self.d.get(name, txn)
else:
s, repo = self.get_item_repo(name, txn=txn)
repostr = self.repo_str(repo) repostr = self.repo_str(repo)
if s.has_key(repostr): if s.has_key(repostr):
del s[repostr] del s[repostr]
@@ -156,10 +153,16 @@ class ItemByRepoDB(object):
self.d.delete(name, txn) self.d.delete(name, txn)
else: else:
self.d.put(name, s, txn) self.d.put(name, s, txn)
self.d.txn_proc(proc, txn) self.d.txn_proc(p, txn)
def remove_item(self, name, txn = None):
def p(txn):
repo = self.which_repo(name, txn=txn)
self.remove_item_repo(name, repo, txn=txn)
self.d.txn_proc(p, txn)
def remove_repo(self, repo, txn = None): def remove_repo(self, repo, txn = None):
def proc(txn): def proc(txn):
for key in self.d.keys(): for key in self.d.keys():
self.remove_item(key, repo, txn=txn) self.remove_item_repo(key, repo, txn=txn)
self.d.txn_proc(proc, txn) self.d.txn_proc(proc, txn)
+2 -2
View File
@@ -84,9 +84,9 @@ class SourceDB(object):
def proc(txn): def proc(txn):
assert self.has_spec(name, txn=txn) assert self.has_spec(name, txn=txn)
spec = self.d.get_item_repo(name, repo, txn) spec = self.d.get_item_repo(name, repo, txn)
self.d.remove_item(name, repo, txn=txn) self.d.remove_item(name, txn=txn)
for pkg in spec.packages: for pkg in spec.packages:
self.dpkgtosrc.remove_item(pkg.name, name, repo, txn) self.dpkgtosrc.remove_item_repo(pkg.name, name, repo, txn)
self.d.txn_proc(proc, txn) self.d.txn_proc(proc, txn)