classes/insane.bbclass: Do not follow links, fix the issue that made koen add bb...
authorHolger Freyther <zecke@selfish.org>
Wed, 21 Feb 2007 22:48:55 +0000 (22:48 +0000)
committerHolger Freyther <zecke@selfish.org>
Wed, 21 Feb 2007 22:48:55 +0000 (22:48 +0000)
    udev has a link to host binaries, do not check the architecture
    of these binaries. We will skip all links for now for the two
    reasons:
        -We either point to a file in our package and then we will
         check it anyway
        -It is a file for a another package, which will be checked
         anyway
    Make architecture mismatch a fatal/insane error and return False.
    This should fix the issue koen has seen when he added a bb.fatal
    the make_fatal_error method returns true if the error should be
    made fatal, in this case our checks need to set sane to False.
    The return not makes sure this is happening.

classes/insane.bbclass

index c950c1e..ed6d4d0 100644 (file)
@@ -250,10 +250,15 @@ def package_qa_check_arch(path,name,d):
     """
     Check if archs are compatible
     """
-    import bb
+    import bb, os
     target_os   = bb.data.getVar('TARGET_OS',   d, True)
     target_arch = bb.data.getVar('TARGET_ARCH', d, True)
 
+    # avoid following links to /usr/bin (e.g. on udev builds)
+    # we will check the files pointed to anyway...
+    if os.path.islink(path):
+        return True
+
     #if this will throw an exception, then fix the dict above
     (machine, osabi, abiversion, littleendian, bits32) = package_qa_get_machine_dict()[target_os][target_arch]
     elf = package_qa_get_elf(path, bits32)
@@ -263,15 +268,14 @@ def package_qa_check_arch(path,name,d):
         # just for debbugging to check the parser, remove once convinced...
         return True
 
-    sane = True
     if not machine == elf.machine():
         bb.error("Architecture did not match (%d to %d) on %s" %(machine, elf.machine(), package_qa_clean_path(path,d)))
-        sane = package_qa_make_fatal_error( 4, name, path, d )
+        return not package_qa_make_fatal_error( 4, name, path, d )
     elif not littleendian == elf.isLittleEndian():
         bb.error("Endiannes did not match (%d to %d) on %s" % (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d)))
-        sane = package_qa_make_fatal_error( 4, name, path, d )
+        return not package_qa_make_fatal_error( 4, name, path, d )
 
-    return sane
+    return True
 
 def package_qa_check_pcla(path,name,d):
     """