apkgrel: show_plain, show_pretty
This commit is contained in:
parent
e6313b54a4
commit
59fd82d944
20
apkgrel.in
20
apkgrel.in
@ -16,8 +16,24 @@ fi
|
|||||||
. "$datadir/functions.sh"
|
. "$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() {
|
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() {
|
do_set() {
|
||||||
@ -32,7 +48,7 @@ do_add () {
|
|||||||
&& [ -n "$(git diff --name-only $f)" ] \
|
&& [ -n "$(git diff --name-only $f)" ] \
|
||||||
&& continue
|
&& continue
|
||||||
[ -d "$f" ] && f="$f/APKBUILD"
|
[ -d "$f" ] && f="$f/APKBUILD"
|
||||||
old=$(do_show "$f")
|
old=$(show_plain "$f")
|
||||||
setto=$(($old + 1))
|
setto=$(($old + 1))
|
||||||
do_set "$f" || return 1
|
do_set "$f" || return 1
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user