Bug 7662 - Installing binary in allarch recipe causes traceback
Summary: Installing binary in allarch recipe causes traceback
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.8
Hardware: All Multiple
: Medium+ minor
Target Milestone: 1.9 M1
Assignee: Costin
QA Contact: Costin
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-04-27 13:05 UTC by Paul Eggleton
Modified: 2015-09-04 06:46 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Example recipe (172 bytes, text/plain)
2015-06-03 08:42 UTC, Paul Eggleton
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2015-04-27 13:05:12 UTC
If you install a prebuilt binary in a recipe that inherits allarch, you get a nasty traceback:

-------------- snip --------------
ERROR: Error executing a python function in /home/user/poky/meta/recipes-core/example/example.bb:

The stack trace of python calls that resulted in this exception/failure was:
File: 'do_package_qa', lineno: 105, function: <module>
     0101:        bb.fatal("QA run found fatal errors. Please consider fixing them.")
     0102:    bb.note("DONE with PACKAGE QA")
     0103:
     0104:
 *** 0105:do_package_qa(d)
     0106:
File: 'do_package_qa', lineno: 88, function: do_package_qa
     0084:            package_qa_handle_error("pkgname",
     0085:                    "%s doesn't match the [a-z0-9.+-]+ regex\n" % package, d)
     0086:
     0087:        path = "%s/%s" % (pkgdest, package)
 *** 0088:        if not package_qa_walk(path, warnchecks, errorchecks, skip, package, d):
     0089:            walk_sane  = False
     0090:        if not package_qa_check_rdepends(package, pkgdest, skip, taskdeps, packages, d):
     0091:            rdepends_sane = False
     0092:        if not package_qa_check_deps(package, pkgdest, skip, d):
File: 'insane.bbclass', lineno: 19, function: package_qa_walk
     0015:                elf = None
     0016:            for func in warnfuncs:
     0017:                func(path, package, d, elf, warnings)
     0018:            for func in errorfuncs:
 *** 0019:                func(path, package, d, elf, errors)
     0020:
     0021:    for w in warnings:
     0022:        package_qa_handle_error(w, warnings[w], d)
     0023:    for e in errors:
File: 'insane.bbclass', lineno: 25, function: package_qa_check_arch
     0021:        return
     0022:
     0023:    #if this will throw an exception, then fix the dict above
     0024:    (machine, osabi, abiversion, littleendian, bits) \
 *** 0025:        = package_qa_get_machine_dict()[target_os][target_arch]
     0026:
     0027:    # Check the architecture and endiannes of the binary
     0028:    if not ((machine == elf.machine()) or \
     0029:        ((("virtual/kernel" in provides) or bb.data.inherits_class("module", d) ) and (target_os == "linux-gnux32" or target_os == "linux-gnun32"))):
Exception: KeyError: 'allarch'

ERROR: Function failed: do_package_qa
ERROR: Logfile of failure stored in: /home/user/poky/build/tmp/work/all-poky-linux/example/1.0-r0/temp/log.do_package_qa.17373
ERROR: Task 9 (/home/user/poky/meta/recipes-core/example/example.bb, do_package_qa) failed with exit code '1'
-------------- snip --------------

Obviously this should trigger an error, but it should be a proper error message telling the user what they've done wrong.
Comment 1 Paul Eggleton 2015-06-03 08:42:43 UTC
Created attachment 2536 [details]
Example recipe

Attached an example recipe. This is totally synthetic, but at least triggers the error.
Comment 2 Cristian Iorga 2015-06-03 08:56:13 UTC
Investigation started.
Comment 3 Cristian Iorga 2015-06-08 10:57:37 UTC
Patch sent for review.
Comment 5 Costin 2015-09-03 09:14:22 UTC
Hi,

Did a recipe with the content from comment #1 :
cosscat@ubnt:/media/yp_builds/poky/meta/recipes-core/mytest$ ls
mytest_1a.bb

and created a simple executable /bin/file
cosscat@ubnt:/bin$ ls file
file

after bitbaking the recipe, the process goes well and "file" gets copied in ${D}/${bindir} :
cosscat@ubnt:/media/yp_builds/poky/build/tmp/work/all-poky-linux/mytest/1a-r0/image/usr/bin$ cat test-file 
#/bin/bash

echo "hello"

When i build it though, no err. message is displayed and build goes smooth.
According to the description it should have displayed an error.
Comment 6 Costin 2015-09-03 09:15:00 UTC
Forgot to add, tested on latest master
Comment 7 Paul Eggleton 2015-09-03 15:00:02 UTC
What kind of file is this "file" you are testing with? If it's not a binary (i.e. an executable that isn't a script) then you aren't replicating the case that should trigger the error.
Comment 8 Paul Eggleton 2015-09-03 15:00:55 UTC
Moving to NEEDINFO based on the previous comment.
Comment 9 Costin 2015-09-04 06:46:06 UTC
The file i was using was a script. I created a small hello world alike binary and the issue is reproducing well. My fault in the first place. 

Based on the above will mark as verified.
Comment 10 Costin 2015-09-04 06:46:44 UTC
Marked as verified based on last comment