public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Haelwenn Monnier" <contact@hacktivis.me>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:master commit in: eclass/
Date: Sun, 14 Jul 2024 15:27:15 +0000 (UTC)	[thread overview]
Message-ID: <1720941740.9cd4309b1e2f97a9d037a365639b8cb2049a26f0.lanodan@gentoo> (raw)

commit:     9cd4309b1e2f97a9d037a365639b8cb2049a26f0
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Fri Jul 12 08:54:47 2024 +0000
Commit:     Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
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 <cyber+gentoo <AT> 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: <writable app_info.xml>
+# @USAGE: <app_info>
 # @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
 }


             reply	other threads:[~2024-07-14 15:27 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-14 15:27 Haelwenn Monnier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-30 13:54 [gentoo-commits] repo/proj/guru:master commit in: eclass/ David Roman
2025-10-20 14:06 David Roman
2024-11-27 14:34 David Roman
2024-10-19  0:05 David Roman
2024-07-14 17:47 [gentoo-commits] repo/proj/guru:dev " Florian Schmaus
2024-07-14 17:47 ` [gentoo-commits] repo/proj/guru:master " Florian Schmaus
2024-07-14 15:27 Haelwenn Monnier
2024-07-14 15:27 Haelwenn Monnier
2024-07-14 15:27 Haelwenn Monnier
2024-07-14 15:27 Haelwenn Monnier
2024-07-14 15:27 Haelwenn Monnier
2024-07-14 15:27 Haelwenn Monnier
2024-07-01 13:50 David Roman
2024-04-27 11:10 David Roman
2024-04-01 11:32 Julien Roy
2024-03-31 17:57 Julien Roy
2024-03-31 17:49 [gentoo-commits] repo/proj/guru:dev " Julien Roy
2024-03-31 17:57 ` [gentoo-commits] repo/proj/guru:master " Julien Roy
2024-02-05 11:57 David Roman
2024-02-05 11:57 David Roman
2024-02-05 11:57 David Roman
2024-02-05 11:57 David Roman
2024-01-20 22:13 David Roman
2024-01-03 15:20 David Roman
2023-10-05 14:25 Viorel Munteanu
2023-10-05  6:18 Viorel Munteanu
2023-08-30  5:30 [gentoo-commits] repo/proj/guru:dev " Viorel Munteanu
2023-08-30  5:36 ` [gentoo-commits] repo/proj/guru:master " Viorel Munteanu
2023-08-07 12:51 David Roman
2023-08-07 12:51 David Roman
2023-08-04  7:26 [gentoo-commits] repo/proj/guru:dev " Florian Schmaus
2023-08-04  7:26 ` [gentoo-commits] repo/proj/guru:master " Florian Schmaus
2023-08-04  7:26 [gentoo-commits] repo/proj/guru:dev " Florian Schmaus
2023-08-04  7:26 ` [gentoo-commits] repo/proj/guru:master " Florian Schmaus
2023-07-17 14:24 Florian Schmaus
2023-06-26 11:24 Andrew Ammerlaan
2023-05-22  5:17 Viorel Munteanu
2023-05-22  5:17 Viorel Munteanu
2023-05-11 14:32 Andrew Ammerlaan
2023-05-11 14:32 Andrew Ammerlaan
2023-05-11 14:32 Andrew Ammerlaan
2023-05-11 14:32 Andrew Ammerlaan
2023-05-11 14:32 Andrew Ammerlaan
2023-04-13  7:02 Florian Schmaus
2023-04-01 21:30 Haelwenn Monnier
2023-04-01 21:30 Haelwenn Monnier
2023-04-01 21:30 Haelwenn Monnier
2023-02-27 15:06 Florian Schmaus
2023-02-27 15:06 Florian Schmaus
2023-01-08 10:27 Florian Schmaus
2022-12-09 16:26 Ronny Gutbrod
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-26 10:54 Florian Schmaus
2022-11-16 19:33 Florian Schmaus
2022-11-16 19:33 Florian Schmaus
2022-11-16 19:33 Florian Schmaus
2022-11-05 15:26 Arthur Zamarin
2022-07-20  9:35 Andrew Ammerlaan
2022-07-20  9:35 Andrew Ammerlaan
2022-07-20  9:35 Andrew Ammerlaan
2022-07-20  9:35 Andrew Ammerlaan
2022-07-20  9:35 Andrew Ammerlaan
2022-07-11  6:54 Andrew Ammerlaan
2022-06-30 17:39 Florian Schmaus
2022-06-29 15:38 Florian Schmaus
2022-06-29 15:38 Florian Schmaus
2022-06-14 18:35 Haelwenn Monnier
2022-06-14 18:35 Haelwenn Monnier
2022-06-14 18:35 Haelwenn Monnier
2022-05-12  9:14 Andrew Ammerlaan
2022-05-05 14:42 Haelwenn Monnier
2022-05-05 14:42 Haelwenn Monnier
2022-05-05 14:42 Haelwenn Monnier
2022-04-15 20:58 Haelwenn Monnier
2022-04-15 20:58 Haelwenn Monnier
2022-04-14 13:31 Andrew Ammerlaan
2022-04-12 19:35 Ronny Gutbrod
2022-04-12 19:35 Ronny Gutbrod
2022-04-12 19:35 Ronny Gutbrod
2022-02-20  8:46 Florian Schmaus
2022-02-20  8:46 Florian Schmaus
2021-10-06  1:13 Theo Anderson
2021-09-30 19:39 Arthur Zamarin
2021-09-08 15:20 Arthur Zamarin
2021-07-26 14:05 Andrew Ammerlaan
2021-06-02 16:00 Andrew Ammerlaan
2021-05-24 22:25 Haelwenn Monnier
2021-05-17 19:11 Andrew Ammerlaan
2021-03-16 10:49 Andrew Ammerlaan
2021-03-15 10:58 Andrew Ammerlaan
2021-03-15 10:58 Andrew Ammerlaan
2020-12-06 10:46 [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-12-06 10:49 ` [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-05-07 11:13 Andrew Ammerlaan
2020-05-07 11:13 Andrew Ammerlaan
2020-05-01 15:39 Andrew Ammerlaan
2020-04-28  8:01 Andrew Ammerlaan
2020-04-28  7:44 Andrew Ammerlaan
2020-04-21 10:23 Andrew Ammerlaan
2020-04-21 10:20 Andrew Ammerlaan
2020-04-07  7:42 Andrew Ammerlaan
2020-04-07  7:42 Andrew Ammerlaan
2020-04-07  7:27 [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:42 ` [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-07  7:16 [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:42 ` [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-06 18:26 [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:42 ` [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1720941740.9cd4309b1e2f97a9d037a365639b8cb2049a26f0.lanodan@gentoo \
    --to=contact@hacktivis.me \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox