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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 20 10:43:41 CET 2012


Revision: 16841
          http://gar.svn.sourceforge.net/gar/?rev=16841&view=rev
Author:   wahwah
Date:     2012-01-20 09:43:41 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
pkgdb: A better error message for a common problem

There are some scenarios when package metadata aren't imported properly, and
a run of pkgdb results in a permission denied error. Try to display a better
error message when that happens.

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	2012-01-20 09:43:05 UTC (rev 16840)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2012-01-20 09:43:41 UTC (rev 16841)
@@ -438,8 +438,20 @@
         logger=logging,
         debug=options.debug)
     file_list = args
-    stats_list = collector.CollectStatsFromFiles(file_list, None,
-        force_unpack=options.force_unpack)
+    try:
+      stats_list = collector.CollectStatsFromFiles(file_list, None,
+          force_unpack=options.force_unpack)
+    except sqlobject.dberrors.OperationalError, e:
+      exception_msg = ("DELETE command denied to user "
+                       "'pkg_maintainer'@'192.168.1.2' for table 'csw_file'")
+      if exception_msg in str(e):
+        logging.fatal(
+            "You don't have sufficient privileges to overwrite previously "
+            "imported package. Did you run checkpkg before running "
+            "csw-upload-pkg?")
+        sys.exit(1)
+      else:
+        raise e
     for stats in stats_list:
       logging.debug(
           "Importing %s, %s",

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