summaryrefslogtreecommitdiff
path: root/bumpPython
blob: 93f30bc408e6b259a5da2f506e86bebbe872ae18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

me="$(readlink -f $0)"
cd $(dirname "${me}")

usage() {
  >&2 echo 'usage:'
  >&2 echo '  bumpPython $version $provided_files'
  exit 1
}

if [ $# -le 1 ]; then
  usage
fi

pkgbuilds=(
  $(grep -l 'python>=3' */PKGBUILD)
)
pyver=$(
  printf '%s\n' "$1" | \
    cut -d' ' -f2 | \
    cut -d. -f1,2
)
pymajor="${pyver%%.*}"
pyverupper="${pymajor}.$((${pyver#*.}+1))"
shift

for pkgbuild in "${pkgbuilds[@]}"; do

  ./bumpPkgrel -n "${pkgbuild%/PKGBUILD}" $(printf ' -p %s' "$@")
  sed -i '
    s@'"'python>=${pymajor}\.[0-9]\+'@'python>=${pyver}'"'@
    s@'"'python<${pymajor}\.[0-9]\+'@'python<${pyverupper}'"'@
  ' "${pkgbuild}"
  cd "${pkgbuild%/*}"
  ../commit-package
  cd ..

done

git commit -m 'recompile all python packages'