2010-04-06 06:56:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-11-19 10:25:15 +00:00
|
|
|
program=${0##*/}
|
|
|
|
|
2010-04-06 06:56:33 +00:00
|
|
|
die() {
|
|
|
|
echo "$@" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# version bump a pkg
|
|
|
|
|
|
|
|
do_bump() {
|
|
|
|
pkgname=${1%-[0-9]*}
|
|
|
|
pkgver=${1#${pkgname}-}
|
|
|
|
|
|
|
|
APORTS=$HOME/aports
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2010-11-19 10:25:15 +00:00
|
|
|
cd $APORTS/*/$pkgname || return 1
|
2010-04-06 06:56:33 +00:00
|
|
|
section=${PWD%/*}
|
|
|
|
section=${section##*/}
|
|
|
|
|
|
|
|
msg="$section/$pkgname: upgrade to $pkgver"
|
|
|
|
echo "$msg"
|
|
|
|
|
|
|
|
( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
|
|
|
|
|
|
|
|
sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
|
|
|
|
-e "s/^pkgrel=.*/pkgrel=0/" \
|
|
|
|
APKBUILD
|
|
|
|
|
2010-11-19 10:25:15 +00:00
|
|
|
abuild $abuild_opts checksum all || exit 1
|
2010-04-06 06:56:33 +00:00
|
|
|
|
|
|
|
git add APKBUILD
|
|
|
|
git commit -m"$msg"
|
|
|
|
}
|
|
|
|
|
2010-11-19 10:25:15 +00:00
|
|
|
usage() {
|
|
|
|
echo "$program - utility to bump pkgver in APKBUILDs"
|
|
|
|
echo "usage: $program [-hR]"
|
|
|
|
echo ""
|
|
|
|
echo " -h show this help"
|
|
|
|
echo " -R run abuild with -R for recursive building"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
abuild_opts="-r"
|
|
|
|
while getopts "hR" opt; do
|
|
|
|
case $opt in
|
|
|
|
h) usage;;
|
|
|
|
R) abuild_opts="-R";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(( $OPTIND - 1))
|
|
|
|
|
2010-04-06 06:56:33 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
( do_bump "$1" ) || exit 1
|
|
|
|
shift
|
|
|
|
done
|
2010-11-19 10:25:15 +00:00
|
|
|
|