From 57adbc6eb1f961ee9116904b667f30efb3f2de4f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 23 Aug 2023 18:56:31 +0100 Subject: unify err functions across scripts include/err.sh this new handling also does mundane things, such as tell you what script b0rked Signed-off-by: Leah Rowe --- resources/scripts/build/boot/roms | 7 ++----- resources/scripts/build/boot/roms_helper | 6 +----- resources/scripts/build/clean/crossgcc | 8 ++------ resources/scripts/build/descriptors/ich9m | 8 ++------ resources/scripts/build/grub/utils | 8 ++------ resources/scripts/build/release/roms | 8 ++------ resources/scripts/build/release/src | 7 ++----- resources/scripts/build/src/for | 8 ++------ 8 files changed, 15 insertions(+), 45 deletions(-) (limited to 'resources/scripts/build') diff --git a/resources/scripts/build/boot/roms b/resources/scripts/build/boot/roms index 44b7cb8e..f634918e 100755 --- a/resources/scripts/build/boot/roms +++ b/resources/scripts/build/boot/roms @@ -29,6 +29,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + projectname="$(cat projectname)" opts="" boards= @@ -116,9 +118,4 @@ buildrom() { ./build boot roms_helper ${1}${opts} } -err() { - printf '%s\n' "${1}" 1>&2 - exit 1 -} - main $@ diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index f78c7cc8..462b9403 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -30,11 +30,7 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e -err() -{ - printf "ERROR: build/boot/roms: %s\n" "${1}" 1>&2 - exit 1 -} +. "include/err.sh" projectname="$(cat projectname)" diff --git a/resources/scripts/build/clean/crossgcc b/resources/scripts/build/clean/crossgcc index 8c61dd5f..76de1e19 100755 --- a/resources/scripts/build/clean/crossgcc +++ b/resources/scripts/build/clean/crossgcc @@ -22,6 +22,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + main() { printf "Cleaning crossgcc builds in all coreboot archives\n" @@ -34,10 +36,4 @@ main() done } -err() -{ - printf "%s: %s\n" $0 $1 - exit 1 -} - main $@ diff --git a/resources/scripts/build/descriptors/ich9m b/resources/scripts/build/descriptors/ich9m index 221131af..40d95d42 100755 --- a/resources/scripts/build/descriptors/ich9m +++ b/resources/scripts/build/descriptors/ich9m @@ -19,6 +19,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + ich9gen="util/ich9utils/ich9gen" main() @@ -36,10 +38,4 @@ main() ) } -err() -{ - printf "%s: %s\n" $0 $1 - exit 1 -} - main $@ diff --git a/resources/scripts/build/grub/utils b/resources/scripts/build/grub/utils index 3e379472..dbe14bc0 100755 --- a/resources/scripts/build/grub/utils +++ b/resources/scripts/build/grub/utils @@ -22,6 +22,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + main() { printf "Building GRUB\n" @@ -41,10 +43,4 @@ build_grub() ) } -err() -{ - printf "%s: error: %s\n" $0 $1 - exit 1 -} - main $@ diff --git a/resources/scripts/build/release/roms b/resources/scripts/build/release/roms index ca0e9fe7..2f9524c5 100755 --- a/resources/scripts/build/release/roms +++ b/resources/scripts/build/release/roms @@ -21,6 +21,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + projectname="$(cat projectname)" version="version-unknown" versiondate="version-date-unknown" @@ -165,10 +167,4 @@ strip_rom_image() ${cbfstool} "${romfile}" remove -n "pci10de,06eb.rom" || exit 1 } -err() -{ - printf "%s: %s\n" $0 $1 - exit 1 -} - main $@ diff --git a/resources/scripts/build/release/src b/resources/scripts/build/release/src index ba09a3d3..3f9feb9b 100755 --- a/resources/scripts/build/release/src +++ b/resources/scripts/build/release/src @@ -21,6 +21,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + projectname="$(cat projectname)" trees_fetch_list="coreboot u-boot" @@ -161,9 +163,4 @@ create_release_archive() ) } -err() -{ - printf "%s: %s\n" $0 $1 -} - main $@ diff --git a/resources/scripts/build/src/for b/resources/scripts/build/src/for index 6761f160..57459952 100755 --- a/resources/scripts/build/src/for +++ b/resources/scripts/build/src/for @@ -21,6 +21,8 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +. "include/err.sh" + mode="" project="" @@ -61,10 +63,4 @@ main() || err "cannot clean project src, ${project}" } -err() -{ - printf "ERROR: build/src: %s\n" "${1}" 1>&2 - exit 1 -} - main $@ -- cgit v1.2.1