Date: Saturday, October 1, 2022 @ 11:47:12 Author: dvzrv Revision: 1320133
upgpkg: nextcloud-app-deck 1:1.7.1-1: Upgrade to 1.7.1. Use boilerplate code for nextcloud apps also used for other apps. Switch to https://github.com/nextcloud-releases/deck for releases because that's apparently where releases end up sometimes for unknown reasons... https://github.com/nextcloud/deck/issues/3869 Modified: nextcloud-app-deck/trunk/PKGBUILD ----------+ PKGBUILD | 116 +++++++++++++++++++++++-------------------------------------- 1 file changed, 44 insertions(+), 72 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-10-01 11:43:04 UTC (rev 1320132) +++ PKGBUILD 2022-10-01 11:47:12 UTC (rev 1320133) @@ -3,8 +3,8 @@ pkgname=nextcloud-app-deck _name=deck -pkgver=1.7.0 -pkgrel=2 +pkgver=1.7.1 +pkgrel=1 # upstream doesn't adhere to semver: # https://github.com/nextcloud/deck/issues/1197 epoch=1 @@ -13,82 +13,54 @@ url="https://github.com/nextcloud/deck" license=(AGPL3) groups=(nextcloud-apps) -makedepends=(nextcloud ripgrep yq) -source=($_name-$pkgver.tar.gz::https://github.com/nextcloud/$_name/releases/download/v$pkgver/$_name.tar.gz) -sha512sums=('cf8a74e6469be2bf143ce4a3e4065384c014080b996f9e4877333a308ce7c29af43502399e88be824ca37aeb85b208d149c3425dda7ea7445f7f1a2f660bff54') -b2sums=('586dbaf964fd9b14115b0042f79347fd527e15c7faaf01b2e90e0bc40136e42598a8dc3b701fe09aecdf8047de9ab7c0e229ddc0246610768612d5b99400d89b') +makedepends=(nextcloud yq) +source=($_name-$pkgver.tar.gz::https://github.com/nextcloud-releases/$_name/releases/download/v$pkgver/$_name-v$pkgver.tar.gz) +sha512sums=('7d489dea724d8dd3bcca6d50379eba2b344bf44936bbc47a6a6001b0349b5886e8da2ebd5489cff2a4110294f8ef6c4fd4efa8b235d2ba5d19390bd5174eb6c6') +b2sums=('958ef0484437933d866a893638fd5a3042aa8fefa5d6ee4773e4ce42358fb91d6cf3c52d81029e8a1686dead5617415d0102733a406ed311ad214f156d317a26') -_get_nextcloud_versions() { - _app_min_major_version="$(xq '.info.dependencies.nextcloud["@min-version"]' "${_name}/appinfo/info.xml"| sed 's/"//g')" - _app_max_major_version="$(xq '.info.dependencies.nextcloud["@max-version"]' "${_name}/appinfo/info.xml"| sed 's/"//g')" - _app_max_major_version=$(expr ${_app_max_major_version} + 1) +# 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')" } - -_get_php_versions() { - local _phps=(php7 php) - - _app_min_php="$(xq '.info.dependencies.php["@min-version"]' "$_name/appinfo/info.xml"| sed 's/"//g')" - _app_max_php="$(xq '.info.dependencies.php["@max-version"]' "$_name/appinfo/info.xml"| sed 's/"//g')" - if [[ $_app_max_php != 'null' ]]; then - _app_max_php="$(echo $_app_max_php | awk -F '.' '{print $1"."$2+1}')" - fi - _system_php="" - for _php in "${_phps[@]}"; do - if command -v "$_php" > /dev/null; then - if [[ -z "$_system_php" ]]; then - _system_php="$_php" - fi - 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_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_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 version clamping check() { - local _app_min_major_version - local _app_max_major_version - _get_nextcloud_versions - _get_php_versions - - 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 - - local _php_version="$(php --version |head -n1 |cut -d ' ' -f2 |sed 's/.[0-9]*$//g')" - 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 [[ $_app_max_php != 'null' ]]; then - if [[ "$(vercmp "$_php_version" "$_app_max_php" )" -lt 0 ]]; then - printf "%s requires php-interpreter < %s, but %s is provided\n" $pkgname $_app_max_php $_php_version - exit 1 - fi - fi + cd $_name + _nextcloud_app_check } package() { - _get_nextcloud_versions - _get_php_versions - - depends=( - "nextcloud>=$_app_min_major_version" - "nextcloud<$_app_max_major_version" - ) - if [[ "$_app_min_php" != 'null' ]]; then - depends+=( - "php-interpreter>=$_app_min_php" - ) - fi - if [[ "$_app_max_php" != 'null' ]]; then - depends+=( - "php-interpreter<$_app_max_php" - ) - fi - if [[ "$_app_min_php" == 'null' ]] && [[ "$_app_max_php" == 'null' ]]; then - depends+=(php-interpreter) - fi - - install -vdm 755 "${pkgdir}/usr/share/webapps/nextcloud/apps/" - cp -av "${_name}" "${pkgdir}/usr/share/webapps/nextcloud/apps/" + install -vdm 755 "$pkgdir/usr/share/webapps/nextcloud/apps/" + cp -av $_name "$pkgdir/usr/share/webapps/nextcloud/apps/" + cd $_name + _nextcloud_app_package }
