From 12a139ee5fb29a727c330fa61372f3d8d5fe7ab7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 3 Nov 2013 12:33:22 -0500 Subject: treepkg: internationalize (sometimes changing the format of a message) Changes in message format: - Terminal-titles now begin with capital letters - "error!" -> "Error!" - "done" -> "Done" - signal handler errors changed from (treepkg) MESSAGE (leftovers on BUILDDIR) to treepkg: MESSAGE (leftovers on BUILDDIR) --- src/treepkg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/treepkg') diff --git a/src/treepkg b/src/treepkg index 5c1312d..f7cc338 100755 --- a/src/treepkg +++ b/src/treepkg @@ -26,8 +26,8 @@ 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 } @@ -79,7 +79,7 @@ guess_repo() { } if [ ! -f PKGBUILD ]; then - error "Missing PKGBUILD ($PWD)" + error "Missing PKGBUILD (%s)" "$PWD" exit 1 fi @@ -179,7 +179,7 @@ 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 @@ -189,7 +189,7 @@ if [ ${DEPTH} -eq 0 ]; then # Skip if already built (faster than calling is_build again) 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 $? -- cgit v1.2.3-2-g168b From 7dbe6410f501a748759866cab89253c799001c57 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 3 Nov 2013 12:33:53 -0500 Subject: treepkg: obey $TMPDIR --- src/treepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/treepkg') diff --git a/src/treepkg b/src/treepkg index f7cc338..6dc9dda 100755 --- a/src/treepkg +++ b/src/treepkg @@ -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)) -- cgit v1.2.3-2-g168b From b20b7b03053f94499085a4570a241428b5676ce2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 4 Nov 2013 11:23:01 -0500 Subject: normalize on "[[" instead of "[" --- src/treepkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/treepkg') diff --git a/src/treepkg b/src/treepkg index 6dc9dda..0f6d605 100755 --- a/src/treepkg +++ b/src/treepkg @@ -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,7 +78,7 @@ guess_repo() { basename "$(dirname "${1}")" } -if [ ! -f PKGBUILD ]; then +if [[ ! -f PKGBUILD ]]; then error "Missing PKGBUILD (%s)" "$PWD" exit 1 fi @@ -175,7 +175,7 @@ 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 @@ -185,9 +185,9 @@ if [ ${DEPTH} -eq 0 ]; then # 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 %s" "${_pkg/_/ }" || true -- cgit v1.2.3-2-g168b From 6a395c595a1aff501f5edc6b726e929476331b56 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 4 Nov 2013 11:25:50 -0500 Subject: treepkg: fail early if there is a configuration error --- src/treepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/treepkg') diff --git a/src/treepkg b/src/treepkg index 0f6d605..e509dac 100755 --- a/src/treepkg +++ b/src/treepkg @@ -19,7 +19,7 @@ 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)" -- cgit v1.2.3-2-g168b