summarylogtreecommitdiffstats
path: root/gen_ver.sh
blob: ab5b135b7fa7363bd61788e70e6aa12a735337d4 (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
#!/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"
echo "Pushing!"
git push