From 16264c1877a8df3edca8082db116fc9e68fc9c84 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 14 Nov 2012 22:05:32 -0500 Subject: Add some more error handling to opkbuild. --- (limited to 'src') diff --git a/src/opkbuild.sh b/src/opkbuild.sh index 057ac9a..d72fc60 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -75,7 +75,11 @@ main() if [ "${opt_build}" != 'source' ]; then print_arch_stats - "${opt_check_build_deps}" && '@@BINDIR@@/ob-checkbuilddeps' + if "${opt_check_build_deps}"; then + if ! '@@BINDIR@@/ob-checkbuilddeps'; then + exit 1 + fi + fi setup_build build clean @@ -274,8 +278,12 @@ build_source() esac done - OB_DO_SOURCE='true' '@@BINDIR@@/ob-gencontrol' - OB_DO_SOURCE='true' '@@BINDIR@@/ob-buildopk' + if ! OB_DO_SOURCE='true' '@@BINDIR@@/ob-gencontrol'; then + exit 1 + fi + if ! OB_DO_SOURCE='true' '@@BINDIR@@/ob-buildopk'; then + exit 1 + fi rm -Rf "src-${src}.data" || ob_error "$(ob_get_msg 'cant_rm_src_pkg_data')" } @@ -299,9 +307,16 @@ setup_build() eval "$('@@BINDIR@@/ob-buildenv' | sed 's/^/export /')" - '@@BINDIR@@/ob-unpacksource' - '@@BINDIR@@/ob-applypatches' - '@@BINDIR@@/ob-installplatconf' + if ! '@@BINDIR@@/ob-unpacksource'; then + exit 1 + fi + if ! '@@BINDIR@@/ob-applypatches'; then + # TODO: Remove the ":" after fixing ob-applypatches. + : exit 1 + fi + if ! '@@BINDIR@@/ob-installplatconf'; then + exit 1 + fi } build() @@ -310,21 +325,31 @@ build() '') ../build build ${opt_uid0_cmd} sh -s <<-EOF - ../build install - '@@BINDIR@@/ob-installdocs' - '@@BINDIR@@/ob-gencontrol' + ../build install && \ + '@@BINDIR@@/ob-installdocs' && \ + '@@BINDIR@@/ob-gencontrol' && \ '@@BINDIR@@/ob-buildopk' EOF + if [ ${?} -ne 0 ]; then + exit 1 + fi ;; 'install'|'install-'*) - ${opt_uid0_cmd} ../build "${opt_target}" + if ! ${opt_uid0_cmd} ../build "${opt_target}"; then + exit 1 + fi ;; *) - ../build "${opt_target}" + if ! ../build "${opt_target}"; then + exit 1 + fi ;; esac - : '@@BINDIR@@/ob-genchanges' + # TODO: Remove the ":" when ob-genchanges is implemented. + if ! : '@@BINDIR@@/ob-genchanges'; then + exit 1 + fi } clean() -- cgit v0.9.1