aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <major@homeonderanged.org>2012-03-19 10:11:05 -0500
committerMark Ferrell <major@homeonderanged.org>2012-03-19 10:27:52 -0500
commit34f6a2391ca010b94c44aea942eab59a1aa3cac9 (patch)
treef9604566c2e0859bde3784c3890a300605457587
parent70a647598838ec47e244ccd12696cd2684747517 (diff)
Execute scripts with set -e.
* In order to avoid the entire "cmd || exit 1" scripting habbit on every line I am attempting tomodify the scripts so that they execute with set -e. Alas, this poses some interesting problems with pipes.
-rwxr-xr-xbin/build2
-rwxr-xr-xbin/builder/build-archive27
-rwxr-xr-xbin/builder/build-compile2
3 files changed, 22 insertions, 9 deletions
diff --git a/bin/build b/bin/build
index eeef4e5..0a8cfca 100755
--- a/bin/build
+++ b/bin/build
@@ -123,6 +123,8 @@ import()
L="${BUILDER_PKGDIR}/${NAME}/log"
}
+set -e
+
##
# Argument parsing
if [ "$#" -eq "0" ]; then
diff --git a/bin/builder/build-archive b/bin/builder/build-archive
index 34ed116..6616dea 100755
--- a/bin/builder/build-archive
+++ b/bin/builder/build-archive
@@ -2,24 +2,35 @@
import "${1}"
-ARCHIVE_TMP=
+ARCHIVE_TMP1=
+ARCHIVE_TMP2=
cleanup()
{
- [ -f "${ARCHIVE_TMP}" ] && rm -f "${ARCHIVE_TMP}"
+ [ -f "${ARCHIVE_TMP1}" ] && rm -f "${ARCHIVE_TMP1}"
+ [ -f "${ARCHIVE_TMP2}" ] && rm -f "${ARCHIVE_TMP2}"
+ exit 0
}
trap cleanup EXIT
+set -e
+ARCHIVE_TMP1="$(mktemp /tmp/${NAME}-${VERSION}.XXXXXXXX)"
+ARCHIVE_TMP2="$(mktemp /tmp/${NAME}-${VERSION}.XXXXXXXX)"
-ARCHIVE_TMP="$(mktemp /tmp/${NAME}-${VERSION}.XXXXXXXX)"
-
-[ -f "${ARCHIVE_TMP}" ] || die "failed to create temporary archive for package '${NAME}'"
+[ -f "${ARCHIVE_TMP1}" ] || die "failed to create temporary archive for package '${NAME}'"
+[ -f "${ARCHIVE_TMP2}" ] || die "failed to create temporary archive for package '${NAME}'"
case "${ARCHIVE_FORMAT}" in
-(tbz2|tar.bz2) ARCHIVE_COMPRESSOR="bzip2 -c";;
-(tgz|tar.gz) ARCHIVE_COMPRESSOR="gzip -c";;
+(tbz2|tar.bz2) ARCHIVE_COMPRESSOR="bzip2 -cv";;
+(tgz|tar.gz) ARCHIVE_COMPRESSOR="gzip -cv";;
(*) die "unsupported archive format '${ARCHIVE_FORMAT}'";;
esac
-cd "${D}" && tar c . | ${ARCHIVE_COMPRESSOR} > "${ARCHIVE_TMP}" && mv "${ARCHIVE_TMP}" "${BUILDER_ATFDIR}/${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
+cd "${D}"
+tar -cvf "${ARCHIVE_TMP1}" . > "${L}/archive.log" 2>&1
+${ARCHIVE_COMPRESSOR} "${ARCHIVE_TMP1}" > "${ARCHIVE_TMP2}" 2>> "${L}/archive.log"
+if [ -f "${BUILDER_ATFDIR}/${NAME}-${VERSION}.${ARCHIVE_FORMAT}" ]; then
+ rm -f "${BUILDER_ATFDIR}/${NAME}-${VERSION}.${ARCHIVE_FORMAT}"
+fi
+mv -v "${ARCHIVE_TMP2}" "${BUILDER_ATFDIR}/${NAME}-${VERSION}.${ARCHIVE_FORMAT}" >> "${L}/archive.log" 2>&1
# vim: filetype=sh
diff --git a/bin/builder/build-compile b/bin/builder/build-compile
index 0480fee..d190e49 100755
--- a/bin/builder/build-compile
+++ b/bin/builder/build-compile
@@ -35,6 +35,6 @@ if [ -f "${L}/compile.log" ]; then
fi
touch "${L}/compile.log"
-(cd "${S}" && pkg_compile > "${L}/compile.log" 2>&1 && date --utc > ${L}/.compiled)
+(set -e;cd "${S}" && pkg_compile > "${L}/compile.log" 2>&1 && date --utc > ${L}/.compiled)
# vim: filetype=sh