summaryrefslogtreecommitdiff
path: root/bumpPython
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-08-07 08:08:56 +0200
committerErich Eckner <git@eckner.net>2018-08-07 08:08:56 +0200
commit499b1c4e797a2085b5c13301326f8c574782bff5 (patch)
treefa58fbf357b652bcf8affc2641c309e624e02dad /bumpPython
parentefc22702de0ff7fa08783283555af19359eafe8b (diff)
downloadarchlinuxewe-499b1c4e797a2085b5c13301326f8c574782bff5.tar.xz
bumpPython neu
Diffstat (limited to 'bumpPython')
-rwxr-xr-xbumpPython63
1 files changed, 63 insertions, 0 deletions
diff --git a/bumpPython b/bumpPython
new file mode 100755
index 000000000..60c4cde69
--- /dev/null
+++ b/bumpPython
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+me="$(readlink -f $0)"
+cd $(dirname "${me}")
+
+usage() {
+ >&2 echo 'usage:'
+ >&2 echo ' bumpPython 2'
+ >&2 echo 'or:'
+ >&2 echo ' bumpPython 3'
+ exit 1
+}
+
+if [ $# -ne 1 ]; then
+ usage
+fi
+
+case "$1" in
+
+ '2')
+ pkgbuilds=(
+ $(grep -l 'python>=2' */PKGBUILD)
+ )
+ pyver=$(
+ python2 --version 2>&1
+ )
+ ;;
+ '3')
+ pkgbuilds=(
+ $(grep -l 'python>=3' */PKGBUILD)
+ )
+ pyver=$(
+ python --version 2>&1
+ )
+ ;;
+ *)
+ usage
+ ;;
+esac
+
+pyver=$(
+ printf '%s\n' "${pyver}" | \
+ cut -d' ' -f2 | \
+ cut -d. -f1,2
+)
+pymajor="${pyver%%.*}"
+pyverupper="${pymajor}.$((${pyver#*.}+1))"
+
+for pkgbuild in "${pkgbuilds[@]}"; do
+
+ eval "$(
+ grep '^pkgrel=' "${pkgbuild}"
+ )"
+ sed -i '
+ s@^\(pkgrel=\)\('"'"'\?\)[0-9]\+\2$@\1'"'$((pkgrel+1))'"'@
+ s@'"'python>=${pymajor}\.[0-9]\+'@'python>=${pyver}'"'@
+ s@'"'python<${pymajor}\.[0-9]\+'@'python<${pyverupper}'"'@
+ ' "${pkgbuild}"
+ git add "${pkgbuild}"
+
+done
+
+git commit -m 'recompile all python packages'