summaryrefslogtreecommitdiff
path: root/bumpPerl
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-24 14:03:57 +0200
committerErich Eckner <git@eckner.net>2018-09-24 14:03:57 +0200
commitb15f6b0dc2a23325b00b195e061334255d03540e (patch)
tree1978854ed32cbb6c26be5a7aebb36859fc86f444 /bumpPerl
parent4156e0f5edf9f99529a591fb9757b442a9685f46 (diff)
downloadarchlinuxewe-b15f6b0dc2a23325b00b195e061334255d03540e.tar.xz
bumpPerl: save current perl version in depends=()
Diffstat (limited to 'bumpPerl')
-rwxr-xr-xbumpPerl29
1 files changed, 29 insertions, 0 deletions
diff --git a/bumpPerl b/bumpPerl
index 5ade81ce5..f16cdff1b 100755
--- a/bumpPerl
+++ b/bumpPerl
@@ -3,12 +3,41 @@
me="$(readlink -f $0)"
cd $(dirname "${me}")
+perlMinor=$(
+ pacman -Q perl | \
+ sed '
+ s/^\S\+ //
+ '
+)
+perlMajor="${perlMinor%%.*}"
+perlMinor="${perlMinor#${perlMajor}.}"
+perlMinor="${perlMinor%%.*}"
+
for pkgbuild in perl-*/PKGBUILD demeter/PKGBUILD; do
pkgrel="$(
sed -n "/^pkgrel='\?[0-9]\+'\?\$/{s@^pkgrel='\?\([0-9]\+\)'\?\$@\1@;p}" "${pkgbuild}"
)"
sed -i "s@^\(pkgrel=\)'\?[0-9]\+'\?\$@\1'$[${pkgrel}+1]'@" "${pkgbuild}"
+ sed -i '
+ /^depends=(/{
+ :a
+ /)/! {
+ N
+ ba
+ }
+ s/\n\(\s*\('"'"'\?\)perl[<>]\S\+\2\n\)\+/\n/
+ s/^depends=([^\n]*\n/\0 '"'"'perl>='"${perlMajor}.${perlMinor}'"'\n '"'"'perl<'"${perlMajor}.$((perlMinor+1))'"'\n/
+ }
+ ' "${pkgbuild}"
+ if ! grep -q '^depends=(' "${pkgbuild}"; then
+ sed -i '
+ /^arch=(/ a depends=(\
+ '"'"'perl>='"${perlMajor}.${perlMinor}'"'\
+ '"'"'perl<'"${perlMajor}.$((perlMinor+1))'"'\
+)
+ ' "${pkgbuild}"
+ fi
git add "${pkgbuild}"
done