From 84e15e5d1872f9d171ba662724cf6b123e080a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Tue, 22 May 2007 16:25:50 +0000 Subject: [PATCH] [merge] cleanup from -catbox branch/remove not used txn @ reload_indices --- pisi/api.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 42f400bd..d52a2a06 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -163,8 +163,6 @@ def list_available(repo = None): return set(ctx.packagedb.list_packages(repo = repo)) def list_upgradable(): - ignore_build = ctx.get_option('ignore_build_no') - return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed()) def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False): @@ -358,14 +356,14 @@ def search_in_packages(terms, packages, repo = pisi.itembyrepodb.all): def check(package): md, files = info(package, True) corrupt = [] - for file in files.list: - if file.hash and file.type != "config" \ - and not os.path.islink('/' + file.path): - ctx.ui.info(_("Checking /%s ") % file.path, noln=True, verbose=True) + for f in files.list: + if f.hash and f.type != "config" \ + and not os.path.islink('/' + f.path): + ctx.ui.info(_("Checking /%s ") % f.path, noln=True, verbose=True) try: - if file.hash != pisi.util.sha1_file('/' + file.path): - corrupt.append(file) - ctx.ui.error(_("\nCorrupt file: %s") % file) + if f.hash != pisi.util.sha1_file('/' + f.path): + corrupt.append(f) + ctx.ui.error(_("\nCorrupt file: %s") % f) else: ctx.ui.info(_("OK"), verbose=True) except pisi.util.FileError,e: @@ -462,7 +460,7 @@ def rebuild_repo(repo): def rebuild_db(files=False): - assert ctx.database == False + assert not ctx.database # Bug 2596 # finds and cleans duplicate package directories under '/var/lib/pisi/package' @@ -513,7 +511,7 @@ def rebuild_db(files=False): percent = progress.update(processed), info = _("Rebuilding package database")) - def reload_indices(txn): + def reload_indices(): index_dir = ctx.config.index_dir() if os.path.exists(index_dir): # it may have been erased, or we may be upgrading from a previous version -- exa for repo in os.listdir(index_dir): @@ -527,7 +525,7 @@ def rebuild_db(files=False): shelve.check_dbversion('filesdbversion', pisi.__filesdbversion__, write=False) except KeyboardInterrupt: raise - except Exception, e: #FIXME: what exception could we catch here, replace with that. + except Exception: #FIXME: what exception could we catch here, replace with that. files = True # exception means the files db version was wrong shelve.init_dbenv(write=True, writeversion=True) destroy(files) # bye bye @@ -543,7 +541,7 @@ def rebuild_db(files=False): clean_duplicates() txn = ctx.dbenv.txn_begin() reload_packages(files, txn) - reload_indices(txn) + reload_indices() txn.commit() ############# FIXME: this was a quick fix. ##############################