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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Dec 26 12:34:20 CET 2012


Revision: 19963
          http://gar.svn.sourceforge.net/gar/?rev=19963&view=rev
Author:   wahwah
Date:     2012-12-26 11:34:20 +0000 (Wed, 26 Dec 2012)
Log Message:
-----------
checkpkg: If hachoir fails, exit early

If hachoir_parser fails to get the machine_id, do not even complete the data
collection, as the collected metadata are useless anyway.

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

Modified: csw/mgar/gar/v2/lib/python/inspective_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package.py	2012-12-26 11:33:54 UTC (rev 19962)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py	2012-12-26 11:34:20 UTC (rev 19963)
@@ -60,8 +60,15 @@
       logging.warning("Can't parse file %s", file_path)
     else:
       try:
+        machine_id = parser["/header/machine"].value
+      except hachoir_core.field.field.MissingField, e:
+        logging.fatal(
+            "hachoir_parser failed to retrieve machine_id for %r. "
+            "checkpkg cannot continue.",
+            file_info)
+        raise
+      try:
         file_info["mime_type_by_hachoir"] = parser.mime_type
-        machine_id = parser["/header/machine"].value
         file_info["machine_id"] = machine_id
         file_info["endian"] = parser["/header/endian"].display
       except hachoir_core.field.field.MissingField, e:

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