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() {
|
2012-02-14 14:53:05 +00:00
|
|
|
local pkgname=${1%-[0-9]*}
|
|
|
|
local pkgver=${1#${pkgname}-}
|
2010-04-06 06:56:33 +00:00
|
|
|
|
|
|
|
APORTS=$HOME/aports
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2010-11-19 10:25:15 +00:00
|
|
|
cd $APORTS/*/$pkgname || return 1
|
2012-02-14 14:53:05 +00:00
|
|
|
local section=${PWD%/*} upgrade="upgrade" cve=
|
2010-04-06 06:56:33 +00:00
|
|
|
section=${section##*/}
|
2012-02-14 14:53:05 +00:00
|
|
|
if [ -n "$cvelist" ]; then
|
|
|
|
upgrade="security upgrade"
|
|
|
|
cve=" ($cvelist)"
|
|
|
|
fi
|
2010-04-06 06:56:33 +00:00
|
|
|
|
2012-02-14 14:53:05 +00:00
|
|
|
msg="$section/$pkgname: $upgrade to ${pkgver}${cve}"
|
2013-02-14 09:46:18 +00:00
|
|
|
if [ -n "$fixes" ]; then
|
|
|
|
msg="$msg
|
|
|
|
|
|
|
|
fixes #${fixes#\#}
|
|
|
|
"
|
|
|
|
fi
|
2010-04-06 06:56:33 +00:00
|
|
|
echo "$msg"
|
2013-02-14 09:46:18 +00:00
|
|
|
|
2010-04-06 06:56:33 +00:00
|
|
|
( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
|
2013-02-14 09:46:18 +00:00
|
|
|
|
2010-04-06 06:56:33 +00:00
|
|
|
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"
|
2013-02-14 09:46:18 +00:00
|
|
|
echo "usage: $program [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]"
|
2010-11-19 10:25:15 +00:00
|
|
|
echo ""
|
|
|
|
echo " -h show this help"
|
|
|
|
echo " -R run abuild with -R for recursive building"
|
2011-09-30 06:43:27 +00:00
|
|
|
echo " -k keep existing packages"
|
2012-02-14 14:53:05 +00:00
|
|
|
echo " -s security update"
|
2013-02-14 09:46:18 +00:00
|
|
|
echo " -f fixes ISSUE"
|
2010-11-19 10:25:15 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2011-09-30 06:43:27 +00:00
|
|
|
keep=
|
|
|
|
recursive="-r"
|
2013-02-14 09:46:18 +00:00
|
|
|
while getopts "f:hkRs:" opt; do
|
2010-11-19 10:25:15 +00:00
|
|
|
case $opt in
|
2013-02-14 09:46:18 +00:00
|
|
|
f) fixes="${OPTARG}";;
|
2010-11-19 10:25:15 +00:00
|
|
|
h) usage;;
|
2011-09-30 06:43:27 +00:00
|
|
|
k) keep="-k";;
|
|
|
|
R) recursive="-R";;
|
2012-02-14 14:53:05 +00:00
|
|
|
s) cvelist="$OPTARG";;
|
2010-11-19 10:25:15 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(( $OPTIND - 1))
|
|
|
|
|
2011-09-30 06:43:27 +00:00
|
|
|
abuild_opts="$recursive $keep"
|
|
|
|
|
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
|
|
|
|