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 96EF2DC7B52 for ; Fri, 5 Jul 2013 04:21:55 +0000 (UTC) Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id EDBD42094E for ; Fri, 5 Jul 2013 00:21:52 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 05 Jul 2013 00:21:52 -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=AML3PtFn3rJvgX85zZeERXhG+ nk=; b=jbimNo+DcBDRMjoXiciMXo0DdeExzy2BYxTH2TSlrr9UD2Cza0cawSJYx LtPEZwbT4MNJn7rRrgIT8h2Oaz3oevduf1hd8cQjbkAWIIgU2U5yhIvetnxXyQev BG0VQ3kl3yhl2hu+ua9SqCDdFrSVB3JAdKZtjnN5TKvYaQ4pYg= X-Sasl-enc: jsT7V9HTmteUbAcXed9nA29UJYWn3yuT59nYcX88F3uS 1372998112 Received: from localhost (unknown [69.86.161.244]) by mail.messagingengine.com (Postfix) with ESMTPA id ACA7A680204 for ; Fri, 5 Jul 2013 00:21:52 -0400 (EDT) From: Dubiousjim To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 25/31] apkgrel: show_plain, show_pretty Date: Fri, 5 Jul 2013 00:21:34 -0400 Message-Id: <09b356b0284e259ca755b9d339cd1b6fad4ad93c.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: --- apkgrel.in | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apkgrel.in b/apkgrel.in index 28978e3..645637d 100644 --- a/apkgrel.in +++ b/apkgrel.in @@ -16,8 +16,24 @@ fi . "$datadir/functions.sh" +show_plain() { + # we source the APKBUILD and show last pkgrel that's read + # if this script is invoked with --force, this needn't pass "do_verify" + ( . "$1" && echo "$pkgrel" ) +} + +show_pretty() { + ( + . "$1" || exit 1 + [ -n "$pkgname" ] || die "$1: no pkgname" + printf '%s: r%s\n' "$pkgname" "${pkgrel:-?}" + ) +} + do_show() { - awk -F= '$1 == "pkgrel" { print $2 }' "$@" + local f= + # show_pretty is more informative, but would change the output format of this script + for f; do show_plain "$f"; done } do_set() { @@ -32,7 +48,7 @@ do_add () { && [ -n "$(git diff --name-only $f)" ] \ && continue [ -d "$f" ] && f="$f/APKBUILD" - old=$(do_show "$f") + old=$(show_plain "$f") setto=$(($old + 1)) do_set "$f" || return 1 done -- 1.8.3.1 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---