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 ...@@ -18,19 +18,26 @@ fi
# version bump packages # version bump packages
do_bump() { do_bump() {
local p rc=0 pkgname pkgver section message local p rc=0 name ver section message
local upgrade="${cvelist:+security }upgrade" local upgrade="${cvelist:+security }upgrade"
local a local a
for p; do for p; do
pkgname=${p%-[0-9]*} name=${p%-[0-9]*}
pkgver=${p#${pkgname}-} ver=${p#${name}-}
# calculate APKBUILD's path # 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'" error "'$p' should be of form 'foo-1.2.3' or 'main/foo-1.2.3'"
rc=1; continue rc=1; continue
fi 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 set -e
...@@ -39,7 +46,7 @@ do_bump() { ...@@ -39,7 +46,7 @@ do_bump() {
section=${PWD%/*} section=${PWD%/*}
section=${section##*/} section=${section##*/}
message="$section/$pkgname: $upgrade to ${pkgver}${cvelist}" message="$section/$name: $upgrade to ${ver}${cvelist}"
if [ -n "$fixes" ]; then if [ -n "$fixes" ]; then
message="$message message="$message
...@@ -48,9 +55,7 @@ fixes #${fixes#\#} ...@@ -48,9 +55,7 @@ fixes #${fixes#\#}
fi fi
echo "$message" echo "$message"
( . ./APKBUILD; type package | grep -q function ) || die "package() missing" sed -i -e "s/^pkgver=.*/pkgver=$ver/" \
sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
-e "s/^pkgrel=.*/pkgrel=0/" \ -e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD 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