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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Apr 26 19:59:13 CEST 2013


Revision: 20871
          http://gar.svn.sourceforge.net/gar/?rev=20871&view=rev
Author:   wahwah
Date:     2013-04-26 17:59:12 +0000 (Fri, 26 Apr 2013)
Log Message:
-----------
csw-upload-pkg: Error msg when pkg unknown

When a package is not in the DB, csw-upload-pkg will not work on the login
host. This is the case for many reasons, including:

- login is a sparc host, and we currently are not able to index intel packages
	on a sparc box
- something's messed up with path searches, so the installed csw-upload-pkg
	utility is unable to find the pkgtrans helper
- not having an indexed package at this point is unusual, so this scenario is
	prone to breaking silently

Therefore, it's better to not even try to index the package, but display an
error message instead, so maintainers have a better idea what to do.

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

Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2013-04-26 14:08:39 UTC (rev 20870)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2013-04-26 17:59:12 UTC (rev 20871)
@@ -79,6 +79,10 @@
   """Unexpected state of workflow, e.g. expected element not found."""
 
 
+class OurInfrastructureSucksError(Error):
+  """Something that would work in a perfect world, but here it doesn't."""
+
+
 class Srv4Uploader(object):
 
   def __init__(self, filenames, rest_url, os_release=None, debug=False,
@@ -118,26 +122,15 @@
     if metadata:
       # Metadata are already in the database.
       return
-    logging.warning("%s (%s) is not known to the database.", filename, md5_sum)
-    bin_dir = os.path.dirname(__file__)
-    pkgdb_executable = os.path.join(bin_dir, "pkgdb")
-    assert os.path.exists(pkgdb_executable), (
-        "Could not find %s. Make sure that the pkgdb executable is "
-        "available \n"
-        "from the same directory as csw-upload-pkg." % pkgdb_executable)
-    args = [pkgdb_executable, "importpkg"]
-    if self.debug:
-      args.append("--debug")
-    args.append(filename)
-    ret = subprocess.call(args)
-    if ret:
-      raise OSError("An error occurred when running %s." % args)
-    # Verify that the import succeeded
-    metadata = self._rest_client.GetPkgByMd5(md5_sum)
-    if not metadata:
-      raise WorkflowError(
-          "Metadata of %s could not be imported into the database."
-          % filename)
+    logging.fatal("%s (%s) is not known to the database.", filename, md5_sum)
+    raise OurInfrastructureSucksError(
+        "The package database doesn't know about your package. "
+        "Normally, packages are checked by GAR automatically right after "
+        "being built. Did you build your package outside the buildfarm? "
+        "Or was your package built a long time ago and not released (so it "
+        "might have been garbage-collected)? If so, the easiest fix is "
+        "to reroll your package on the buildfarm using 'mgar repackage' "
+        "(on both sparc and intel) and submit the newly created package.")
 
 
   def Upload(self):

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