[arch-commits] Commit in nextcloud-app-notify_push/trunk (PKGBUILD)

Caleb Maclennan alerque at gemini.archlinux.org
Sat May 21 11:04:52 UTC 2022


    Date: Saturday, May 21, 2022 @ 11:04:51
  Author: alerque
Revision: 1209535

upgpkg: nextcloud-app-notify_push 0.4.0-4; cleanup nextcloud/php range detection more

Modified:
  nextcloud-app-notify_push/trunk/PKGBUILD

----------+
 PKGBUILD |   77 +++++++++++++++++++++++++------------------------------------
 1 file changed, 32 insertions(+), 45 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-05-21 10:12:34 UTC (rev 1209534)
+++ PKGBUILD	2022-05-21 11:04:51 UTC (rev 1209535)
@@ -3,17 +3,19 @@
 
 pkgname=nextcloud-app-notify_push
 pkgver=0.4.0
-pkgrel=3
+pkgrel=4
 pkgdesc='Update notifications for nextcloud clients'
 arch=(x86_64)
 url="https://github.com/nextcloud/${pkgname##*-}"
 license=(AGPL3)
 makedepends=(cargo
-             rsync)
+             nextcloud
+             rsync
+             yq)
 optdepends=('redis: use a local redis instance')
 options=(debug)
 install="$pkgname.install"
-groups=('nextcloud-apps')
+groups=(nextcloud-apps)
 _archive="${pkgname##*-}-$pkgver"
 source=("$url/archive/v$pkgver/$_archive.tar.gz"
         "$pkgname.service")
@@ -20,55 +22,40 @@
 sha256sums=('c53ccb6df9fd7319d9ec3a3c21b5a602666b88bd6e05e769dd9fc290eefa2df0'
             'b22b470f9e02d2bbe0c266431948daaadd7e7f007c27a989bdfcb063ee58fac6')
 
-# BEGIN boilerplate nextcloud app versioning code, see nextcloud-app-* packages
-makedepends+=(nextcloud ripgrep yq)
-_get_nextcloud_versions() {
-	_app_min_major_version="$(< appinfo/info.xml xq -r '.info.dependencies.nextcloud["@min-version"] | values')"
-	_app_max_major_version="$(< appinfo/info.xml xq -r '.info.dependencies.nextcloud["@max-version"] | values | tonumber | .+1')"
-}
-_get_php_versions() {
-	local _phps=(php7 php)
+# BEGIN boilerplate nextcloud app version clamping, see also other packages in group
+# 1. Call respective function helpers in check() and package() *after* cd'ing to the source directory
+# 2. Add makedepends+=(nextcloud yq)
+_phps=(php7 php)
+_get_supported_ranges() {
+	_app_min_nextcloud="$(< appinfo/info.xml xq -r '.info.dependencies.nextcloud["@min-version"] | values')"
+	_app_max_nextcloud="$(< appinfo/info.xml xq -r '.info.dependencies.nextcloud["@max-version"] | values | tonumber | .+1')"
 	_app_min_php="$(< appinfo/info.xml xq -r '.info.dependencies.php["@min-version"] | values')"
 	_app_max_php="$(< appinfo/info.xml xq -r '.info.dependencies.php["@max-version"] | values | tonumber | .+0.1')"
-	_system_php=""
-	for _php in "${_phps[@]}"; do
-		if command -v "$_php" > /dev/null; then
-			_system_php="$_php"
-			break
-		fi
-	done
 }
+_unsupported_range() {
+	printf "%s requires %s %s, but %s %s is provided.\n" "$pkgname" "$1" "$2" "$1" "$3"
+	exit 1
+}
 _nextcloud_app_check() {
-	_get_nextcloud_versions
-	_get_php_versions
-	local _nextcloud_major_version="$("$_system_php" <(cat /usr/share/webapps/nextcloud/version.php; echo 'print($OC_Version[0]);'))"
-	if [[ "$(vercmp "$_nextcloud_major_version" "$_app_min_major_version")" -lt 0 ]] \
-	|| [[ "$(vercmp "$_nextcloud_major_version" "$_app_max_major_version")" -gt 0 ]] ; then
-		printf "%s requires nextcloud >= %s/ nextcloud <= %s, but nextcloud %s is provided.\n" \
-			"$pkgname" "$_app_min_major_version" "$_app_max_major_version" "$_nextcloud_major_version"
-		exit 1
-	fi
-	local _php_version="$("$_system_php" -r 'print(phpversion());')"
-	if [[ "$(vercmp "$_php_version" "$_app_min_php" )" -lt 0 ]]; then
-		printf "%s requires php-interpreter >= %s, but %s is provided\n" "$pkgname" "$_app_min_php" "$_php_version"
-		exit 1
-	fi
-	if [[ -n $_app_max_php ]]; then
-		if [[ "$(vercmp "$_php_version" "$_app_max_php" )" -ge 0 ]]; then
-		printf "%s requires php-interpreter < %s, but %s is provided\n" "$pkgname" "$_app_max_php" "$_php_version"
-		exit 1
-		fi
-	fi
+	_get_supported_ranges
+	for _php in "${_phps[@]}"; do command -v "$_php" > /dev/null && break; done
+	local _nextcloud_ver="$("$_php" <(cat /usr/share/webapps/nextcloud/version.php; echo 'print($OC_VersionString);'))"
+	local _php_ver="$("$_php" -r 'print(phpversion());')"
+	[[ "$(vercmp "${_app_min_nextcloud:-0}" "$_nextcloud_ver")" -le 0 ]] || \
+		_unsupported_range nextcloud "=> $_app_min_nextcloud" "$_nextcloud_ver"
+	[[ "$(vercmp "${_app_max_nextcloud:-999}" "$_nextcloud_ver")" -gt 0 ]] || \
+		_unsupported_range nextcloud "< $_app_max_nextcloud" "$_nextcloud_ver"
+	[[ "$(vercmp "${_app_min_php:-0}" "$_php_ver")" -le 0 ]] || \
+		_unsupported_range php ">= $_app_min_php" "$_php_ver"
+	[[ "$(vercmp "${_app_max_php:-999}" "$_php_ver")" -gt 0 ]] || \
+		_unsupported_range php "< $_app_max_php" "$_php_ver"
 }
 _nextcloud_app_package() {
-  _get_nextcloud_versions
-  _get_php_versions
-  depends=("nextcloud>=$_app_min_major_version" "nextcloud<$_app_max_major_version")
-  [[ -z "$_app_min_php" ]] || depends+=("php-interpreter>=$_app_min_php")
-  [[ -z "$_app_max_php" ]] || depends+=("php-interpreter<$_app_max_php")
-  [[ -z "$_app_min_php" && -z "$_app_max_php" ]] || depends+=(php-interpreter)
+	_get_supported_ranges
+	depends+=("nextcloud>=${_app_min_nextcloud:-0}" "nextcloud<${_app_max_nextcloud:-999}")
+	depends+=("php-interpreter${_app_min_php:+>=$_app_min_php}" ${_app_max_php:+"php-interpreter<$_app_max_php"})
 }
-# END boilerplate nextcloud app versioning code
+# END boilerplate nextcloud app version clamping
 
 prepare() {
 	cd "$_archive"



More information about the arch-commits mailing list