[2/2] insane: display names instead of ELF machine numbers

Message ID 1476188384-16064-2-git-send-email-ross.burton@intel.com
State Accepted
Commit 607a2a1de4b77818c3e801a4de7ff0888229e036
Headers show

Commit Message

Ross Burton Oct. 11, 2016, 12:19 p.m.
The 'arch' QA test currently simply outputs the ELF machine field as a number
which isn't helpful.  Display this as a human-readable name to make it clearer
to the user what the problem is.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/insane.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.8.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Ross Burton Oct. 11, 2016, 12:36 p.m. | #1
On 11 October 2016 at 13:26, Gary Thomas <gary@mlbassoc.com> wrote:

> Did you mean to swap the items?  The old version used

>   machine, elf.machine()

> and this version uses

>   elf.machine(), machine

>


Yes, because the string format changed to be clearer too:

-        package_qa_add_message(messages, "arch", "Architecture did not
match (%d to %d) on %s" % \
-                 (machine, elf.machine(), package_qa_clean_path(path,d)))
+        package_qa_add_message(messages, "arch", "Architecture did not
match (%s, expected %s) on %s" % \
+                 (oe.qa.elf_machine_to_string(elf.machine()),
oe.qa.elf_machine_to_string(machine),

The old message would say "20 to 62", the new message is "x86-64, expected
PowerPC".

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b347638..17c9284 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -543,8 +543,8 @@  def package_qa_check_arch(path,name,d, elf, messages):
     # Check the architecture and endiannes of the binary
     if not ((machine == elf.machine()) or \
         ((("virtual/kernel" in provides) or bb.data.inherits_class("module", d) ) and (target_os == "linux-gnux32" or target_os == "linux-gnun32"))):
-        package_qa_add_message(messages, "arch", "Architecture did not match (%d to %d) on %s" % \
-                 (machine, elf.machine(), package_qa_clean_path(path,d)))
+        package_qa_add_message(messages, "arch", "Architecture did not match (%s, expected %s) on %s" % \
+                 (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path,d)))
     elif not ((bits == elf.abiSize()) or  \
         ((("virtual/kernel" in provides) or bb.data.inherits_class("module", d) ) and (target_os == "linux-gnux32" or target_os == "linux-gnun32"))):
         package_qa_add_message(messages, "arch", "Bit size did not match (%d to %d) %s on %s" % \