summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-03 02:16:44 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-03 02:16:44 -0500
commit52cc0c3ff27d4c48d3461d9fd898367aa4a92631 (patch)
treef4d2b4fcfbc1c6cda116b7723ebe2eee774b0cd6 /src
parent3793e4fac9d1d853251e84838caa2b8849d1f32b (diff)
parent58e2a9cd5aa9a4eb80f8da675685f62aca128eb3 (diff)
Merge branch 'master' into xbs
Conflicts: src/lib/conf.sh
Diffstat (limited to 'src')
-rwxr-xr-xsrc/abslibre-tools/createworkdir3
-rwxr-xr-xsrc/abslibre-tools/diff-unfree4
-rwxr-xr-xsrc/abslibre-tools/libreaddiff8
-rwxr-xr-xsrc/abslibre-tools/librerelease10
-rwxr-xr-xsrc/aur18
-rwxr-xr-xsrc/chroot-tools/chcleanup2
-rw-r--r--src/chroot-tools/hooks-distcc.sh2
-rwxr-xr-xsrc/chroot-tools/librechroot6
-rw-r--r--src/chroot-tools/makechrootpkg.sh.patch10
-rwxr-xr-xsrc/fullpkg/fullpkg2
-rwxr-xr-xsrc/fullpkg/fullpkg-build14
-rwxr-xr-xsrc/fullpkg/fullpkg-find13
-rwxr-xr-xsrc/gitget/gitget4
-rwxr-xr-xsrc/is_built21
-rw-r--r--src/lib/conf.sh3
-rw-r--r--src/lib/libremessages.1.ronn8
-rw-r--r--src/librefetch/librefetch.conf2
-rw-r--r--src/librefetch/librefetch.conf.5.ronn2
-rw-r--r--src/libretools.conf6
-rwxr-xr-xsrc/treepkg34
20 files changed, 96 insertions, 76 deletions
diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir
index 8e88375..4421ae2 100755
--- a/src/abslibre-tools/createworkdir
+++ b/src/abslibre-tools/createworkdir
@@ -42,10 +42,11 @@ if ! "${cmd[@]}"; then
plain "Try running this command:"
echo
printf '%q ' "${cmd[@]}"
+ echo
exit 1
fi
msg "Finished, your packaging directory tree looks like this now:"
-ls --color=always "${WORKDIR}"/*/*
+ls --color=always "${WORKDIR}"/*
trap -- EXIT
diff --git a/src/abslibre-tools/diff-unfree b/src/abslibre-tools/diff-unfree
index b3e2327..1ef0649 100755
--- a/src/abslibre-tools/diff-unfree
+++ b/src/abslibre-tools/diff-unfree
@@ -23,7 +23,7 @@
. libremessages
. $(librelib conf.sh)
load_files libretools
-check_vars libretools DIFFTOOL || exit 1
+check_vars libretools DIFFPROG || exit 1
usage() {
print "Usage: %s [community|packages] [unfree-package] [repo]" "${0##*/}"
@@ -80,7 +80,7 @@ main() {
for _file in ${unfree_dir}/*; do
msg2 "%s" "$(basename "${_file}")"
- ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}"
+ ${DIFFPROG} "$PWD/$(basename "${_file}")" "${_file}"
done
}
diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff
index 9f5ae27..ebd749d 100755
--- a/src/abslibre-tools/libreaddiff
+++ b/src/abslibre-tools/libreaddiff
@@ -74,14 +74,14 @@ except StopIteration:
load_PKGBUILD "$f/PKGBUILD" || continue
is_here=false
for arc in ${arch[@]} ; do
- if [ "$arc" = "any" -o "$arc" = "$CARCH" ] ; then
+ if [[ "$arc" == "any" ]] || [[ "$arc" == "$CARCH" ]] ; then
is_here=true
break
fi
done
- if [ "$is_here" = "true" ] ; then
- for name in ${pkgname[@]} ; do
- if [ -z "$epoch" ] ; then
+ if [[ "$is_here" == "true" ]] ; then
+ for name in "${pkgname[@]}" ; do
+ if [[ -z "$epoch" ]] ; then
echo $name-$pkgver-$pkgrel
else
echo $name-$epoch:$pkgver-$pkgrel
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease
index adfb935..b77b6ec 100755
--- a/src/abslibre-tools/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -68,7 +68,7 @@ create_signature() {
SIGNWITHKEY="-u ${GPGKEY}"
fi
# The signature will be generated directly in ascii-friendly format
- gpg --detach-sign --use-agent ${SIGNWITHKEY} "$filename" &>/dev/null || ret=$?
+ gpg --detach-sign --use-agent ${SIGNWITHKEY} "$filename" || ret=$?
if (( ! ret )); then
@@ -80,12 +80,12 @@ create_signature() {
}
sign_packages() {
- if [ -z "${GPG_AGENT_INFO}" ]; then
- warning "It's better to use gpg-agent to sign packages in batches"
+ if [[ -z "${GPG_AGENT_INFO}" ]]; then
+ warning "It's better to have \`%s\` running to sign packages in batches" 'gpg-agent --daemon'
fi
for package in $(find "${WORKDIR}/staging/" -type f -iname '*.pkg.tar.?z'); do
- if [ -f "${package}.sig" ]; then
+ if [[ -f "${package}.sig" ]]; then
msg2 "Package signature found, verifying..."
# Verify that the signature is correct, else remove for re-signing
@@ -95,7 +95,7 @@ sign_packages() {
fi
fi
- if ! [ -f "${package}.sig" ]; then
+ if ! [[ -f "${package}.sig" ]]; then
create_signature "$package" || return 2
fi
done
diff --git a/src/aur b/src/aur
index 6fce891..2d1efbb 100755
--- a/src/aur
+++ b/src/aur
@@ -20,15 +20,15 @@
. libremessages
-cmd=${0##*/}
usage() {
- echo "Usage: $cmd [-h] pkgname-from-aur1 [pkgname-from-aur2 ...]"
+ print "Usage: %s [-h] PKGNAME [PKGNAME2 PKGNAME3...]" "${0##*/}"
+ print "Downloads packages from the AUR, and does basic freedom checks."
echo
- echo "This script will download packages from AUR to the current"
- echo "directory and check their license for nonfree issues. This does"
- echo "not mean that they are free; they may be incorrectly labeled, or"
- echo "have other freedom issues. It's a tool to help Parabola"
- echo "packagers, not to help users install things directly from AUR."
+ prose "This script will download packages from AUR to the current
+ directory and check their license for nonfree issues. This does
+ not mean that they are free; they may be incorrectly labeled, or
+ have other freedom issues. It's a tool to help Parabola
+ packagers, not to help users install things directly from AUR."
}
main() {
@@ -45,7 +45,7 @@ main() {
. $(librelib conf.sh)
load_files libretools
- check_vars libretools DIFFTOOL || exit 1
+ check_vars libretools DIFFPROG || exit 1
local startdir="$(pwd)"
local missing_deps=()
@@ -88,7 +88,7 @@ main() {
if ! cmp -s "${copy_old}/${file}" "${copy_new}/${file}" ; then
warning "%s != %s" "${copy_old}/${file}" "${copy_new}/${file}"
diffed=true
- "${DIFFTOOL}" "${copy_old}/${file}" "${copy_new}/${file}"
+ "${DIFFPROG}" "${copy_old}/${file}" "${copy_new}/${file}"
fi
done
if $diffed; then
diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup
index 0c78989..2ff45f9 100755
--- a/src/chroot-tools/chcleanup
+++ b/src/chroot-tools/chcleanup
@@ -53,7 +53,7 @@ fi
source /etc/libretools.d/chroot.conf
# If we're running makepkg
-if [ -f PKGBUILD ]; then
+if [[ -f PKGBUILD ]]; then
export CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")"
source ./PKGBUILD
CHROOTEXTRAPKG+=("${depends[@]}"
diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh
index 9e42242..d8d708a 100644
--- a/src/chroot-tools/hooks-distcc.sh
+++ b/src/chroot-tools/hooks-distcc.sh
@@ -75,7 +75,7 @@ distcc_stop() {
if [[ -f "$copydir/run/distcc-tool.pid" ]]; then
- odaemon=$(cat "$copydir/distcc-tool.pid")
+ odaemon=$(< "$copydir/distcc-tool.pid")
kill -- "$odaemon"
rm -f -- \
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index b55cae1..5e16587 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -178,7 +178,7 @@ calculate_directories() {
check_mountpoint() {
local file=$1
local mountpoint="$(df -P "$file"|sed '1d;s/.*\s//')"
- local mountopts=($(LANG=C mount|awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
+ local mountopts=($(LC_ALL=C mount|awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
! in_array nosuid "${mountopts[@]}" && ! in_array noexec "${mountopts[@]}"
}
@@ -190,8 +190,8 @@ arch-nspawn() {
if [[ -t 1 ]]; then
cmd=("$@")
else
- # This perl script is equivalent to `sed -s 's|\n|\r\n|g', but
- # it doesn't line-buffer.
+ # This perl script is similar to `sed 's|\n|\r\n|g'`, (or, more
+ # correctly, `sed 's|$|\r|'`) but it does't line-buffer.
local perlcmd='
my $size;
my $buffer;
diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch
index 4082bdd..4dd1146 100644
--- a/src/chroot-tools/makechrootpkg.sh.patch
+++ b/src/chroot-tools/makechrootpkg.sh.patch
@@ -1,5 +1,5 @@
---- makechrootpkg.sh.in 2013-10-15 21:33:17.000000000 -0400
-+++ makechrootpkg.sh.ugly 2013-10-25 19:05:08.000000000 -0400
+--- makechrootpkg.sh.in 2013-10-26 14:53:57.000000000 -0400
++++ makechrootpkg.sh.ugly 2013-11-16 15:14:04.000000000 -0500
@@ -12,6 +12,7 @@
shopt -s nullglob
@@ -92,7 +92,7 @@
# Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
-@@ -154,10 +171,15 @@
+@@ -154,11 +171,16 @@
# Drop the read lock again
lock_close 8
@@ -100,6 +100,7 @@
}
-clean_temporary() {
+- stat_busy "Removing temporary copy [%s]" "$copy"
+# Usage: delete_chroot $copydir [$copy]
+delete_chroot() {
+ local copydir=$1
@@ -107,9 +108,10 @@
+ # Detect chrootdir filesystem type
+ local chroottype=$(stat -f -c %T "$copydir")
+
- stat_busy "Removing temporary copy [%s]" "$copy"
++ stat_busy "Removing chroot copy [%s]" "$copy"
if [[ "$chroottype" == btrfs ]]; then
btrfs subvolume delete "$copydir" >/dev/null ||
+ die "Unable to delete subvolume %s" "$copydir"
@@ -173,9 +195,14 @@
stat_done
}
diff --git a/src/fullpkg/fullpkg b/src/fullpkg/fullpkg
index 00a9502..978cf7b 100755
--- a/src/fullpkg/fullpkg
+++ b/src/fullpkg/fullpkg
@@ -29,7 +29,7 @@ done
shift $(( OPTIND - 1 ))
-build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}"
+build_dir="${1:-$(mktemp --tmpdir -d fullpkg.XXXXXXXXXX)}"
fullpkg-find "$build_dir" && fullpkg-build -N "$build_dir"
exit 0
diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build
index 8149453..e824c2e 100755
--- a/src/fullpkg/fullpkg-build
+++ b/src/fullpkg/fullpkg-build
@@ -45,13 +45,13 @@ remove_buildorder() {
succesfull_build() {
- if [ "$RUN" != "$FULLBUILDCMD" ]; then
+ if [[ "$RUN" != "$FULLBUILDCMD" ]]; then
return 0 # Custom command or download sources
fi
- if source .INFO && [ -n "$repo" ]; then
+ if source .INFO && [[ -n "$repo" ]]; then
- if [ ! -z "$HOOKLOCALRELEASE" ]; then
+ if [[ ! -z "$HOOKLOCALRELEASE" ]]; then
"$HOOKLOCALRELEASE" "$repo"
fi
@@ -75,11 +75,11 @@ __build() {
build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first
- while [ ${#build_packages[@]} -ge 1 ]; do
+ while [[ ${#build_packages[@]} -ge 1 ]]; do
pushd "$build_dir/${build_packages[0]}" >/dev/null
- if [ -n "${HOOKPKGBUILDMOD}" ]; then
+ if [[ -n "${HOOKPKGBUILDMOD}" ]]; then
${HOOKPKGBUILDMOD} || true
fi
@@ -156,7 +156,7 @@ shift $(( OPTIND - 1 ))
build_dir="${1:-`pwd`}"
buildorder="${build_dir}/BUILDORDER"
-if [ ! -e "$buildorder" ]; then
+if [[ ! -e "$buildorder" ]]; then
error "This is not a build_dir. Make one using fullpkg."
usage
exit 1
@@ -172,7 +172,7 @@ fi
msg "$MESSAGE"
__build
-if [ "$RUN" != "$FULLBUILDCMD" ]; then
+if [[ "$RUN" != "$FULLBUILDCMD" ]]; then
# Used for downloading or custom command
mv "$build_dir/.BUILDORDER" "$buildorder"
exit 0
diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find
index 566605a..a96bc8a 100755
--- a/src/fullpkg/fullpkg-find
+++ b/src/fullpkg/fullpkg-find
@@ -104,7 +104,7 @@ find_deps() {
# greater levels are built first
echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER"
# PKGBUILD is already there
- if [ -d "${build_dir}/${pkgbase}" ]; then
+ if [[ -d "${build_dir}/${pkgbase}" ]]; then
exit 0
# Copy dir to build_dir
else
@@ -126,14 +126,15 @@ find_deps() {
tr ' ' "\n" | \
sort -u))
- for _dep in ${deps[@]}; do
+ local _dep
+ for _dep in "${deps[@]}"; do
local found=false
# May fail, e.g. since abslibre-mips64el doesn't include
# arch=any packages.
local pkgdir=$(toru -p ${_dep}) || true
- if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then
+ if [[ -n "$pkgdir" ]] && [[ -d "${pkgdir}" ]; then
found=true
pushd "${pkgdir}" > /dev/null
@@ -193,7 +194,7 @@ while getopts 'hA:l:cmn' arg; do
esac
done
-if [ ! -r PKGBUILD ]; then
+if [[ ! -r PKGBUILD ]]; then
error "This directory doesnt contain a PKGBUILD"
usage
exit 1
@@ -202,11 +203,11 @@ fi
shift $(( OPTIND - 1 ))
build_dir="${1}"
-if [ "$LEVEL" -eq 0 ]; then
+if [[ "$LEVEL" -eq 0 ]]; then
build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}"
- if [ ! -d "$build_dir" ]; then
+ if [[ ! -d "$build_dir" ]]; then
mkdir -p "$build_dir"
elif "$CLEANFIRST"; then
# Erase files already in dir
diff --git a/src/gitget/gitget b/src/gitget/gitget
index 256b4e4..194ec05 100755
--- a/src/gitget/gitget
+++ b/src/gitget/gitget
@@ -191,6 +191,7 @@ main() {
*) usage >&2; return 1;;
esac
done
+ shift $(($OPTIND - 1))
[[ $# == 3 ]] || { usage >&2; return 1; }
local mode=$1
local url=${2#git+}
@@ -198,6 +199,9 @@ main() {
local urlmain=${url%%#*}
local urlfrag=${url#*#}
+ if [[ "$urlfrag" == "$urlmain" ]]; then
+ urlfrag=''
+ fi
local ref=${urlfrag#*=}
if [[ -z $ref ]]; then
diff --git a/src/is_built b/src/is_built
index 80d0719..ba5f061 100755
--- a/src/is_built
+++ b/src/is_built
@@ -1,18 +1,21 @@
#!/usr/bin/env bash
-cmd=${0##*/}
+. libremessages
+
usage() {
- echo "Usage: $cmd [-h] pkgname [pkgver]"
+ print "Usage: %s [-h] PKGNAME [PKGVER]" "${0##*/}" "${0##*/}"
+ print 'Detect iv a given package (version) is already in the repos'
echo
- echo "Detect if a given package version is already in repos"
- echo "Assuming you want greater or equal."
+ prose "If a version is specified, it assumedx that you want a greater or
+ equal version."
echo
- echo "Example usage: $cmd 'pcre' '20'"
+ prose "Example usage:"
+ print " $ %s 'pcre' '20'" "${0##*/}"
echo
- echo "Exit status:"
- echo " 0: The package is built"
- echo " 1: The package has not built"
- echo " >1: There was an error"
+ print "Exit status:"
+ print " 0: The package is built"
+ print " 1: The package has not built"
+ print " >1: There was an error"
}
while getopts 'h' arg; do
diff --git a/src/lib/conf.sh b/src/lib/conf.sh
index 07b6fd5..561ae9e 100644
--- a/src/lib/conf.sh
+++ b/src/lib/conf.sh
@@ -81,6 +81,9 @@ list_envvars() {
PKGEXT SRCEXT \
GPGKEY PACKAGER
;;
+ libretools)
+ printf '%s\n' DIFFPROG
+ ;;
xbs)
printf '%s\n' BUILDSYSTEM
;;
diff --git a/src/lib/libremessages.1.ronn b/src/lib/libremessages.1.ronn
index 970b950..b91a958 100644
--- a/src/lib/libremessages.1.ronn
+++ b/src/lib/libremessages.1.ronn
@@ -51,6 +51,8 @@ the command `help printf` from a Bash shell for more information.
### GENERAL ROUTINES
+Unless otherwise noted, these do not implicitly call `gettext`.
+
* `_` <MESSAGE>:
If `gettext` is available, calls `gettext`, otherwise just prints
the arguments given.
@@ -61,7 +63,7 @@ the command `help printf` from a Bash shell for more information.
* `panic`:
For the times when you can't reasonably continue, similar to
- "assert" in some languages.
+ "assert" in some programming languages.
* `term_title` <MESSAGE>...:
Joins all arguments with whitespace, and sets the terminal title
@@ -72,6 +74,8 @@ the command `help printf` from a Bash shell for more information.
These routines print to standard output, ande are useful for printing
word-wrapped prose.
+For each of these, <MESSAGE> is fed through `gettext` automatically.
+
* `print` <MESSAGE> [<ARGS>...]:
Like `printf`(1), but `gettext`-aware, and automatically prints a
trailing newline.
@@ -102,6 +106,8 @@ These routines print to standard error, and all take arguments in the
same format as `printf`(1), except for `stat_done`, which doesn't take
any arguments.
+For each of these, <MESSAGE> is fed through `gettext` automatically.
+
* `plain` <MESSAGE> [<ARGS>...]:
Prints "plain" message in bold, indented with 4 spaces.
diff --git a/src/librefetch/librefetch.conf b/src/librefetch/librefetch.conf
index 40d2078..ce328d8 100644
--- a/src/librefetch/librefetch.conf
+++ b/src/librefetch/librefetch.conf
@@ -1,2 +1,2 @@
-MIRROR='https://repo.parabolagnulinux.org/sources/'
+MIRROR='https://repo.parabolagnulinux.org/other/'
DOWNLOADER='/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
diff --git a/src/librefetch/librefetch.conf.5.ronn b/src/librefetch/librefetch.conf.5.ronn
index 3d80ab5..4e59877 100644
--- a/src/librefetch/librefetch.conf.5.ronn
+++ b/src/librefetch/librefetch.conf.5.ronn
@@ -24,7 +24,7 @@ If `$XDG_CONFIG_HOME` is not set, a default value is set:
## OPTIONS
- * `MIRROR='https://repo.parabolagnulinux.org/sources/'`:
+ * `MIRROR='https://repo.parabolagnulinux.org/other/'`:
The location to download pre-built source tarball in download
mode.
* `DOWNLOADER='/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'`:
diff --git a/src/libretools.conf b/src/libretools.conf
index 50ded8b..ff989f0 100644
--- a/src/libretools.conf
+++ b/src/libretools.conf
@@ -5,14 +5,14 @@
################################################################################
# The dir where you work on
-WORKDIR=/home/$LIBREUSER/packages
+WORKDIR="$LIBREHOME/packages"
## Blacklist URL
BLACKLIST=https://repo.parabolagnulinux.org/docs/blacklist.txt
## Diff tool (vimdiff, gvimdiff, meld, etc)
## Used by `aur`, `diff-unfree`
-DIFFTOOL=`which kdiff3 meld gvimdiff vimdiff colordiff diff 2>/dev/null|sed 's/\s.*//;1q'`
+DIFFPROG=`which kdiff3 meld gvimdiff vimdiff colordiff diff 2>/dev/null|sed 's/\s.*//;1q'`
## The repos you'll be packaging for
## Used by `toru`, `createworkdir`
@@ -28,7 +28,7 @@ ARCHES=('x86_64' 'i686' 'mips64el')
## ABSLibre
## Used by `createworkdir`
-ABSLIBREREGV=git://projects.parabolagnulinux.org/abslibre.git
+ABSLIBRERECV=git://projects.parabolagnulinux.org/abslibre.git
ABSLIBRESEND=ssh://git@projects.parabolagnulinux.org:1863/srv/git/abslibre.git
################################################################################
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 $?