diff options
Diffstat (limited to 'bumpPkgrel')
-rwxr-xr-x | bumpPkgrel | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -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 |