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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 99A271581C1 for ; Tue, 16 Jul 2024 09:36:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E56EE2BC061; Tue, 16 Jul 2024 09:35:57 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8D64A2BC037 for ; Tue, 16 Jul 2024 09:35:57 +0000 (UTC) From: Florian Schmaus To: gentoo-dev@lists.gentoo.org Cc: tex@gentoo.org, Florian Schmaus Subject: [gentoo-dev] [PATCH] texlive-common.eclass: Add TEXLIVE_SCRIPTS_W_FILE_EXT variable Date: Tue, 16 Jul 2024 11:33:10 +0200 Message-ID: <20240716093310.324520-1-flow@gentoo.org> X-Mailer: git-send-email 2.44.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: d444c2d7-af09-473e-b58e-073e26e2a31e X-Archives-Hash: 32f5d76e85afe6230e1784ff8416ad8c Some scripts are supposed to be installed with file extensions [1, 2]. Add support for declaring those scripts in a new elcass variable TEXLIVE_SCRIPTS_W_FILE_EXT. Also use pure-bash functions to retrieve the basename and strip the file extensions. And use "declare -l" to lowercase the value of 'trg', instead of 'tr' [3]. 1: https://tug.org/pipermail/tldistro/2024q3/000485.html 2: https://github.com/TeX-Live/texlive-source/blob/c087bab35570b1d5cb0afd272611a7a4ec3c9e38/texk/texlive/linked_scripts/Makefile.am#L332-L333 3: https://github.com/TeX-Live/texlive-source/blob/c087bab35570b1d5cb0afd272611a7a4ec3c9e38/texk/texlive/linked_scripts/Makefile.am#L330 Bug: https://bugs.gentoo.org/934975 Signed-off-by: Florian Schmaus --- eclass/texlive-common.eclass | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass index 072581dde78e..36b90a327fde 100644 --- a/eclass/texlive-common.eclass +++ b/eclass/texlive-common.eclass @@ -42,6 +42,13 @@ _TEXLIVE_COMMON_ECLASS=1 # @CODE : "${CTAN_MIRROR_URL:="https://mirrors.ctan.org"}" +# @ECLASS_VARIABLE: TEXLIVE_SCRIPTS_W_FILE_EXT +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, contains a space separated list of script names that should be +# linked including their file extensions, i.e., without stripping +# potentially existing filename extensions from the link's name. + # @FUNCTION: texlive-common_handle_config_files # @DESCRIPTION: # Has to be called in src_install after having installed the files in ${D} @@ -160,8 +167,17 @@ etexlinks() { # Called by app-text/epspdf and texlive-module.eclass. dobin_texmf_scripts() { while [[ ${#} -gt 0 ]] ; do - local trg - trg=$(basename "${1}" | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]') + # -l: TexLive target links are always lowercase. + local -l trg + + # Get the basename of the script. + trg="${1##*/}" + + # Only strip the filename extensions if trg is not listed in TEXLIVE_SCRIPTS_W_FILE_EXT. + if ! has "${trg}" ${TEXLIVE_SCRIPTS_W_FILE_EXT}; then + trg="${trg%.*}" + fi + einfo "Installing ${1} as ${trg} bin wrapper" [[ -x ${ED}/usr/share/${1} ]] || die "Trying to install a non existing or non executable symlink to /usr/bin: ${1}" dosym "../share/${1}" "/usr/bin/${trg}" -- 2.44.2