Bug 8752 - Raising subprocess.CalledProcessError in an eventhandler will exit with 0 for the exit code
Summary: Raising subprocess.CalledProcessError in an eventhandler will exit with 0 for...
Status: VERIFIED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 2.0
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.1 M1
Assignee: Richard Purdie
QA Contact: Bogdan Alexandru Voiculescu
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-12-02 23:42 UTC by Randy Witt
Modified: 2016-01-06 16:24 UTC (History)
3 users (show)

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


Attachments
Test bbclass (182 bytes, text/plain)
2015-12-02 23:42 UTC, Randy Witt
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Witt 2015-12-02 23:42:14 UTC
Created attachment 2885 [details]
Test bbclass

If subprocess.CalledProcessError is raised in an eventhandler, bitbake will exit but the exit code will be 0. It is expected that the exitcode should be non-zero.

Steps to reproduce:

1. Add mytest.bbclass to meta/classes
2. Add INHERIT += "mytest" to local.conf
3. bitbake core-image-minimal

You should see:

('__init__() takes at least 3 arguments (1 given)', <class 'subprocess.CalledProcessError'>, ())%


This was originally discovered when using uninative.bbclass and the loader was missing. I just made a simpler testcase.

Also if you look in bitbake/lib/bb/event.py where the exception is handled on line 33, it seems that it really is the "value" parameter being subprocess.CalledProcessError causing the problem.

If you set "value" to None, or even raise a different exception in the event handler the logger message is displayed, and the exit code is non-zero.
Comment 2 Bogdan Alexandru Voiculescu 2016-01-06 16:24:19 UTC
Verified: no errors on master:
bitbake core-image-minimal
Parsing recipes: 100% |##########################################################################################################################################################| Time: 00:00:10
Parsing of 885 .bb files complete (0 cached, 885 parsed). 1314 targets, 57 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "beaglebone"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0+snapshot-20160106"
TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa8"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp    = "master:2cd061a29a94fdcdfec86732e6bcbb71c12c4afc"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 2215 tasks of which 460 didn't need to be rerun and all succeeded.