소스 검색

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>
(cherry picked from commit c5fa9308ea4e3810a7f7d9d0df75cbf090c414c4)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Yann E. MORIN 8 년 전
부모
커밋
e29fa95b83
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      support/scripts/br2-external

+ 3 - 0
support/scripts/br2-external

@@ -40,6 +40,9 @@ main() {
 
 
     exec >"${ofile}"
     exec >"${ofile}"
 
 
+    # Trap any unexpected error to generate a meaningful error message
+    trap "error 'unexpected error while generating ${ofile}\n'" ERR
+
     do_validate ${@//:/ }
     do_validate ${@//:/ }
 
 
     do_${ofmt}
     do_${ofmt}