summaryrefslogtreecommitdiffstats
path: root/abump.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-07-10 07:07:47 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-10 07:14:46 +0000
commite1d629b6c439b35c8f7f4a62a9b65ac4d3f6fd81 (patch)
tree87431cb2dd281373bf0b420878ced2ac329e960d /abump.in
parent5021e13ffa222ac7344285aa90ec183064a5819b (diff)
downloadabuild-e1d629b6c439b35c8f7f4a62a9b65ac4d3f6fd81.tar.bz2
abuild-e1d629b6c439b35c8f7f4a62a9b65ac4d3f6fd81.tar.xz
abump: fix set -e issue
It appears that when the subshell has a ||, the 'set -e' within subshell gets invalidated. This will work as expected: ( set -e; false; echo "should not get here" ) While this will not work as expected: ( set -e; false; echo "should not get here" ) || false We resolve it by using $? to detect the status of subshell. We also let the exitcode indicate how many packages that failed. While here we also refactor it so most of the loop happens within the subshell. This lets us set (or increase) rc variable once, and it reduces number of forks which gives slightly better performance.
Diffstat (limited to 'abump.in')
-rwxr-xr-xabump.in25
1 files changed, 13 insertions, 12 deletions
diff --git a/abump.in b/abump.in
index 2106302..e0242d7 100755
--- a/abump.in
+++ b/abump.in
@@ -25,22 +25,22 @@ do_bump() {
name=${p%-[0-9]*}
ver=${p#${name}-}
- # calculate APKBUILD's path
+ (
+ set -e
+
+ # calculate APKBUILD's path #vim syntax higlight '
if [ "${name#*/}" != "$name" ] && ! [ -d "$APORTSDIR/${name%/*}" ]; then
- error "'$p' should be of form 'foo-1.2.3' or 'main/foo-1.2.3'"
- rc=1; continue
+ die "'$p' should be of form 'foo-1.2.3' or 'main/foo-1.2.3'"
fi
- a=$(aports_buildscript "$name" || die "can't find APKBUILD for $name") || { rc=1; continue; }
+ a=$(aports_buildscript "$name" ) \
+ || die "can't find APKBUILD for $name"
# verify APKBUILD
- (
. "$a" || exit 1
- [ "$pkgname" = "$name" ] || die "APKBUILD has different \$pkgname for $name"
- type package | grep -q function || die "missing package() for $name"
- ) || { rc=1; continue; }
-
- (
- set -e
+ [ "$pkgname" = "$name" ] \
+ || die "APKBUILD has different \$pkgname for $name"
+ type package | grep -q function \
+ || die "missing package() for $name"
cd "${a%/*}"
section=${PWD%/*}
@@ -63,7 +63,8 @@ fixes #${fixes#\#}
git add APKBUILD
git commit -m"$message"
- ) || rc=1
+ )
+ rc=$(( $rc + $? ))
done
return $rc
}