summarylogtreecommitdiffstats
path: root/update.PKGBUILD
blob: 65cce064a996c138bc47e2e1ee24cec95095fa45 (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
#!/bin/bash
#source PKGBUILD
_gitname=babl
srcdir=$PWD/src

declare -A dep_versions
readonly -a deps=(gobject-introspection lcms vapigen)

echo "##update sources"
makepkg -Cod
echo "##finish updating sources"

## probe meson.build for dependencies versions
for dep in "${deps[@]}";do
	dep_versions["_${dep}_version"]=$(grep -oP "dependency\('${dep}.*?',\s*version:\s*'[<>=]*\K.*(?=')"  "${srcdir}"/${_gitname}/meson.build)
done

echo "##probed deps versions:" >&2
for key in ${!dep_versions[*]};do echo "$key:${dep_versions[$key]}";done >&2

echo "##generate PKGBUILD" >&2
cp -v --backup=numbered PKGBUILD.in PKGBUILD
for key in ${!dep_versions[*]};do sed -i "s/@${key}@/${dep_versions[${key}]}/" PKGBUILD;done >&2
echo "##finish generating PKGBUILD"

echo "##update pkgver"
makepkg -eod
echo "##finish updating pkgver"

echo "##generate .SRCINFO" >&2
makepkg --printsrcinfo > .SRCINFO
echo "##finish updating package" >&2