summarylogtreecommitdiffstats
path: root/gen_ver.sh
blob: 0e83b69f76443cbcf2d690dc8e700acb723c7114 (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
#!/usr/bin/env sh

source ./.pkg_config

git_dir=".$pkgname-git-clone__"

echo "test $git_dir"

if [ -d "$git_dir" ]; then
    echo "Directory exists. Assuming git structure and continuing"
else
    git clone "$url" "$git_dir"
fi

pushd "$git_dir"

version="$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"

popd

sed s/__VERSION/"$version"/ < ./_PKGBUILD > ./PKGBUILD
sed s/__VERSION/"$version"/ < ./_.SRCINFO > ./.SRCINFO

echo "Updated version, committing."
git add PKGBUILD .SRCINFO
git commit -m "Update version to $version"