From 78b22a0f78f72cc9890add81f49a15e8390c2e05 Mon Sep 17 00:00:00 2001 From: Dubiousjim Date: Fri, 5 Jul 2013 00:21:29 -0400 Subject: abump, functions: refactor (and verify) calculation of APKBUILD path --- functions.sh.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'functions.sh.in') 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) -- cgit v1.2.3