diff options
-rwxr-xr-x | abump.in | 12 | ||||
-rw-r--r-- | functions.sh.in | 12 |
2 files changed, 23 insertions, 1 deletions
@@ -20,14 +20,22 @@ fi do_bump() { local p rc=0 pkgname pkgver section message local upgrade="${cvelist:+security }upgrade" + local a for p; do pkgname=${p%-[0-9]*} pkgver=${p#${pkgname}-} + # calculate APKBUILD's path + if [ "${pkgname#*/}" != "$pkgname" ] && ! [ -d "$APORTSDIR/${pkgname%/*} ]; 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; } + ( set -e - cd $HOME/aports/*/$pkgname + cd "${a%/*}" section=${PWD%/*} section=${section##*/} @@ -75,6 +83,8 @@ recursive="-r" cvelist= fixes= +[ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR" + args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"` if [ $? -ne 0 ]; then usage diff --git a/functions.sh.in b/functions.sh.in index d71ef38..96b0586 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -19,6 +19,18 @@ if [ -f "$abuild_userconf" ]; then fi +# expects $1 to be a package directory in the aports tree ('foo' or 'main/foo') +# outputs APKBUILD's path if successful +aports_buildscript() { + [ -n "$APORTSDIR" ] || return 1 + if [ "${1#*/}" != "$1" ]; then + ( cd "$APORTSDIR/$1" && [ -f APKBUILD ] && echo "$PWD/APKBUILD" ) + else + ( cd "$APORTSDIR"/*/"$1" && [ -f APKBUILD ] && echo "$PWD/APKBUILD" ) + fi +} + + # output functions case $prog in abuild) |