diff --git a/build_image b/build_image index 86f9b0a08c..891aca3d28 100755 --- a/build_image +++ b/build_image @@ -103,7 +103,8 @@ fi # Check that the build root is sane. if [[ ${skip_test_build_root} -ne 1 ]]; then - "${BUILD_LIBRARY_DIR}/test_build_root" --root="${BOARD_ROOT}" + info "Checking build root" + test_image_content "${BOARD_ROOT}" fi # Hack to fix bug where x86_64 CHOST line gets incorrectly added. diff --git a/build_library/test_build_root b/build_library/test_build_root index cac339ea55..57aa6d72cd 100755 --- a/build_library/test_build_root +++ b/build_library/test_build_root @@ -6,12 +6,13 @@ SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..) . "${SCRIPT_ROOT}/common.sh" || exit 1 +. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 # We're invoked only by build_image, which runs in the chroot assert_inside_chroot # Flags -DEFINE_string root "" \ +DEFINE_string root "${DEFAULT_BOARD+/build/${DEFAULT_BOARD}}" \ "The root file system to check." # Parse command line @@ -21,26 +22,8 @@ eval set -- "${FLAGS_ARGV}" # Die on any errors switch_to_strict_mode -# Check all parts of a pipe -set -o pipefail - -ROOT="$FLAGS_root" -if [[ ! -d "$ROOT" ]]; then - die_notrace "Root FS does not exist ($ROOT)" +if [[ ! -d "$FLAGS_root" ]]; then + die_notrace "Root FS does not exist ($FLAGS_root)" fi -ROOT_BINARIES=( - /boot/vmlinuz - /bin/sed -) - -EXITCODE=0 -for i in "${BINARIES[@]}"; do - i="${ROOT}${i}" - if ! [[ -f $i ]]; then - error "cannot find $i" - EXITCODE=1 - fi -done - -exit $EXITCODE +test_image_content "$FLAGS_root" diff --git a/build_packages b/build_packages index 785b5306fd..81d3926cd1 100755 --- a/build_packages +++ b/build_packages @@ -128,6 +128,7 @@ fi # set BOARD and BOARD_ROOT . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1 +. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 # Setup all the emerge command/flags. EMERGE_FLAGS=( -uDNv --backtrack=30 --select ) @@ -209,9 +210,11 @@ fi info "Merging board packages now" sudo -E "${EMERGE_CMD[@]}" "${EMERGE_FLAGS[@]}" "${PACKAGES[@]}" +info "Checking build root" +test_image_content "${BOARD_ROOT}" + # upload packages if enabled upload_packages -echo "Builds complete" +info "Builds complete" command_completed -echo "Done"