Commit a10203d0 authored by Dubiousjim's avatar Dubiousjim Committed by Natanael Copa

abump: refactor verification of APKBUILD

* includes renaming pkgname, pkgver
parent 78b22a0f
......@@ -18,19 +18,26 @@ fi
# version bump packages
do_bump() {
local p rc=0 pkgname pkgver section message
local p rc=0 name ver section message
local upgrade="${cvelist:+security }upgrade"
local a
for p; do
pkgname=${p%-[0-9]*}
pkgver=${p#${pkgname}-}
name=${p%-[0-9]*}
ver=${p#${name}-}
# calculate APKBUILD's path
if [ "${pkgname#*/}" != "$pkgname" ] && ! [ -d "$APORTSDIR/${pkgname%/*} ]; then
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 "$pkgname" || die "can't find APKBUILD for $pkgname") || { rc=1; continue; }
a=$(aports_buildscript "$name" || die "can't find APKBUILD for $name") || { rc=1; continue; }
# verify APKBUILD
(
. "$a" || exit 1
[ "$pkgname" = "$name" ] || die "$name: APKBUILD has different \$pkgname"
type package | grep -q function || die "$name: missing package()"
) || { rc=1; continue; }
(
set -e
......@@ -39,7 +46,7 @@ do_bump() {
section=${PWD%/*}
section=${section##*/}
message="$section/$pkgname: $upgrade to ${pkgver}${cvelist}"
message="$section/$name: $upgrade to ${ver}${cvelist}"
if [ -n "$fixes" ]; then
message="$message
......@@ -48,9 +55,7 @@ fixes #${fixes#\#}
fi
echo "$message"
( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
sed -i -e "s/^pkgver=.*/pkgver=$ver/" \
-e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment