core/br2-external: properly report unexpected errors
authorYann E. MORIN <yann.morin.1998@free.fr>
Sat, 28 Jan 2017 10:41:32 +0000 (11:41 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 26 Mar 2017 21:44:04 +0000 (23:44 +0200)
commitc5fa9308ea4e3810a7f7d9d0df75cbf090c414c4
treea75c89b705cefccd62d4e52d903364caec8f48bc
parentf30a3940c8dc5fc9bbe3a0ace457201808142183
core/br2-external: properly report unexpected errors

Unextected error in the br2-external script are properly caught, but
they are not reported properly, and we end up in either of two
situations:

  - the .br2-external.mk file is not generated, in which case make will
    try to find a rule to generate it (because the 'include' directive
    tries to generate missing files);

  - the .br-external.mk file is generated but does not contain the error
    variable, and thus the build might not get interrupted.

We fix that by using a trap on the pseudo ERR signal, to emit the error
variable on unexpected errors.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/scripts/br2-external