[csw-devel] SF.net SVN: gar:[20500] csw/mgar/gar/v2/lib/python/safe_remove_package.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat Mar 23 13:15:23 CET 2013
Revision: 20500
http://gar.svn.sourceforge.net/gar/?rev=20500&view=rev
Author: wahwah
Date: 2013-03-23 12:15:22 +0000 (Sat, 23 Mar 2013)
Log Message:
-----------
safe-remove-package: Display progress
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/safe_remove_package.py
Modified: csw/mgar/gar/v2/lib/python/safe_remove_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/safe_remove_package.py 2013-03-23 12:15:09 UTC (rev 20499)
+++ csw/mgar/gar/v2/lib/python/safe_remove_package.py 2013-03-23 12:15:22 UTC (rev 20500)
@@ -41,6 +41,7 @@
UNSTABLE = "unstable"
+EVERY_N_DOTS = 100
class Error(Exception):
"""A generic error."""
@@ -55,7 +56,7 @@
self.rest_client = rest.RestClient()
self.cp = rest.CachedPkgstats("pkgstats")
- def MakeRevIndex(self, catrel, arch, osrel):
+ def MakeRevIndex(self, catrel, arch, osrel, quiet=False):
key = (catrel, arch, osrel)
if key in self.cached_catalogs:
return
@@ -64,8 +65,12 @@
with open(fn, "r") as fd:
self.cached_catalogs[key] = cjson.decode(fd.read())
return
+ logging.info(
+ "Building a database of reverse dependencies. "
+ "This can take up to multiple hours.")
catalog = self.rest_client.GetCatalog(*key)
rev_deps = {}
+ counter = 0
for pkg_simple in catalog:
md5 = pkg_simple["md5_sum"]
# pkg = self.cp.GetPkgstats(md5)
@@ -74,6 +79,11 @@
for dep_pkgname, _ in short_data["deps"]:
rev_dep_set = rev_deps.setdefault(dep_pkgname, list())
rev_dep_set.append((md5, pkgname))
+ if not quiet and not counter % EVERY_N_DOTS:
+ sys.stdout.write(".")
+ sys.stdout.flush()
+ counter += 1
+ sys.stdout.write("\n")
self.cached_catalogs[key] = rev_deps
with open(fn, "w") as fd:
fd.write(cjson.encode(self.cached_catalogs[key]))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list