summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-06-04 09:48:34 +0200
committerErich Eckner <git@eckner.net>2020-06-04 09:48:34 +0200
commitc3f55a1643898055419771f4431eb3e522c8d6af (patch)
tree299e0ce2d117b9167db2405c0e1e7d3aed363c76
parent2a304312db7b57efe378f50a983f1ffc6014dae1 (diff)
downloadarchlinuxewe.git.save-c3f55a1643898055419771f4431eb3e522c8d6af.tar.xz
bumpPkgrel: share "provided" tmpfile across invocations
-rwxr-xr-xbumpPkgrel42
1 files changed, 24 insertions, 18 deletions
diff --git a/bumpPkgrel b/bumpPkgrel
index 3ec11039..12912aee 100755
--- a/bumpPkgrel
+++ b/bumpPkgrel
@@ -1,7 +1,7 @@
#!/bin/bash
if [ $# -eq 0 ]; then
- >&2 echo 'usage: bumpPkgrel [-n] $pkg1 $pkg2 $pkg3 ...'
+ >&2 echo 'usage: bumpPkgrel [-n] [-p /tmp/provided] $pkg1 $pkg2 $pkg3 ...'
exit 1
fi
@@ -14,22 +14,11 @@ else
commit_flag=''
fi
-pin_dependency() {
- sed '
- s/=.*$//
- /^$/d
- ' \
- | sort -k1,1 \
- | join -1 1 -2 2 - "${provided}" \
- | sed '
- s/^\(\S\+\) \(\S\+\)$/'"${1}'"'\1=\2'"'"'/
- t
- d
- '
-}
-
-if [ $# -eq 1 ]; then
-
+if [ "x$1" = 'x-p' ]; then
+ shift
+ provided="$2"
+ shift
+else
provided=$(mktemp)
trap 'rm -f "${provided}"' EXIT
@@ -65,6 +54,23 @@ if [ $# -eq 1 ]; then
| sort -k2,2 -k1Vr,1 \
| uniq -f1 \
>"${provided}"
+fi
+
+pin_dependency() {
+ sed '
+ s/=.*$//
+ /^$/d
+ ' \
+ | sort -k1,1 \
+ | join -1 1 -2 2 - "${provided}" \
+ | sed '
+ s/^\(\S\+\) \(\S\+\)$/'"${1}'"'\1=\2'"'"'/
+ t
+ d
+ '
+}
+
+if [ $# -eq 1 ]; then
cd "$(dirname "$0")"
@@ -117,6 +123,6 @@ if [ $# -eq 1 ]; then
else
printf '%s\n' "$@" \
- | xargs -rn1 "$0" ${commit_flag}
+ | xargs -rn1 "$0" ${commit_flag} -p "${provided}"
fi