diff options
author | Dubiousjim <dubiousjim@gmail.com> | 2013-07-05 00:21:30 -0400 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-07-09 07:09:29 +0000 |
commit | a10203d0fc92f3824216a4d7a19b2ccf856a837a (patch) | |
tree | 334014cb61296adb2c9b0e5beae995de93d7970f /abump.in | |
parent | 78b22a0f78f72cc9890add81f49a15e8390c2e05 (diff) | |
download | abuild-a10203d0fc92f3824216a4d7a19b2ccf856a837a.tar.gz abuild-a10203d0fc92f3824216a4d7a19b2ccf856a837a.tar.bz2 abuild-a10203d0fc92f3824216a4d7a19b2ccf856a837a.tar.xz abuild-a10203d0fc92f3824216a4d7a19b2ccf856a837a.zip |
abump: refactor verification of APKBUILD
* includes renaming pkgname, pkgver
Diffstat (limited to 'abump.in')
-rwxr-xr-x | abump.in | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -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 |