summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/insane.bbclass3
-rw-r--r--meta/classes/uninative.bbclass2
-rw-r--r--meta/lib/oe/qa.py15
3 files changed, 11 insertions, 9 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 61936e1377..b9adea77c8 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -792,9 +792,8 @@ def package_qa_walk(warnfuncs, errorfuncs, skip, package, d):
792 elf = oe.qa.ELFFile(path) 792 elf = oe.qa.ELFFile(path)
793 try: 793 try:
794 elf.open() 794 elf.open()
795 except (IOError, ValueError): 795 except (IOError, oe.qa.NotELFFileError):
796 # IOError can happen if the packaging control files disappear, 796 # IOError can happen if the packaging control files disappear,
797 # ValueError means the file isn't an ELF.
798 elf = None 797 elf = None
799 for func in warnfuncs: 798 for func in warnfuncs:
800 func(path, package, d, elf, warnings) 799 func(path, package, d, elf, warnings)
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index b14cec065e..7e225e6f15 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -80,7 +80,7 @@ python uninative_changeinterp () {
80 elf = oe.qa.ELFFile(f) 80 elf = oe.qa.ELFFile(f)
81 try: 81 try:
82 elf.open() 82 elf.open()
83 except ValueError: 83 except oe.qa.NotELFFileError:
84 continue 84 continue
85 85
86 #bb.warn("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f)) 86 #bb.warn("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f))
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 2ad6c63bdc..4efa21fd80 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -1,3 +1,6 @@
1class NotELFFileError(Exception):
2 pass
3
1class ELFFile: 4class ELFFile:
2 EI_NIDENT = 16 5 EI_NIDENT = 16
3 6
@@ -23,7 +26,7 @@ class ELFFile:
23 def my_assert(self, expectation, result): 26 def my_assert(self, expectation, result):
24 if not expectation == result: 27 if not expectation == result:
25 #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) 28 #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name)
26 raise ValueError("%s is not an ELF" % self.name) 29 raise NotELFFileError("%s is not an ELF" % self.name)
27 30
28 def __init__(self, name, bits = 0): 31 def __init__(self, name, bits = 0):
29 self.name = name 32 self.name = name
@@ -32,7 +35,7 @@ class ELFFile:
32 35
33 def open(self): 36 def open(self):
34 if not os.path.isfile(self.name): 37 if not os.path.isfile(self.name):
35 raise ValueError("%s is not a normal file" % self.name) 38 raise NotELFFileError("%s is not a normal file" % self.name)
36 39
37 self.file = file(self.name, "r") 40 self.file = file(self.name, "r")
38 self.data = self.file.read(ELFFile.EI_NIDENT+4) 41 self.data = self.file.read(ELFFile.EI_NIDENT+4)
@@ -49,24 +52,24 @@ class ELFFile:
49 self.bits = 64 52 self.bits = 64
50 else: 53 else:
51 # Not 32-bit or 64.. lets assert 54 # Not 32-bit or 64.. lets assert
52 raise ValueError("ELF but not 32 or 64 bit.") 55 raise NotELFFileError("ELF but not 32 or 64 bit.")
53 elif self.bits == 32: 56 elif self.bits == 32:
54 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) 57 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32))
55 elif self.bits == 64: 58 elif self.bits == 64:
56 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) 59 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64))
57 else: 60 else:
58 raise ValueError("Must specify unknown, 32 or 64 bit size.") 61 raise NotELFFileError("Must specify unknown, 32 or 64 bit size.")
59 self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) 62 self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) )
60 63
61 self.sex = self.data[ELFFile.EI_DATA] 64 self.sex = self.data[ELFFile.EI_DATA]
62 if self.sex == chr(ELFFile.ELFDATANONE): 65 if self.sex == chr(ELFFile.ELFDATANONE):
63 raise ValueError("self.sex == ELFDATANONE") 66 raise NotELFFileError("self.sex == ELFDATANONE")
64 elif self.sex == chr(ELFFile.ELFDATA2LSB): 67 elif self.sex == chr(ELFFile.ELFDATA2LSB):
65 self.sex = "<" 68 self.sex = "<"
66 elif self.sex == chr(ELFFile.ELFDATA2MSB): 69 elif self.sex == chr(ELFFile.ELFDATA2MSB):
67 self.sex = ">" 70 self.sex = ">"
68 else: 71 else:
69 raise ValueError("Unknown self.sex") 72 raise NotELFFileError("Unknown self.sex")
70 73
71 def osAbi(self): 74 def osAbi(self):
72 return ord(self.data[ELFFile.EI_OSABI]) 75 return ord(self.data[ELFFile.EI_OSABI])