Re: [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8

2023-04-08 Thread Thomas Bracht Laumann Jespersen


>> -[ -f "${mark}" ]
>> +[[ -f "${mark}" ]]
>
> The quotes are no longer needed in [[ ]].

ack. Will include in a v2.

I'll also add a patch to add EAPI 8 to texlive-module.eclass.

-- Thomas



Re: [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8

2023-04-08 Thread Ulrich Mueller
> On Sat, 08 Apr 2023, Thomas Bracht Laumann Jespersen wrote:

> - [ -f "${mark}" ]
> + [[ -f "${mark}" ]]

The quotes are no longer needed in [[ ]].



[gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8

2023-04-08 Thread Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen 
---

As an initial step in the work to add texlive 2023, let's start with adding EAPI
8 support to texlive-common.eclass.

Needs a consideration for dosym -r in one place, and also changes a test block
with single brackets to double brackets.

 eclass/texlive-common.eclass | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index f43d10926857..d9d9caf364f4 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:
 # t...@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() {
# 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() {
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() {
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