From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7BF0A1581C1 for ; Sun, 14 Jul 2024 07:27:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8C7ECE2B2D; Sun, 14 Jul 2024 07:27:34 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 68076E2B2D for ; Sun, 14 Jul 2024 07:27:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7DF61340CC9 for ; Sun, 14 Jul 2024 07:27:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 682B11E25 for ; Sun, 14 Jul 2024 07:27:30 +0000 (UTC) From: "Anna Vyalkova" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anna Vyalkova" Message-ID: <1720941740.9cd4309b1e2f97a9d037a365639b8cb2049a26f0.cybertailor@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/boinc-app.eclass X-VCS-Directories: eclass/ X-VCS-Committer: cybertailor X-VCS-Committer-Name: Anna Vyalkova X-VCS-Revision: 9cd4309b1e2f97a9d037a365639b8cb2049a26f0 X-VCS-Branch: dev Date: Sun, 14 Jul 2024 07:27:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 23b398dd-e31b-445b-ae2f-d2440580a4e9 X-Archives-Hash: cebc66497ff4654709448e8df0d62bce commit: 9cd4309b1e2f97a9d037a365639b8cb2049a26f0 Author: Anna (cybertailor) Vyalkova sysrq in> AuthorDate: Fri Jul 12 08:54:47 2024 +0000 Commit: Anna Vyalkova sysrq in> CommitDate: Sun Jul 14 07:22:20 2024 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=9cd4309b boinc-app.eclass: remove excess and fix style Signed-off-by: Anna (cybertailor) Vyalkova sysrq.in> eclass/boinc-app.eclass | 56 +++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/eclass/boinc-app.eclass b/eclass/boinc-app.eclass index f6fb82034..822c84397 100644 --- a/eclass/boinc-app.eclass +++ b/eclass/boinc-app.eclass @@ -26,6 +26,7 @@ case ${EAPI} in esac # @ECLASS_VARIABLE: BOINC_APP_OPTIONAL +# @PRE_INHERIT # @DEFAULT_UNSET # @DESCRIPTION: # If set to a non-null value, BOINC part in the ebuild will be @@ -55,6 +56,7 @@ if [[ ! ${_BOINC_APP_ECLASS} ]]; then # it's published on project's website. # @ECLASS_VARIABLE: HOMEPAGE +# @OUTPUT_VARIABLE # @DESCRIPTION: # This variable defines the HOMEPAGE for BOINC projects if BOINC_MASTER_URL # was set before inherit. @@ -105,20 +107,7 @@ boinc-app_add_deps() { fi } -# @FUNCTION: boinc_master_url_check -# @USAGE: -# @DESCRIPTION: -# Make sure BOINC_MASTER_URL has a value. -boinc_master_url_check() { - debug-print-function ${FUNCNAME} "${@}" - - [[ -n ${BOINC_MASTER_URL} ]] || \ - die "BOINC_MASTER_URL is not set" - return 0 -} - # @FUNCTION: get_boincdir -# @USAGE: # @RETURN: non-prefixed BOINC runtime directory get_boincdir() { echo "${BOINC_RUNTIMEDIR:-/var/lib/boinc}" @@ -126,7 +115,6 @@ get_boincdir() { # @FUNCTION: get_project_dirname # @INTERNAL -# @USAGE: # @RETURN: project's dirname, derived from BOINC_MASTER_URL # @DESCRIPTION: # Example: @@ -137,9 +125,8 @@ get_boincdir() { # -> boinc.berkeley.edu_example # @CODE get_project_dirname() { - debug-print-function ${FUNCNAME} "${@}" - - boinc_master_url_check + [[ ${BOINC_MASTER_URL} ]] || \ + die "BOINC_MASTER_URL is not set" local dirname dirname=${BOINC_MASTER_URL#*://} # strip http[s]:// @@ -150,16 +137,12 @@ get_project_dirname() { } # @FUNCTION: get_project_root -# @USAGE: # @RETURN: non-prefixed directory where applications and files should be installed get_project_root() { - debug-print-function ${FUNCNAME} "${@}" - echo "$(get_boincdir)/projects/$(get_project_dirname)" } # @FUNCTION: _boinc-app_fix_permissions -# @USAGE: # @INTERNAL # @DESCRIPTION: # Fix owner and permissions for the project root. @@ -174,14 +157,17 @@ _boinc-app_fix_permissions() { } # @FUNCTION: boinc-app_appinfo_prepare -# @USAGE: +# @USAGE: # @DESCRIPTION: # The default appinfo_prepare(). It replaces all occurences # of @PV@ with its corresponding value. boinc-app_appinfo_prepare() { debug-print-function ${FUNCNAME} "${@}" - sed -i "$1" \ + (( $# == 1 )) || \ + die "${FUNCNAME} takes exactly one argument" + + sed -i "${1:?}" \ -e "s:@PV@:${PV}:g" \ || die "app_info.xml sed failed" } @@ -251,6 +237,9 @@ doappinfo() { boinc-app_foreach_wrapper_job() { debug-print-function ${FUNCNAME} "${@}" + (( $# == 1 )) || \ + die "${FUNCNAME} takes exactly one argument" + sed -i "${1:?}" \ -e "s:@PV@:${PV}:g" \ -e "s:@EPREFIX@:${EPREFIX}:g" \ @@ -327,16 +316,13 @@ boinc-app_pkg_postinst() { debug-print-function ${FUNCNAME} "${@}" if [[ -f "${EROOT}/$(get_boincdir)/master_$(get_project_dirname).xml" ]]; then - if [[ -z ${REPLACING_VERSIONS} ]]; then + if [[ ! ${REPLACING_VERSIONS} ]]; then # most likely replacing applications downloaded # by the BOINC client from project's website elog "Restart the BOINC daemon for changes to take place:" elog "# rc-service boinc restart" - return - else - # applications are already in use - return fi + return fi elog @@ -347,10 +333,10 @@ boinc-app_pkg_postinst() { if [[ ! ${BOINC_INVITATION_CODE} ]]; then elog "# rc-service boinc attach" - elog " Enter the Project URL: ${BOINC_MASTER_URL}" + elog " Enter the Project URL: ${BOINC_MASTER_URL:?}" else - elog "- Master URL: ${BOINC_MASTER_URL}" - elog "- Invitation code: ${BOINC_INVITATION_CODE}" + elog "- Master URL: ${BOINC_MASTER_URL:?}" + elog "- Invitation code: ${BOINC_INVITATION_CODE:?}" fi } @@ -361,17 +347,17 @@ boinc-app_pkg_postinst() { boinc-app_pkg_postrm() { debug-print-function ${FUNCNAME} "${@}" - if [[ -z ${REPLACED_BY_VERSION} ]]; then + if [[ ! ${REPLACED_BY_VERSION} ]]; then local gui_rpc_auth="$(get_boincdir)/gui_rpc_auth.cfg" local passwd=$(cat "${EROOT}/${gui_rpc_auth}" 2>/dev/null) - if [[ -z ${passwd} ]]; then - passwd="\$(cat ${gui_rpc_auth})" + if [[ ! ${passwd?} ]]; then + passwd="\$(cat ${gui_rpc_auth:?})" fi elog "You should detach this project from the BOINC client" elog "to stop current tasks and delete remaining project files:" elog - elog "$ boinccmd --passwd ${passwd} --project ${BOINC_MASTER_URL} detach" + elog "$ boinccmd --passwd ${passwd:?} --project ${BOINC_MASTER_URL:?} detach" elog fi }