summaryrefslogtreecommitdiff
path: root/src/treepkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/treepkg')
-rwxr-xr-xsrc/treepkg34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/treepkg b/src/treepkg
index 5c1312d..e509dac 100755
--- a/src/treepkg
+++ b/src/treepkg
@@ -19,15 +19,15 @@ source libremessages
source $(librelib conf.sh)
load_files libretools
-check_vars libretools HOOKPREBUILD FULLBUILDCMD HOOKLOCALRELEASE
+check_vars libretools HOOKPREBUILD FULLBUILDCMD HOOKLOCALRELEASE || exit 1
load_files makepkg
term_title "$(basename $0)"
# End inmediately but print an useful message
trap_exit() {
- term_title "error!"
- error "($(basename $0)) $@ (leftovers on ${BUILDDIR})"
+ term_title "${0##*/}: $(_ 'Error!')"
+ error "%s: %s (leftovers on %s" "${0##*/}" "$*" "${BUILDDIR}"
exit 1
}
@@ -59,10 +59,10 @@ bury() {
# If there's a depth or the package is not the root of the build tree (which
# can lead to funny chicken-and-egg problems), update the depth to the current
# package next-depth and rename the dir too
- if [ -z "${current_depth}" ]; then return; fi
- if [ -z "${current_name}" ]; then return; fi
- if [ ${current_depth} -eq 0 ]; then return; fi
- if [ ${current_depth} -ge $2 ]; then return; fi
+ if [[ -z "${current_depth}" ]]; then return; fi
+ if [[ -z "${current_name}" ]]; then return; fi
+ if [[ ${current_depth} -eq 0 ]]; then return; fi
+ if [[ ${current_depth} -ge $2 ]]; then return; fi
${VERBOSE} && msg "Burying ${1} from ${current_depth} to ${2}"
@@ -78,8 +78,8 @@ guess_repo() {
basename "$(dirname "${1}")"
}
-if [ ! -f PKGBUILD ]; then
- error "Missing PKGBUILD ($PWD)"
+if [[ ! -f PKGBUILD ]]; then
+ error "Missing PKGBUILD (%s)" "$PWD"
exit 1
fi
@@ -103,7 +103,7 @@ done
pkgbase="${pkgbase:-${pkgname[0]}}"
# Get or set the work dir
-BUILDDIR="${1:-$(mktemp -d /tmp/${pkgbase}-treepkg-XXXx)}"
+BUILDDIR="${1:-$(mktemp --tmpdir -d ${pkgbase}-treepkg.XXXXXXXXXX)}"
BUILDORDER="${BUILDDIR}/BUILDORDER"
DEPTH=${2:-0}
NEXTDEPTH=$((${DEPTH} + 1))
@@ -175,21 +175,21 @@ if ! ${BUILDNOW}; then
fi
# Only build at the end
-if [ ${DEPTH} -eq 0 ]; then
+if [[ ${DEPTH} -eq 0 ]]; then
${VERBOSE} && msg "Starting build" || true
if ${BUILD}; then
- ${VERBOSE} && msg "Build tree stored in ${BUILDORDER}" || true
+ ${VERBOSE} && msg "Build tree stored in %s" "${BUILDORDER}" || true
# Build everything sorting the build dir
# The reverse order ensures we start by the deepest packages
for _pkg in $(ls -r "${BUILDDIR}"); do
# Ignore if there's no PKGBUILD
- if [ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]; then continue; fi
+ if [[ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]]; then continue; fi
# Skip if already built (faster than calling is_build again)
- if [ -f "${BUILDDIR}/${_pkg}/built_ok" ]; then continue; fi
+ if [[ -f "${BUILDDIR}/${_pkg}/built_ok" ]]; then continue; fi
- ${VERBOSE} && msg "Building ${_pkg/_/ }" || true
+ ${VERBOSE} && msg "Building %s" "${_pkg/_/ }" || true
# Remove leading zeros and space if any
term_title "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")"
@@ -214,11 +214,11 @@ if [ ${DEPTH} -eq 0 ]; then
fi
if ${CLEANUP} ; then
- msg2 "Removing ${BUILDDIR}"
+ msg2 "Removing %s" "${BUILDDIR}"
rm -rf "${BUILDDIR}"
fi
fi
-term_title "done"
+term_title "$(_ Done)"
exit $?