* implement an API to find all available packages in repos
* fix: do not remove package from component if we are not removing a package from repository! this is a workaround. the design of packagedb somehow does not look very good :/
This commit is contained in:
@@ -104,6 +104,15 @@ def finalize():
|
||||
ctx.ui.close()
|
||||
ctx.initialized = False
|
||||
|
||||
def list_available():
|
||||
'''returns a set of available package names'''
|
||||
|
||||
available = set()
|
||||
for repo in pisi.context.repodb.list():
|
||||
pkg_db = pisi.packagedb.get_db(repo)
|
||||
available.update(pkg_db.list_packages())
|
||||
return available
|
||||
|
||||
def list_upgradable():
|
||||
ignore_build = ctx.config.options and ctx.config.options.ignore_build_no
|
||||
|
||||
|
||||
+4
-1
@@ -37,6 +37,7 @@ class PackageDB(object):
|
||||
"""PackageDB class provides an interface to the package database
|
||||
using shelf objects"""
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
self.d = shelve.LockedDBShelf('package-%s' % id )
|
||||
self.dr = shelve.LockedDBShelf('revdep-%s' % id )
|
||||
|
||||
@@ -102,7 +103,9 @@ class PackageDB(object):
|
||||
package_info = self.d.get(name, txn)
|
||||
self.d.delete(name, txn)
|
||||
#FIXME: what's happening to dr?
|
||||
ctx.componentdb.remove_package(package_info.partOf, package_info.name, txn)
|
||||
#WORKAROUND: do not remove component if it is not in repo
|
||||
if self.id.startswith('repo'):
|
||||
ctx.componentdb.remove_package(package_info.partOf, package_info.name, txn)
|
||||
self.d.txn_proc(proc, txn)
|
||||
|
||||
packagedbs = {}
|
||||
|
||||
Reference in New Issue
Block a user