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 B6E6715ACFB for ; Wed, 12 Apr 2023 19:15:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EF58FE07F2; Wed, 12 Apr 2023 19:15:34 +0000 (UTC) Received: from out-27.mta1.migadu.com (out-27.mta1.migadu.com [IPv6:2001:41d0:203:375::1b]) (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 99C68E07C7 for ; Wed, 12 Apr 2023 19:15:34 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=laumann.xyz; s=key1; t=1681326932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fu5qXmabqOdZaCGlX7o+9CPayTjxhvQ2f1WrsOThOxI=; b=EtWvVt7tYHONKolR9ynuuVis5yfzoWCrlQsjIFMXF9wfhF6iatvJ3ZdlGVOzfU2XcH/NRu aWo639pz2bMD5eddGynEd6zGp7gRBnbeWRMYK1wbSu+mUL48Oy0kzn0ZlQnD+nvWrOCr0q hmygoETdveKpAnX0Hx+rXoEyu/dmRt+uOetePt+0nkIHGmYIaEx95HIzL6B5R0cWJ9LGWa 0OHLBR+QHeo+Ua67Ddg8wKJeWfJ5Ncn0tR5X3bGB8JolX41JfUkWBb3th+8ALpqExndQNy 2mukG1MKe+9AijAS8tZZh7wgVtxHix+jC1n5l1IfiNVsNowy7FmCGGT/itj8yA== From: Thomas Bracht Laumann Jespersen To: gentoo-dev@lists.gentoo.org Cc: tex@gentoo.org, Thomas Bracht Laumann Jespersen Subject: [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: add EAPI 8 Date: Wed, 12 Apr 2023 21:14:34 +0200 Message-Id: <20230412191435.4209-1-t@laumann.xyz> In-Reply-To: <20230408143721.24644-1-t@laumann.xyz> References: <20230408143721.24644-1-t@laumann.xyz> 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-Migadu-Flow: FLOW_OUT X-Archives-Salt: 58e08e4b-aa0c-45a3-9db4-3fd11729ea79 X-Archives-Hash: dc04a6ab83b454c3e1f8fb07692290cb Signed-off-by: Thomas Bracht Laumann Jespersen --- v2 -> v3: * Change ${@} to $@ eclass/texlive-common.eclass | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass index f43d10926857..02ac9d72784a 100644 --- a/eclass/texlive-common.eclass +++ b/eclass/texlive-common.eclass @@ -1,176 +1,179 @@ # Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: texlive-common.eclass # @MAINTAINER: # tex@gentoo.org # @AUTHOR: # Original Author: Alexis Ballier -# @SUPPORTED_EAPIS: 7 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Provide various functions used by both texlive-core and texlive modules # @DESCRIPTION: # Purpose: Provide various functions used by both texlive-core and texlive # modules. # # Note that this eclass *must* not assume the presence of any standard tex too case ${EAPI} in 7) inherit eapi8-dosym ;; + 8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac if [[ -z ${_TEXLIVE_COMMON_ECLASS} ]]; then _TEXLIVE_COMMON_ECLASS=1 TEXMF_PATH=/usr/share/texmf TEXMF_DIST_PATH=/usr/share/texmf-dist TEXMF_VAR_PATH=/var/lib/texmf # @FUNCTION: texlive-common_handle_config_files # @DESCRIPTION: # Has to be called in src_install after having installed the files in ${D} # This function will move the relevant files to /etc/texmf and symling them # from their original location. This is to allow easy update of texlive's # configuration - texlive-common_handle_config_files() { + debug-print-function ${FUNCNAME} "$@" # Handle config files properly [[ -d ${ED}${TEXMF_PATH} ]] || return cd "${ED}${TEXMF_PATH}" || die + local dosym=dosym + [[ ${EAPI} == 7 ]] && dosym=dosym8 while read -r f; do if [[ ${f#*config} != ${f} || ${f#doc} != ${f} || ${f#source} != ${f} || ${f#tex} != ${f} ]] ; then continue fi dodir /etc/texmf/$(dirname ${f}).d einfo "Moving (and symlinking) ${EPREFIX}${TEXMF_PATH}/${f} to ${EPREFIX}/etc/texmf/$(dirname ${f}).d" mv "${ED}/${TEXMF_PATH}/${f}" "${ED}/etc/texmf/$(dirname ${f}).d" || die "mv ${f} failed." - dosym8 -r /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f} + "${dosym}" -r /etc/texmf/$(dirname ${f}).d/$(basename ${f}) ${TEXMF_PATH}/${f} done < <(find -name '*.cnf' -type f -o -name '*.cfg' -type f | sed -e "s:\./::g") } # @FUNCTION: texlive-common_is_file_present_in_texmf # @DESCRIPTION: # Return if a file is present in the texmf tree # Call it from the directory containing texmf and texmf-dist - texlive-common_is_file_present_in_texmf() { + debug-print-function ${FUNCNAME} "$@" local mark="${T}/${1}.found" if [[ -d texmf ]]; then find texmf -name ${1} -exec touch ${mark} {} + || die fi if [[ -d texmf-dist ]]; then find texmf-dist -name ${1} -exec touch ${mark} {} + || die fi - [ -f "${mark}" ] + [[ -f ${mark} ]] } # @FUNCTION: texlive-common_do_symlinks # @USAGE: # @DESCRIPTION: # Mimic the install_link function of texlinks # # Should have the same behavior as the one in /usr/bin/texlinks # except that it is under the control of the package manager # Note that $1 corresponds to $src and $2 to $dest in this function # ( Arguments are switched because texlinks main function sends them switched ) # This function should not be called from an ebuild, prefer etexlinks that will # also do the fmtutil file parsing. - texlive-common_do_symlinks() { + debug-print-function ${FUNCNAME} "$@" while [[ ${#} != 0 ]]; do case ${1} in cont-??|metafun|mptopdf) einfo "Symlink ${1} skipped (special case)" ;; mf) einfo "Symlink ${1} -> ${2} skipped (texlive-core takes care of it)" ;; *) if [[ ${1} == ${2} ]]; then einfo "Symlink ${1} -> ${2} skipped" elif [[ -e ${ED}/usr/bin/${1} || -L ${ED}/usr/bin/${1} ]]; then einfo "Symlink ${1} skipped (file exists)" else einfo "Making symlink from ${1} to ${2}" dosym ${2} /usr/bin/${1} fi ;; esac shift; shift; done } # @FUNCTION: etexlinks # @USAGE: # @DESCRIPTION: # Mimic texlinks on a fmtutil format file # # $1 has to be a fmtutil format file like fmtutil.cnf # etexlinks foo will install the symlinks that texlinks --cnffile foo would have # created. We cannot use texlinks with portage as it is not DESTDIR aware. # (It would not fail but will not create the symlinks if the target is not in # the same dir as the source) # Also, as this eclass must not depend on a tex distribution to be installed we # cannot use texlinks from here. - etexlinks() { + debug-print-function ${FUNCNAME} "$@" # Install symlinks from formats to engines texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}') } # @FUNCTION: dobin_texmf_scripts # @USAGE: [file2] ... # @DESCRIPTION: # Symlinks a script from the texmf tree to /usr/bin. Requires permissions to be # correctly set for the file that it will point to. - dobin_texmf_scripts() { + debug-print-function ${FUNCNAME} "$@" while [[ ${#} -gt 0 ]] ; do local trg=$(basename ${1} | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]') 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} shift done } # @FUNCTION: etexmf-update # @DESCRIPTION: # Runs texmf-update if it is available and prints a warning otherwise. This # function helps in factorizing some code. Useful in ebuilds' pkg_postinst and # pkg_postrm phases. - etexmf-update() { + debug-print-function ${FUNCNAME} "$@" if has_version 'app-text/texlive-core' ; then if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/sbin/texmf-update ]] ; then "${EPREFIX}"/usr/sbin/texmf-update else ewarn "Cannot run texmf-update for some reason." ewarn "Your texmf tree might be inconsistent with your configuration" ewarn "Please try to figure what has happened" fi fi } # @FUNCTION: efmtutil-sys # @DESCRIPTION: # Runs fmtutil-sys if it is available and prints a warning otherwise. This # function helps in factorizing some code. Used in ebuilds' pkg_postinst to # force a rebuild of TeX formats. - efmtutil-sys() { + debug-print-function ${FUNCNAME} "$@" if has_version 'app-text/texlive-core' ; then if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/bin/fmtutil-sys ]] ; then einfo "Rebuilding formats" "${EPREFIX}"/usr/bin/fmtutil-sys --all &> /dev/null || die else ewarn "Cannot run fmtutil-sys for some reason." ewarn "Your formats might be inconsistent with your installed ${PN} version" ewarn "Please try to figure what has happened" fi fi } fi -- 2.39.2