Date: Sunday, May 8, 2022 @ 20:33:22 Author: dvzrv Revision: 1196307 archrelease: copy trunk to community-staging-any
Added: nextcloud-app-news/repos/community-staging-any/ nextcloud-app-news/repos/community-staging-any/PKGBUILD (from rev 1196306, nextcloud-app-news/trunk/PKGBUILD) ----------+ PKGBUILD | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) Copied: nextcloud-app-news/repos/community-staging-any/PKGBUILD (from rev 1196306, nextcloud-app-news/trunk/PKGBUILD) =================================================================== --- community-staging-any/PKGBUILD (rev 0) +++ community-staging-any/PKGBUILD 2022-05-08 20:33:22 UTC (rev 1196307) @@ -0,0 +1,92 @@ +# Maintainer: David Runge <dv...@archlinux.org> +# Contributor: Jonas Heinrich <o...@project-insanity.org> + +pkgname=nextcloud-app-news +_name=news +pkgver=18.0.1 +pkgrel=2 +pkgdesc="An RSS/Atom feed aggregator" +arch=(any) +url="https://github.com/nextcloud/news" +license=(AGPL3) +makedepends=(nextcloud ripgrep yq) +source=($pkgname-$pkgver.tar.gz::https://github.com/nextcloud/$_name/releases/download/$pkgver/$_name.tar.gz) +sha512sums=('18ebcc06e5b46dbea4295b5b0ba78cd1e71c77fb3492eca5ffaacf7d760ca98fbb8514f687400df58dd883ccd9f7b20e229935ce9e62c4343be8df01375b6cd1') +b2sums=('3c178c99788dda43cb02bc56c57e86df106e96a7b51f63049dbde8d30d14a51d00ed8327e29a2922803532b12bc1b69bf95a816e4c7a2a08cf72f21b5ed16c5e') + +_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) +} + +_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 +} + +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" )" -ge 0 ]]; then + printf "%s requires php-interpreter < %s, but %s is provided\n" $pkgname $_app_max_php $_php_version + exit 1 + fi + fi +} + +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/" +}