* 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
|
# normally this can't be true. Just for backwards compatibility
|
||||||
# TODO: for speed only ctx.installdb.install exception can be
|
# TODO: for speed only ctx.installdb.install exception can be
|
||||||
# handled but this is much cleaner
|
# 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):
|
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.packagedb.remove_package(pkg.name, txn=txn)
|
||||||
ctx.filesdb.remove_files(ctx.installdb.files(pkg.name), txn=txn)
|
ctx.filesdb.remove_files(ctx.installdb.files(pkg.name), txn=txn)
|
||||||
else:
|
else:
|
||||||
@@ -486,7 +486,7 @@ def virtual_install(metadata, files, txn):
|
|||||||
|
|
||||||
# filesdb
|
# filesdb
|
||||||
if files:
|
if files:
|
||||||
ctx.filesdb.add_files(metadata.package.name, files, txn)
|
ctx.filesdb.add_files(metadata.package.name, files, txn=txn)
|
||||||
|
|
||||||
# installed packages
|
# installed packages
|
||||||
ctx.packagedb.add_package(pkginfo, pisi.itembyrepodb.installed, txn=txn)
|
ctx.packagedb.add_package(pkginfo, pisi.itembyrepodb.installed, txn=txn)
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ class ItemByRepoDB(object):
|
|||||||
repostr = self.repo_str(repo)
|
repostr = self.repo_str(repo)
|
||||||
if s.has_key(repostr):
|
if s.has_key(repostr):
|
||||||
return (s[repostr], repo)
|
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)
|
return self.d.txn_proc(proc, txn)
|
||||||
|
|
||||||
@@ -144,7 +145,10 @@ class ItemByRepoDB(object):
|
|||||||
def remove_item(self, name, repo, txn = None):
|
def remove_item(self, name, repo, txn = None):
|
||||||
name = str(name)
|
name = str(name)
|
||||||
def proc(txn):
|
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)
|
repostr = self.repo_str(repo)
|
||||||
if s.has_key(repostr):
|
if s.has_key(repostr):
|
||||||
del s[repostr]
|
del s[repostr]
|
||||||
|
|||||||
+2
-2
@@ -115,9 +115,9 @@ class PackageDB(object):
|
|||||||
def remove_package(self, name, repo = None, txn = None):
|
def remove_package(self, name, repo = None, txn = None):
|
||||||
name = str(name)
|
name = str(name)
|
||||||
def proc(txn):
|
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)
|
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
|
#WORKAROUND: do not remove component if it is not in repo
|
||||||
if type(repo)==types.StringType:
|
if type(repo)==types.StringType:
|
||||||
ctx.componentdb.remove_package(package_info.partOf, package_info.name, txn)
|
ctx.componentdb.remove_package(package_info.partOf, package_info.name, txn)
|
||||||
|
|||||||
Reference in New Issue
Block a user