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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Dec 23 11:24:48 CET 2012


Revision: 19947
          http://gar.svn.sourceforge.net/gar/?rev=19947&view=rev
Author:   wahwah
Date:     2012-12-23 10:24:48 +0000 (Sun, 23 Dec 2012)
Log Message:
-----------
checkpkg: When hachoir fails, display a msg

It used to be a cryptic stack trace. Let's display an informative error
message instead.

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

Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils.py	2012-12-23 00:04:39 UTC (rev 19946)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils.py	2012-12-23 10:24:48 UTC (rev 19947)
@@ -47,6 +47,10 @@
   pass
 
 
+class DataInconsistencyError(Error):
+  """Inconsistency in the data."""
+
+
 def ParseLibPath(directory):
   arch_subdirs = (SPARCV8_PATHS + SPARCV8PLUS_PATHS + SPARCV9_PATHS
                   + INTEL_386_PATHS + AMD64_PATHS)
@@ -227,6 +231,14 @@
     if mimetype in file_info["mime_type"]:
       is_a_binary = True
       break
+  if is_a_binary and not "machine_id" in file_info:
+    raise DataInconsistencyError(
+        "'machine_id' not found in file_info: %r. checkpkg can't continue, "
+        "but it's not a problem with checkpkg; it's a problem with the underlying "
+        "libraries. In this case it's the hachoir library, which failed to "
+        "detect the processor type for this binary. A workaround for it "
+        "could be building the binary again, e.g. 'mgar clean package'."
+        % file_info)
   return is_a_binary
 
 

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