summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiota2023-11-15 15:53:46 -0800
committerxiota2023-11-15 15:59:12 -0800
commite21f46ca475ca1fc8b962b58538f3647e8059150 (patch)
tree2e479125586fbffdb2586a2246296996fe7b85e1
parent73ff4e215e87546b6a0c5c1399a37caa2b39f58b (diff)
downloadaur-g4music-git.tar.gz
hybrid package
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD135
2 files changed, 101 insertions, 36 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e27512dba11a..21d5db1c0583 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = g4music-git
pkgdesc = Play your music
pkgver = 3.4.1.r2.g3b76f92
- pkgrel = 1
+ pkgrel = 2
url = https://gitlab.gnome.org/neithern/g4music
arch = x86_64
arch = aarch64
diff --git a/PKGBUILD b/PKGBUILD
index 85d3e48b227b..c56bfb090609 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,52 +1,93 @@
# Maintainer:
# Contributor: Igor Dyatlov <dyatlov.igor@protonmail.com>
+# options
+if [ x"$_srcinfo" == "xt" ] ; then
+ : ${_autoupdate:=false}
+elif [ -z "$_pkgver" ] ; then
+ : ${_autoupdate:=true}
+else
+ : ${_autoupdate:=false}
+fi
+
+: ${_tag:=v3.4-1}
+
+: ${_pkgtype:=git}
+
+# basic info
_pkgname="g4music"
-pkgname="$_pkgname-git"
+pkgname="$_pkgname${_pkgtype:+-$_pkgtype}"
pkgver=3.4.1.r2.g3b76f92
-pkgrel=1
+pkgrel=2
pkgdesc="Play your music"
url="https://gitlab.gnome.org/neithern/g4music"
license=('GPL3')
arch=('x86_64' 'aarch64')
-depends=(
- gstreamer
- libadwaita
- taglib
- tracker3
-)
-makedepends=(
- git
- meson
- vala
-)
-checkdepends=(
- appstream-glib
-)
-optdepends=(
- 'gst-plugins-bad'
- 'gst-plugins-base'
- 'gst-plugins-good'
-)
-
-provides=("$_pkgname=${pkgver%%.r*}")
-conflicts=("$_pkgname")
-
-_pkgsrc="$_pkgname"
-source=("$_pkgsrc"::"git+$url.git")
-sha256sums=('SKIP')
-
-pkgver() {
- cd "$_pkgsrc"
- local _pkgver=$(
- git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' 2>/dev/null \
- | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
+# main package
+_main_package() {
+ depends=(
+ gstreamer
+ libadwaita
+ taglib
+ tracker3
+ )
+ makedepends=(
+ git
+ meson
+ vala
+ )
+ checkdepends=(
+ appstream-glib
)
+ optdepends=(
+ 'gst-plugins-bad'
+ 'gst-plugins-base'
+ 'gst-plugins-good'
+ )
+
+ if [ x"$pkgname" == x"$_pkgname" ] ; then
+ _update_version
+ _main_stable
+ else
+ _main_git
+ fi
+}
+
+# stable package
+_main_stable() {
+ _pkgsrc="$_pkgname"
+ _pkgext="tar.gz"
+ source+=("$_pkgsrc"::"git+$url.git#tag=${_tag:?}")
+ sha256sums+=('SKIP')
+
+ pkgver() {
+ local _pkgver=$(sed -E 's@^[^0-9]+@@; s@\.r.*$@@; s@-@.@g' <<< "${_tag:?}")
+ echo "${_pkgver:?}"
+ }
+}
+
+# git package
+_main_git() {
+ provides=("$_pkgname=${pkgver%%.r*}")
+ conflicts=("$_pkgname")
+
+ _pkgsrc="$_pkgname"
+ source+=("$_pkgsrc"::"git+$url.git")
+ sha256sums+=('SKIP')
- echo "${_pkgver:?}"
+ pkgver() (
+ cd "$_pkgsrc"
+ local _pkgver=$(
+ git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' 2>/dev/null \
+ | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
+ )
+
+ echo "${_pkgver:?}"
+ )
}
+# common functions
build() {
arch-meson "$_pkgsrc" build
meson compile -C build
@@ -59,3 +100,27 @@ check() {
package() {
meson install -C build --destdir "${pkgdir:?}"
}
+
+# update version
+_update_version() {
+ if [ x"${_autoupdate::1}" != "xt" ] ; then
+ return
+ fi
+
+ _gitlab_host="${url#*//}"
+ _gitlab_host="${_gitlab_host%%/*}"
+ _gitlab_id=21317
+ _gitlab_path="api/v4/projects/$_gitlab_id/repository/tags"
+ _response=$(curl -Ssf "https://$_gitlab_host/$_gitlab_path")
+
+ _get() {
+ printf '%s' "$_response" \
+ | tr ',' '\n' \
+ | awk -F '"' '/"'"$1"'":/{print $4}' \
+ | sort -Vr | head -1
+ }
+ _tag=$(_get name)
+}
+
+# execute
+_main_package