* rebuild-db progress for package-manager...
This commit is contained in:
+8
-2
@@ -494,11 +494,17 @@ def rebuild_db(files=False):
|
|||||||
ctx.dbenv.dbremove(file=fn, flags=bsddb3.db.DB_AUTO_COMMIT)
|
ctx.dbenv.dbremove(file=fn, flags=bsddb3.db.DB_AUTO_COMMIT)
|
||||||
|
|
||||||
def reload_packages(files, txn):
|
def reload_packages(files, txn):
|
||||||
for package_fn in os.listdir( pisi.util.join_path( ctx.config.lib_dir(),
|
packages = os.listdir(pisi.util.join_path(ctx.config.lib_dir(), 'package'))
|
||||||
'package' ) ):
|
progress = ctx.ui.Progress(len(packages))
|
||||||
|
processed = 0
|
||||||
|
for package_fn in packages:
|
||||||
if not package_fn == "scripts":
|
if not package_fn == "scripts":
|
||||||
ctx.ui.debug('Resurrecting %s' % package_fn)
|
ctx.ui.debug('Resurrecting %s' % package_fn)
|
||||||
pisi.api.resurrect_package(package_fn, files, txn)
|
pisi.api.resurrect_package(package_fn, files, txn)
|
||||||
|
processed += 1
|
||||||
|
ctx.ui.display_progress(operation = "rebuilding-db",
|
||||||
|
percent = progress.update(processed),
|
||||||
|
info = _("Rebuilding package database"))
|
||||||
|
|
||||||
def reload_indices(txn):
|
def reload_indices(txn):
|
||||||
index_dir = ctx.config.index_dir()
|
index_dir = ctx.config.index_dir()
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class CLI(UI):
|
|||||||
|
|
||||||
def display_progress(self, operation, percent, info="", **ka):
|
def display_progress(self, operation, percent, info="", **ka):
|
||||||
""" display progress of any operation """
|
""" display progress of any operation """
|
||||||
if operation == "removing":
|
if operation in ["removing", "rebuilding-db"]:
|
||||||
return
|
return
|
||||||
elif operation == "fetching":
|
elif operation == "fetching":
|
||||||
totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size'])
|
totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size'])
|
||||||
|
|||||||
Reference in New Issue
Block a user