summarylogtreecommitdiffstats
path: root/update_version.sh
diff options
context:
space:
mode:
authorKnut Ahlers2020-05-19 16:26:55 +0200
committerKnut Ahlers2020-05-19 16:31:05 +0200
commit8223dabed6598fefeb784a22ed8d93315f13c3fb (patch)
tree902aa8011cc465e4e3d53761b0baa588fe7b7f8d /update_version.sh
parente96b8059e88b7e5b79049a7e7980636e952fcb55 (diff)
downloadaur-8223dabed6598fefeb784a22ed8d93315f13c3fb.tar.gz
Add update script
Signed-off-by: Knut Ahlers <knut@ahlers.me>
Diffstat (limited to 'update_version.sh')
-rwxr-xr-xupdate_version.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/update_version.sh b/update_version.sh
new file mode 100755
index 000000000000..90abb980a5e2
--- /dev/null
+++ b/update_version.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+set -euxo pipefail
+
+obs_version=$(curl -sSfL "https://git.archlinux.org/svntogit/community.git/plain/trunk/PKGBUILD?h=packages/obs-studio" | awk -F '=' '/^pkgver=/{print $2}')
+sink_version=$(curl -sSfL "https://lv.luzifer.io/catalog-api/obs-v4l2sink/latest.txt?p=version")
+
+[ -n "${obs_version}" ] && [ -n "${sink_version}" ] || {
+ echo "Unable to find current versions"
+ exit 1
+}
+
+# First update OBS version
+grep -q "^obsver=${obs_version}$" PKGBUILD || {
+ pkgrel=$(($(awk -F '=' '/^pkgrel=/{print $2}' PKGBUILD) + 1))
+ sed -i \
+ -e "s/^obsver=.*/obsver=${obs_version}/" \
+ -e "s/pkgrel=.*/pkgrel=${pkgrel}/" \
+ PKGBUILD
+}
+
+# In case there is a release, update the release version
+grep -q "^pkgver=${sink_version}$" PKGBUILD || {
+ sed -i \
+ -e "s/^pkgver=.*/pkgver=${sink_version}/" \
+ -e 's/pkgrel=.*/pkgrel=1/' \
+ PKGBUILD
+ updpkgsums
+}
+
+# Check whether this changed anything
+if (git diff --exit-code PKGBUILD); then
+ echo "Package has most recent version ${sink_version} and OBS version ${obs_version}"
+ exit 0
+fi
+
+# Update .SRCINFO
+makepkg --printsrcinfo >.SRCINFO
+
+# Commit changes
+git add PKGBUILD .SRCINFO
+git commit -m "obs-v4l2sink v${sink_version} / obs-studio v${obs_version}"