X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 96CE2DC6007 for ; Fri, 5 Jul 2013 04:21:55 +0000 (UTC) Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 9303620528 for ; Fri, 5 Jul 2013 00:21:50 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute6.internal (MEProxy); Fri, 05 Jul 2013 00:21:50 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :in-reply-to:references; s=smtpout; bh=3R8ey7VM93kEsRfn41UkAT6Gl uU=; b=ovdDWWHeXe7LdLiGTFtDZJmI/k65zt0HhYGooQKLgGi+UCHO7nY88vIw0 FtFgSGMNGiwXPLePfMXieR9pJ/TkWDvn2Dp8rz1eLTzQiti7Z/HJbKJL4HLD8V0M gNJ+aEaucoPjhLsq4dFh7iJgxgEJa9YRYKnUYo51ejKdbYoQ0E= X-Sasl-enc: /PtizlQCNeDXtjN6n09Y9nqa5ZSU7GIqBq/BIz4TfFJi 1372998110 Received: from localhost (unknown [69.86.161.244]) by mail.messagingengine.com (Postfix) with ESMTPA id 5777F680204 for ; Fri, 5 Jul 2013 00:21:50 -0400 (EDT) From: Dubiousjim To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 20/31] abump, functions: refactor (and verify) calculation of APKBUILD path Date: Fri, 5 Jul 2013 00:21:29 -0400 Message-Id: <246c01a93751a3fec789ba1992e9e742a463aa73.1372997335.git.dubiousjim@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: --- abump.in | 12 +++++++++++- functions.sh.in | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/abump.in b/abump.in index ddd9715..7a0bd57 100755 --- a/abump.in +++ b/abump.in @@ -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) -- 1.8.3.1 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---