abump: move loop inside do_bump, refine locals, introduce subshell

This commit is contained in:
Dubiousjim 2013-07-05 00:21:25 -04:00 committed by Natanael Copa
parent 7a628e7dc4
commit 512d5fd551

View File

@ -16,43 +16,46 @@ fi
. "$datadir/functions.sh" . "$datadir/functions.sh"
# version bump a pkg # version bump packages
do_bump() { do_bump() {
local pkgname=${1%-[0-9]*} local p rc=0 pkgname pkgver section upgrade cve message
local pkgver=${1#${pkgname}-} for p; do
pkgname=${p%-[0-9]*}
pkgver=${p#${pkgname}-}
APORTS=$HOME/aports (
set -e
set -e cd $HOME/aports/*/$pkgname
section=${PWD%/*} upgrade="upgrade" cve=
section=${section##*/}
if [ -n "$cvelist" ]; then
upgrade="security upgrade"
cve=" ($cvelist)"
fi
cd $APORTS/*/$pkgname || return 1 message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
local section=${PWD%/*} upgrade="upgrade" cve= if [ -n "$fixes" ]; then
section=${section##*/} message="$message
if [ -n "$cvelist" ]; then
upgrade="security upgrade"
cve=" ($cvelist)"
fi
message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
if [ -n "$fixes" ]; then
message="$message
fixes #${fixes#\#} fixes #${fixes#\#}
" "
fi fi
echo "$message" echo "$message"
( . ./APKBUILD; type package | grep -q function ) || die "package() missing" ( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \ sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
-e "s/^pkgrel=.*/pkgrel=0/" \ -e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD APKBUILD
abuild $abuild_opts checksum all || exit 1 abuild $abuild_opts checksum all
git add APKBUILD git add APKBUILD
git commit -m"$message" git commit -m"$message"
) || rc=1
done
return $rc
} }
usage() { usage() {
@ -101,8 +104,5 @@ fi
abuild_opts="$recursive $keep" abuild_opts="$recursive $keep"
while [ $# -gt 0 ]; do do_bump "$@"
( do_bump "$1" ) || exit 1
shift
done