From dd9d541bf216715f4a3bbc426c38231db375717d Mon Sep 17 00:00:00 2001 From: "Anna (cybertailor) Vyalkova" Date: Tue, 9 Jul 2024 20:19:31 +0500 Subject: boinc-app.eclass: better wrapper install function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "dowrapper" had too much magic: it relied on specifically files being present in ${FILESDIR}, which is just… wrong. It will burn in flames without any backwards compatibility. New "boinc_install_wrapper" function replaces it. Signed-off-by: Anna (cybertailor) Vyalkova --- eclass/boinc-app.eclass | 62 +++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/eclass/boinc-app.eclass b/eclass/boinc-app.eclass index 540fc8ea0..6a386bf2f 100644 --- a/eclass/boinc-app.eclass +++ b/eclass/boinc-app.eclass @@ -236,61 +236,67 @@ boinc-wrapper_foreach_wrapper_job() { || die "$(basename "$1") sed failed" } -# @FUNCTION: dowrapper -# @USAGE: [more apps...] +# @FUNCTION: boinc_install_wrapper +# @USAGE: [new name] # @DESCRIPTION: # This function provides a uniform way to install wrapper applications # for BOINC projects. It makes symlinks to the BOINC wrapper and also # installs respective job.xml files. # -# When sci-misc/boinc-example-1.0 calls `dowrapper boinc-example` it: +# When `dowrapper boinc-example_wrapper A.xml B.xml` is called, it: # -# 1. Installs boinc-example_job_1.0.xml from ebuild's files/ directory -# to project's root directory +# 1. Installs A.xml in the project's root directory, renaming it to B.xml # -# 2. Installs boinc-example_wrapper_1.0 symlink, which points -# to /usr/bin/boinc-wrapper, to project's root directory +# 2. Installs boinc-example_wrapper symlink, which points +# to /usr/bin/boinc-wrapper, in the project's root directory # # Example: # @CODE # src_install() { # meson_src_install # -# dowrapper boinc-example boinc-sample +# boinc_install_wrapper boinc-example_wrapper "${FILESDIR}"/job.xml # doappinfo "${FILESDIR}"/app_info_${PV}.xml # } # @CODE # # Keep your job.xml files in sync with app_info.xml! -dowrapper() { +boinc_install_wrapper() { debug-print-function ${FUNCNAME} "${@}" - for app in "$@"; do - local wrapperjob="${app}_job_${PV}.xml" - local wrapperexe="${app}_wrapper_${PV}" + (( $# >= 2 && $# <= 3 )) || \ + die "${FUNCNAME} got wrong number of arguments" - [[ -f "${FILESDIR}/${wrapperjob}" ]] || \ - die "${wrapperjob} not found in ebuild's files/ directory" + local exe="${1:?}" + local job="${2:?}" + local job_dest="${3:-$(basename "${job:?}")}" - cp "${FILESDIR}/${wrapperjob}" "${T}" || die - - if declare -f foreach_wrapper_job >/dev/null; then - foreach_wrapper_job "${T}/${wrapperjob}" - else - boinc-wrapper_foreach_wrapper_job "${T}/${wrapperjob}" - fi + cp "${job:?}" "${T:?}/${job_dest:?}" || die + if declare -f foreach_wrapper_job >/dev/null; then + foreach_wrapper_job "${T:?}/${job_dest:?}" + else + boinc-wrapper_foreach_wrapper_job "${T:?}/${job_dest:?}" + fi - ( # subshell to avoid pollution of calling environment - insinto $(get_project_root) - insopts -m 0644 --owner root --group boinc - doins "${T}/${wrapperjob}" - dosym -r /usr/bin/boinc-wrapper "$(get_project_root)/${wrapperexe}" - ) || die "failed to install '${app}' wrapper app" - done + ( # subshell to avoid pollution of calling environment + insinto "$(get_project_root)" + insopts -m 0644 --owner root --group boinc + doins "${T:?}/${job_dest:?}" + ) || die "failed to install ${exe:?} wrapper job" + rm -f "${T:?}/${job_dest:?}" + dosym -r /usr/bin/boinc-wrapper "$(get_project_root)/${exe:?}" _boinc-app_fix_permissions } +# @FUNCTION: dowrapper +# @DEPRECATED: boinc_install_wrapper +# @DESCRIPTION: +# Install BOINC wrappers and job definitions. +dowrapper() { + die "${FUNCNAME} has been removed, please use boinc_install_wrapper instead" +} + # @FUNCTION: boinc-app_pkg_postinst # @DESCRIPTION: # Display helpful instructions on how to make the BOINC client use installed -- cgit v1.2.3-65-gdbad