summaryrefslogtreecommitdiff
path: root/bumpVersion
blob: bea54613e9ad2376e04ed8d8f3f6b12c0593b566 (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
42
43
44
45
46
#!/bin/bash

if [ $# -ne 1 ]
then
  err=0
  for pkg in "$@"
  do
    $0 "${pkg}"
    cErr=$?
    [ ${cErr} -gt ${err} ] && err=${cErr}
  done
  exit ${err}
fi

paket="${1%/}"

cd "$(dirname "$(readlink -f "$0")")"
[ -r "${paket}/PKGBUILD" ] || exit 1
eval $(./checkVersions -m "${paket}")
if [ "${remVer}" == "${pkgver}" ]
then
  exit 0
fi

cd "${paket}"

sed 's|pkgver=.*$|pkgver='"${remVer}"'|;
  s|pkgrel=.*$|pkgrel=1|;
  s@^\s*\(sha[[:digit:]]\+sums\|md5sums\)=@sha512sums=@
' -i PKGBUILD

sed '
  :begin;
    $!N;
    s@^sha512sums=\([^)]*\)\n\(.*\)$@sha512sums=\1 \2@;
  tbegin;
  P;
  D
' -i PKGBUILD
summen="$(makepkg -g)"
sed 's|sha512sums=.*$|'"${summen}"'|' -i PKGBUILD

rm -rf pkg src
sudo pacman -Sy
makepkg -fcsr || exit 1
git commit PKGBUILD -m "${paket} ${pkgver} -> ${remVer}"