summaryrefslogtreecommitdiffstats
path: root/apkgrel.in
diff options
context:
space:
mode:
authorDubiousjim <dubiousjim@gmail.com>2013-07-05 00:21:34 -0400
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-09 07:11:52 +0000
commit59fd82d944bf335cf2b855ebdde84b3d8f97ab92 (patch)
treebb6974a9034f8a63faee60409a9131755168393c /apkgrel.in
parente6313b54a44b04982dfda19c73aa1194ef28911b (diff)
downloadabuild-59fd82d944bf335cf2b855ebdde84b3d8f97ab92.tar.bz2
abuild-59fd82d944bf335cf2b855ebdde84b3d8f97ab92.tar.xz
apkgrel: show_plain, show_pretty
Diffstat (limited to 'apkgrel.in')
-rw-r--r--apkgrel.in20
1 files 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