From a0a2bbcec2a00f9b7e7c2a4a8783a6e89d120041 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 6 Oct 2022 12:45:41 +0200 Subject: [PATCH] korvike v0.13.0 --- .SRCINFO | 13 +++++++++++++ .gitignore | 5 +++++ PKGBUILD | 25 +++++++++++++++++++++++++ update_version.sh | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 .SRCINFO create mode 100644 .gitignore create mode 100644 PKGBUILD create mode 100755 update_version.sh diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..c7e6c4b --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,13 @@ +pkgbase = korvike + pkgdesc = korvike takes a Go template and executes it + pkgver = 0.13.0 + pkgrel = 1 + url = https://github.com/Luzifer/korvike + arch = i686 + arch = x86_64 + license = Apache + makedepends = go + source = korvike-0.13.0.tar.gz::https://github.com/Luzifer/korvike/archive/v0.13.0.tar.gz + sha512sums = dffcdf394f93e587c9784543468684825b08b66c13190e645de8c3d5b5f9e92daad88e67e7393a0b2b6e6879c648bba54b452429e010ce340aa31a2bf1e51f30 + +pkgname = korvike diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e492d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +* +!.gitignore +!PKGBUILD +!.SRCINFO +!update_version.sh diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..fbe40ab --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,25 @@ +# Maintainer: Knut Ahlers + +pkgname=korvike +pkgver=0.13.0 +pkgrel=1 +pkgdesc="korvike takes a Go template and executes it" +arch=('i686' 'x86_64') +url="https://github.com/Luzifer/$pkgname" +license=('Apache') +depends=() +makedepends=('go') +source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz") +sha512sums=('dffcdf394f93e587c9784543468684825b08b66c13190e645de8c3d5b5f9e92daad88e67e7393a0b2b6e6879c648bba54b452429e010ce340aa31a2bf1e51f30') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + go build -a -v \ + -ldflags="-X main.version=${pkgver}" \ + -mod=readonly \ + -o korvike +} + +package() { + install -Dm755 -t "${pkgdir}/usr/bin" "${srcdir}/${pkgname}-${pkgver}/korvike" +} diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 0000000..0ad3158 --- /dev/null +++ b/update_version.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -euxo pipefail + +# Read pkg name +PKG=$(awk -F '=' '/pkgname=/{ print $2 }' PKGBUILD) + +# Get latest version +VER=$(git ls-remote --tags --sort -v:refname https://github.com/Luzifer/korvike.git | + head -n1 | + grep -Eo 'tags/v[0-9.]+' | + grep -Eo '[0-9.]+$') + +# Insert latest version into PKGBUILD +sed -i \ + -e "s/^pkgver=.*/pkgver=${VER}/" \ + PKGBUILD + +# Check whether this changed anything +if (git diff --exit-code PKGBUILD); then + echo "Package ${PKG} has most recent version ${VER}" + exit 0 +fi + +# Reset pkgrel +sed -i \ + -e 's/pkgrel=.*/pkgrel=1/' \ + PKGBUILD + +# Update source hashes +updpkgsums + +# Update .SRCINFO +makepkg --printsrcinfo >.SRCINFO + +# Commit changes +git add PKGBUILD .SRCINFO +git commit -m "${PKG} v${VER}"