[csw-devel] SF.net SVN: gar:[21018] csw/mgar/gar/v2/lib/python/pkgdb.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue May 7 00:58:09 CEST 2013


Revision: 21018
          http://gar.svn.sourceforge.net/gar/?rev=21018&view=rev
Author:   wahwah
Date:     2013-05-06 22:58:08 +0000 (Mon, 06 May 2013)
Log Message:
-----------
pkgdb: Progressbar for catalog import

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2013-05-06 22:57:59 UTC (rev 21017)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2013-05-06 22:58:08 UTC (rev 21018)
@@ -13,6 +13,7 @@
 import database
 import datetime
 import getpass
+import itertools
 import logging
 import models as m
 import optparse
@@ -20,6 +21,7 @@
 import os.path
 import package_checks
 import package_stats
+import progressbar
 import re
 import shell
 import socket
@@ -307,6 +309,10 @@
       logging.info("Adding srv4 files to the %s %s %s catalog.",
                    osrel, arch, catrel)
       db_catalog = checkpkg_lib.Catalog()
+      pbar = progressbar.ProgressBar()
+      pbar.maxval = len(md5_sums_to_add)
+      pbar.start()
+      counter = itertools.count(1)
       for md5 in md5_sums_to_add:
         logging.debug("Adding %s", cat_entry_by_md5[md5]["file_basename"])
         sqo_srv4 = m.Srv4FileStats.selectBy(md5_sum=md5).getOne()
@@ -327,6 +333,7 @@
           logging.warning(
               "Could not insert %s (%s) into the database. %s",
               sqo_srv4.basename, sqo_srv4.md5_sum, e)
+        pbar.update(counter.next())
 
 
   def SyncFromCatalogTree(self, catrel, base_dir, force_unpack=False):

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