diff options
Diffstat (limited to 'meta/classes/insane.bbclass')
| -rw-r--r-- | meta/classes/insane.bbclass | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index d8cc679283..6d82e4df88 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -75,87 +75,6 @@ def package_qa_get_machine_dict(): | |||
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | # factory for a class, embedded in a method | ||
| 79 | def package_qa_get_elf(path, bits32): | ||
| 80 | class ELFFile: | ||
| 81 | EI_NIDENT = 16 | ||
| 82 | |||
| 83 | EI_CLASS = 4 | ||
| 84 | EI_DATA = 5 | ||
| 85 | EI_VERSION = 6 | ||
| 86 | EI_OSABI = 7 | ||
| 87 | EI_ABIVERSION = 8 | ||
| 88 | |||
| 89 | # possible values for EI_CLASS | ||
| 90 | ELFCLASSNONE = 0 | ||
| 91 | ELFCLASS32 = 1 | ||
| 92 | ELFCLASS64 = 2 | ||
| 93 | |||
| 94 | # possible value for EI_VERSION | ||
| 95 | EV_CURRENT = 1 | ||
| 96 | |||
| 97 | # possible values for EI_DATA | ||
| 98 | ELFDATANONE = 0 | ||
| 99 | ELFDATA2LSB = 1 | ||
| 100 | ELFDATA2MSB = 2 | ||
| 101 | |||
| 102 | def my_assert(self, expectation, result): | ||
| 103 | if not expectation == result: | ||
| 104 | #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) | ||
| 105 | raise Exception("This does not work as expected") | ||
| 106 | |||
| 107 | def __init__(self, name): | ||
| 108 | self.name = name | ||
| 109 | |||
| 110 | def open(self): | ||
| 111 | self.file = file(self.name, "r") | ||
| 112 | self.data = self.file.read(ELFFile.EI_NIDENT+4) | ||
| 113 | |||
| 114 | self.my_assert(len(self.data), ELFFile.EI_NIDENT+4) | ||
| 115 | self.my_assert(self.data[0], chr(0x7f) ) | ||
| 116 | self.my_assert(self.data[1], 'E') | ||
| 117 | self.my_assert(self.data[2], 'L') | ||
| 118 | self.my_assert(self.data[3], 'F') | ||
| 119 | if bits32 : | ||
| 120 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) | ||
| 121 | else: | ||
| 122 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) | ||
| 123 | self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) | ||
| 124 | |||
| 125 | self.sex = self.data[ELFFile.EI_DATA] | ||
| 126 | if self.sex == chr(ELFFile.ELFDATANONE): | ||
| 127 | raise Exception("self.sex == ELFDATANONE") | ||
| 128 | elif self.sex == chr(ELFFile.ELFDATA2LSB): | ||
| 129 | self.sex = "<" | ||
| 130 | elif self.sex == chr(ELFFile.ELFDATA2MSB): | ||
| 131 | self.sex = ">" | ||
| 132 | else: | ||
| 133 | raise Exception("Unknown self.sex") | ||
| 134 | |||
| 135 | def osAbi(self): | ||
| 136 | return ord(self.data[ELFFile.EI_OSABI]) | ||
| 137 | |||
| 138 | def abiVersion(self): | ||
| 139 | return ord(self.data[ELFFile.EI_ABIVERSION]) | ||
| 140 | |||
| 141 | def isLittleEndian(self): | ||
| 142 | return self.sex == "<" | ||
| 143 | |||
| 144 | def isBigEngian(self): | ||
| 145 | return self.sex == ">" | ||
| 146 | |||
| 147 | def machine(self): | ||
| 148 | """ | ||
| 149 | We know the sex stored in self.sex and we | ||
| 150 | know the position | ||
| 151 | """ | ||
| 152 | import struct | ||
| 153 | (a,) = struct.unpack(self.sex+"H", self.data[18:20]) | ||
| 154 | return a | ||
| 155 | |||
| 156 | return ELFFile(path) | ||
| 157 | |||
| 158 | |||
| 159 | # Known Error classes | 78 | # Known Error classes |
| 160 | # 0 - non dev contains .so | 79 | # 0 - non dev contains .so |
| 161 | # 1 - package contains a dangerous RPATH | 80 | # 1 - package contains a dangerous RPATH |
