more minor cleanup in the build system

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2-merge1
Leah Rowe 2024-05-19 08:14:57 +01:00 committed by Leah Rowe
parent 10ecf41ee0
commit 4783c5b90e
1 changed files with 6 additions and 15 deletions

21
build
View File

@ -26,7 +26,7 @@ main()
[ $# -lt 1 ] && $err "Check $projectname documentation for help." [ $# -lt 1 ] && $err "Check $projectname documentation for help."
spath="script/$1" spath="script/$1"
[ "$1" = "dependencies" ] && x_ install_packages $@ && xbmk_exit 0 [ "$1" = "dependencies" ] && x_ install_packages $@ && return 0
which git 1>/dev/null 2>/dev/null || \ which git 1>/dev/null 2>/dev/null || \
git_err "git not installed. please install git-scm." git_err "git not installed. please install git-scm."
@ -45,7 +45,6 @@ main()
[ -f "${spath}" ] || $err "Bad command. Check docs." [ -f "${spath}" ] || $err "Bad command. Check docs."
shift 1; "$spath" $@ || $err "excmd: ${spath} ${@}" ;; shift 1; "$spath" $@ || $err "excmd: ${spath} ${@}" ;;
esac esac
xbmk_exit 0
} }
install_packages() install_packages()
@ -61,9 +60,8 @@ install_packages()
. "config/dependencies/${2}" . "config/dependencies/${2}"
x_ ${pkg_add} ${pkglist} x_ $pkg_add $pkglist && [ -n "$aur_notice" ] && \
[ -z "${aur_notice}" ] && return 0 printf "Please install AUR packages: %s\n" "$aur_notice" 1>&2; return 0
printf "You must install AUR packages: %s\n" "$aur_notice" 1>&2
} }
git_init() git_init()
@ -118,13 +116,11 @@ build_release()
) || $err "can't create release files" ) || $err "can't create release files"
git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \
--abbrev-commit > "${srcdir}/CHANGELOG" || \ --abbrev-commit > "${srcdir}/CHANGELOG" || $err "!gitlog $srcdir"
$err "build_release $srcdir: couldn't generate changelog"
( (
cd "${srcdir%/*}" || $err "${_xm}: mktarball \"${srcdir}\"" cd "${srcdir%/*}" || $err "${_xm}: mktarball \"${srcdir}\""
mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || \ mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || $err "$_xm: mksrc"
$err "$_xm: mksrc"
) || $err "can't create src tarball" ) || $err "can't create src tarball"
[ "${mode}" = "src" ] && return 0 [ "${mode}" = "src" ] && return 0
@ -152,12 +148,6 @@ fetch_trees()
rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm" rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
} }
xbmk_exit()
{
tmp_cleanup || err_ "xbmk_exit: can't rm tmpdir upon exit $1: $tmpdir"
exit $1
}
fail() fail()
{ {
tmp_cleanup || printf "WARNING: can't rm tmpdir: %s\n" "$tmpdir" 1>&2 tmp_cleanup || printf "WARNING: can't rm tmpdir: %s\n" "$tmpdir" 1>&2
@ -171,3 +161,4 @@ tmp_cleanup()
} }
main $@ main $@
tmp_cleanup || err_ "can't rm tmpdir upon non-zero exit: $tmpdir"