* fix: handle case when no repo specified remove_item
by finding which repo the guy is from * fix: remove item from, dr, too
This commit is contained in:
@@ -465,9 +465,9 @@ def virtual_install(metadata, files, txn):
|
||||
# normally this can't be true. Just for backwards compatibility
|
||||
# TODO: for speed only ctx.installdb.install exception can be
|
||||
# handled but this is much cleaner
|
||||
if ctx.installdb.is_installed(pkg.name, txn):
|
||||
if ctx.installdb.is_installed(pkg.name, txn=txn):
|
||||
if __is_virtual_upgrade(metadata):
|
||||
ctx.installdb.remove(pkg.name, txn)
|
||||
ctx.installdb.remove(pkg.name, txn=txn)
|
||||
ctx.packagedb.remove_package(pkg.name, txn=txn)
|
||||
ctx.filesdb.remove_files(ctx.installdb.files(pkg.name), txn=txn)
|
||||
else:
|
||||
@@ -486,7 +486,7 @@ def virtual_install(metadata, files, txn):
|
||||
|
||||
# filesdb
|
||||
if files:
|
||||
ctx.filesdb.add_files(metadata.package.name, files, txn)
|
||||
ctx.filesdb.add_files(metadata.package.name, files, txn=txn)
|
||||
|
||||
# installed packages
|
||||
ctx.packagedb.add_package(pkginfo, pisi.itembyrepodb.installed, txn=txn)
|
||||
|
||||
@@ -109,7 +109,8 @@ class ItemByRepoDB(object):
|
||||
repostr = self.repo_str(repo)
|
||||
if s.has_key(repostr):
|
||||
return (s[repostr], repo)
|
||||
return None
|
||||
raise NotfoundError(_('Key %s in repo %s not found') % (name, repo))
|
||||
#return None
|
||||
|
||||
return self.d.txn_proc(proc, txn)
|
||||
|
||||
@@ -144,7 +145,10 @@ class ItemByRepoDB(object):
|
||||
def remove_item(self, name, repo, txn = None):
|
||||
name = str(name)
|
||||
def proc(txn):
|
||||
s = self.d.get(name, txn)
|
||||
if repo:
|
||||
s = self.d.get(name, txn)
|
||||
else:
|
||||
s, repo = self.get_item_repo(name, txn=txn)
|
||||
repostr = self.repo_str(repo)
|
||||
if s.has_key(repostr):
|
||||
del s[repostr]
|
||||
|
||||
+2
-2
@@ -115,9 +115,9 @@ class PackageDB(object):
|
||||
def remove_package(self, name, repo = None, txn = None):
|
||||
name = str(name)
|
||||
def proc(txn):
|
||||
package_info = self.d.get_item_repo(name, repo, txn)
|
||||
package_info = self.d.get_item(name, repo, txn)
|
||||
self.d.remove_item(name, repo, txn)
|
||||
#FIXME: what's happening to dr?
|
||||
self.dr.remove_item(name, repo, txn)
|
||||
#WORKAROUND: do not remove component if it is not in repo
|
||||
if type(repo)==types.StringType:
|
||||
ctx.componentdb.remove_package(package_info.partOf, package_info.name, txn)
|
||||
|
||||
Reference in New Issue
Block a user