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

David Runge dvzrv at archlinux.org
Fri Apr 9 19:46:14 UTC 2021


    Date: Friday, April 9, 2021 @ 19:46:14
  Author: dvzrv
Revision: 915288

Add a check() function to guard against unsupported nextcloud versions.

Add a check() function, that compares the nextcloud major version against the
minimum and maximum requirement of the app and fails if unmatched.

Modified:
  nextcloud-app-deck/trunk/PKGBUILD

----------+
 PKGBUILD |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-04-09 19:45:55 UTC (rev 915287)
+++ PKGBUILD	2021-04-09 19:46:14 UTC (rev 915288)
@@ -14,14 +14,22 @@
 license=('AGPL3')
 groups=('nextcloud-apps')
 depends=('nextcloud')
-makedepends=('xmlstarlet')
+makedepends=('ripgrep' 'yq')
 source=("$pkgname-$pkgver.tar.gz::https://github.com/nextcloud/${_name}/releases/download/v${pkgver}/${_name}.tar.gz")
 sha512sums=('8986f40966c612ad71c422b099dad60776efeae93a9310ead2d585e84025410c2a5dcc71e322fe041cca3f374e0fb1f834440b431f15159cc68e29e9c149a03c')
 b2sums=('babbec1dd61d157c58a096b7e6eef269ff467c11213782ed60e1ce76ed3e96e6c2b1a9376c3f5f34ad3b32cd06bd6c28fbaf592a9ea3f34c2e282305013d9c3f')
 
+check() {
+  local _app_min_major_version="$(xq '.info.dependencies.nextcloud["@min-version"]' "${_name}/appinfo/info.xml"| sed 's/"//g')"
+  local _app_max_major_version="$(xq '.info.dependencies.nextcloud["@max-version"]' "${_name}/appinfo/info.xml"| sed 's/"//g')"
+  local _nextcloud_major_version="$(rg "OC_Version = " /usr/share/webapps/nextcloud/version.php |cut -d'(' -f2| cut -d ',' -f1)"
+  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
+}
+
 package() {
-  depends=("nextcloud>="$(xmlstarlet sel -t -v '/info/dependencies/nextcloud/@min-version' deck/appinfo/info.xml)
-           "nextcloud<="$(xmlstarlet sel -t -v '/info/dependencies/nextcloud/@min-version' deck/appinfo/info.xml))
   install -vdm 755 "${pkgdir}/usr/share/webapps/nextcloud/apps/"
   cp -av "${_name}" "${pkgdir}/usr/share/webapps/nextcloud/apps/"
 }



More information about the arch-commits mailing list