mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-03-01 09:50:31 +00:00
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.
This commit is contained in:
parent
5021e13ffa
commit
e1d629b6c4
31
abump.in
31
abump.in
@ -25,23 +25,23 @@ do_bump() {
|
||||
name=${p%-[0-9]*}
|
||||
ver=${p#${name}-}
|
||||
|
||||
# calculate APKBUILD's path
|
||||
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
|
||||
fi
|
||||
a=$(aports_buildscript "$name" || die "can't find APKBUILD for $name") || { rc=1; continue; }
|
||||
|
||||
# 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
|
||||
|
||||
# calculate APKBUILD's path #vim syntax higlight '
|
||||
if [ "${name#*/}" != "$name" ] && ! [ -d "$APORTSDIR/${name%/*}" ]; then
|
||||
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"
|
||||
|
||||
# verify APKBUILD
|
||||
. "$a" || exit 1
|
||||
[ "$pkgname" = "$name" ] \
|
||||
|| die "APKBUILD has different \$pkgname for $name"
|
||||
type package | grep -q function \
|
||||
|| die "missing package() for $name"
|
||||
|
||||
cd "${a%/*}"
|
||||
section=${PWD%/*}
|
||||
section=${section##*/}
|
||||
@ -63,7 +63,8 @@ fixes #${fixes#\#}
|
||||
|
||||
git add APKBUILD
|
||||
git commit -m"$message"
|
||||
) || rc=1
|
||||
)
|
||||
rc=$(( $rc + $? ))
|
||||
done
|
||||
return $rc
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user