* [gentoo-dev] [PATCH 2/2] texlive-{common,module}.eclass: update for TeX Live 2023
2024-01-16 9:26 [gentoo-dev] [PATCH 0/2] texlive eclass updates, in preperation of TeX Live 2023 bump Florian Schmaus
2024-01-16 9:26 ` [gentoo-dev] [PATCH 1/2] profiles/thirdpartymirrors: add 'ctan' mirror Florian Schmaus
@ 2024-01-16 9:26 ` Florian Schmaus
2024-01-16 10:35 ` Ulrich Mueller
1 sibling, 1 reply; 5+ messages in thread
From: Florian Schmaus @ 2024-01-16 9:26 UTC (permalink / raw
To: gentoo-dev; +Cc: Paul Zander, tex, Florian Schmaus
Update the texlive eclasses for the upcoming TeX Live 2023 bump. This
includes general cleanup of the eclasses, e.g., reducing the scope of
variables.
Notably changes include that installation of the TeX Live distribution
changes from /usr/share/texmf to /usr/share/texmf-dist, which is the
correct place, according to upstream.
Co-authored-by: Paul Zander <negril.nx+gentoo@gmail.com>
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
eclass/texlive-common.eclass | 113 +++++++++++++++++++++++++----------
eclass/texlive-module.eclass | 77 ++++++++----------------
2 files changed, 108 insertions(+), 82 deletions(-)
diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index f43d10926857..5de58300f2f3 100644
--- a/eclass/texlive-common.eclass
+++ b/eclass/texlive-common.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: texlive-common.eclass
@@ -6,7 +6,7 @@
# tex@gentoo.org
# @AUTHOR:
# Original Author: Alexis Ballier <aballier@gentoo.org>
-# @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
@@ -15,53 +15,66 @@
# Note that this eclass *must* not assume the presence of any standard tex too
case ${EAPI} in
- 7) inherit eapi8-dosym ;;
+ 7)
+ inherit eapi8-dosym
+ dosym(){ dosym8 "$@"; }
+ ;;
+ 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
+# This function will move the relevant files to /etc/texmf and symlink them
# from their original location. This is to allow easy update of texlive's
-# configuration
-
+# configuration.
+# Called by app-text/texlive-core and texlive-module.eclass.
texlive-common_handle_config_files() {
+ local texmf_path
+ # Starting with TeX Live 2023, we install in texmf-dist, where a
+ # distribution-provided TeX Live installation is supposed to be,
+ # instead of texmf.
+ if ver_test -ge 2023; then
+ texmf_path=/usr/share/texmf-dist
+ else
+ texmf_path=/usr/share/texmf
+ fi
+
# Handle config files properly
- [[ -d ${ED}${TEXMF_PATH} ]] || return
- cd "${ED}${TEXMF_PATH}" || die
+ [[ -d ${ED}${texmf_path} ]] || return
+ cd "${ED}${texmf_path}" || die
while read -r f; do
- if [[ ${f#*config} != ${f} || ${f#doc} != ${f} || ${f#source} != ${f} || ${f#tex} != ${f} ]] ; then
+ 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}
- done < <(find -name '*.cnf' -type f -o -name '*.cfg' -type f | sed -e "s:\./::g")
+ local rel_dir
+ rel_dir="$(dirname "${f}")"
+
+ dodir "/etc/texmf/${rel_dir}.d"
+ einfo "Moving (and symlinking) ${EPREFIX}${texmf_path}/${f} to ${EPREFIX}/etc/texmf/${rel_dir}.d"
+ mv "${ED}/${texmf_path}/${f}" "${ED}/etc/texmf/${rel_dir}.d" || die "mv ${f} failed."
+ dosym -r "/etc/texmf/${rel_dir}.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
-
+# Called by app-text/texlive-core.
texlive-common_is_file_present_in_texmf() {
local mark="${T}/${1}.found"
if [[ -d texmf ]]; then
- find texmf -name ${1} -exec touch ${mark} {} + || die
+ find texmf -name "${1}" -exec touch "${mark}" {} + || die
fi
if [[ -d texmf-dist ]]; then
- find texmf-dist -name ${1} -exec touch ${mark} {} + || die
+ find texmf-dist -name "${1}" -exec touch "${mark}" {} + || die
fi
[ -f "${mark}" ]
}
@@ -77,7 +90,7 @@ texlive-common_is_file_present_in_texmf() {
# ( 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.
-
+# Called by texlive-common.eclass and texlive-module.eclass.
texlive-common_do_symlinks() {
while [[ ${#} != 0 ]]; do
case ${1} in
@@ -88,13 +101,13 @@ texlive-common_do_symlinks() {
einfo "Symlink ${1} -> ${2} skipped (texlive-core takes care of it)"
;;
*)
- if [[ ${1} == ${2} ]]; then
+ 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}
+ dosym "${2}" "/usr/bin/${1}"
fi
;;
esac
@@ -114,7 +127,7 @@ texlive-common_do_symlinks() {
# 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.
-
+# Called by texlive-module.eclass.
etexlinks() {
# Install symlinks from formats to engines
texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
@@ -125,13 +138,14 @@ etexlinks() {
# @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.
-
+# Called by app-text/epspdf and texlive-module.eclass.
dobin_texmf_scripts() {
while [[ ${#} -gt 0 ]] ; do
- local trg=$(basename ${1} | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]')
+ local trg
+ 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}
+ dosym "../share/${1}" "/usr/bin/${trg}"
shift
done
}
@@ -141,7 +155,8 @@ dobin_texmf_scripts() {
# 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.
-
+# Called by app-text/dvipsk, app-text/texlive-core, dev-libs/kpathsea, and
+# texlive-module.eclass.
etexmf-update() {
if has_version 'app-text/texlive-core' ; then
if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/sbin/texmf-update ]] ; then
@@ -159,7 +174,6 @@ etexmf-update() {
# 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() {
if has_version 'app-text/texlive-core' ; then
if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/bin/fmtutil-sys ]] ; then
@@ -173,4 +187,43 @@ efmtutil-sys() {
fi
}
+# @FUNCTION: texlive-common_append_to_src_uri
+# @DESCRIPTION:
+# Takes the name of a variable as input. The variable must contain a
+# list of texlive packages. Every texlive package in the variable is
+# transformed to an URL and appended to SRC_URI.
+texlive-common_append_to_src_uri() {
+ local tl_uri=( ${!1} )
+
+ # Starting from TeX Live 2009, upstream provides .tar.xz modules.
+ local tl_pkgext=tar.xz
+
+ local tl_uri_prefix="https://dev.gentoo.org/~@dev@/distfiles/texlive/tl-"
+ local tl_2023_uri_prefix="https://dev.gentoo.org/~@dev@/distfiles/texlive/"
+
+ local tl_dev
+ # If the version is less than 2023 and the package is the
+ # dev-texlive category, we fallback to the old SRC_URI layout. With
+ # the 2023 bump, packages outside the dev-texlive category start to
+ # inherit texlive-common.eclass.
+ if ver_test -lt 2023 && [[ ${CATEGORY} == dev-texlive ]]; then
+ local texlive_lt_2023_devs=( zlogene dilfridge sam )
+ local tl_uri_suffix="-${PV}.${tl_pkgext}"
+
+ tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" )
+ for tl_dev in "${texlive_lt_2023_devs[@]}"; do
+ SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tl_dev}}}"
+ done
+ else
+ local texlive_ge_2023_devs=( flow )
+ local tl_mirror="mirror://ctan/systems/texlive/tlnet/archive/"
+
+ tl_uri=( "${tl_uri[@]/%/.${tl_pkgext}}" )
+ SRC_URI+=" ${tl_uri[*]/#/${tl_mirror}}"
+ for tl_dev in "${texlive_ge_2023_devs[@]}"; do
+ SRC_URI+=" ${tl_uri[*]/#/${tl_2023_uri_prefix/@dev@/${tl_dev}}}"
+ done
+ fi
+}
+
fi
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 9e7e5db2e8f8..afcd4532975a 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: texlive-module.eclass
@@ -6,7 +6,7 @@
# tex@gentoo.org
# @AUTHOR:
# Original Author: Alexis Ballier <aballier@gentoo.org>
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Provide generic install functions so that modular texlive's texmf ebuild will only have to inherit this eclass
# @DESCRIPTION:
# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will
@@ -72,7 +72,7 @@
# e.g. for enabling/disabling a feature
case ${EAPI} in
- 7) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -83,59 +83,33 @@ inherit texlive-common
HOMEPAGE="https://www.tug.org/texlive/"
-COMMON_DEPEND=">=app-text/texlive-core-${TL_PV:-${PV}}"
-
-IUSE="source"
-
-# Starting from TeX Live 2009, upstream provides .tar.xz modules.
-PKGEXT=tar.xz
-
-# Now where should we get these files?
-TEXLIVE_DEVS=${TEXLIVE_DEVS:- zlogene dilfridge sam }
+IUSE="doc source"
+RDEPEND=">=app-text/texlive-core-${TL_PV:-${PV}}"
# We do not need anything from SYSROOT:
# Everything is built from the texlive install in /
# Generated files are noarch
-BDEPEND="${COMMON_DEPEND}
- app-arch/xz-utils"
+BDEPEND="
+ ${RDEPEND}
+ app-arch/xz-utils
+"
-tl_uri_prefix="https://dev.gentoo.org/~@dev@/distfiles/texlive/tl-"
-tl_uri_suffix="-${PV}.${PKGEXT}"
-
-tl_uri=( ${TEXLIVE_MODULE_CONTENTS} )
-tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" )
-for tldev in ${TEXLIVE_DEVS}; do
- SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}"
-done
+texlive-common_append_to_src_uri TEXLIVE_MODULE_CONTENTS
# Forge doc SRC_URI
if [[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]]; then
SRC_URI+=" doc? ("
- tl_uri=( ${TEXLIVE_MODULE_DOC_CONTENTS} )
- tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" )
- for tldev in ${TEXLIVE_DEVS}; do
- SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}"
- done
+ texlive-common_append_to_src_uri TEXLIVE_MODULE_DOC_CONTENTS
SRC_URI+=" )"
fi
# Forge source SRC_URI
if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]]; then
SRC_URI+=" source? ("
- tl_uri=( ${TEXLIVE_MODULE_SRC_CONTENTS} )
- tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" )
- for tldev in ${TEXLIVE_DEVS}; do
- SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}"
- done
+ texlive-common_append_to_src_uri TEXLIVE_MODULE_SRC_CONTENTS
SRC_URI+=" )"
fi
-unset tldev tl_uri tl_uri_prefix tl_uri_suffix
-
-RDEPEND="${COMMON_DEPEND}"
-
-IUSE="${IUSE} doc"
-
# @ECLASS_VARIABLE: TEXLIVE_MODULE_OPTIONAL_ENGINE
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -155,17 +129,16 @@ S="${WORKDIR}"
# Only for TeX Live 2009 and later.
# After unpacking, the files that need to be relocated are moved accordingly.
-RELOC_TARGET=texmf-dist
-
texlive-module_src_unpack() {
unpack ${A}
+ local RELOC_TARGET=texmf-dist
sed -n -e 's:\s*RELOC/::p' tlpkg/tlpobj/* > "${T}/reloclist" || die
sed -e 's/\/[^/]*$//' -e "s:^:${RELOC_TARGET}/:" "${T}/reloclist" |
sort -u |
xargs mkdir -p || die
local i dir="" files=()
- while read i; do
+ while read -r i; do
if [[ ${RELOC_TARGET}/${i%/*} != "${dir}" ]]; then
# new dir, do the previous move
[[ -z ${dir} ]] || mv "${files[@]}" "${dir}" || die
@@ -282,7 +255,7 @@ texlive-module_make_language_lua_lines() {
fi
if [[ -n ${luaspecial} ]]; then
- printf "\t\tspecial = '%s',\n" "$luaspecial" >> "${dest}" || die
+ printf "\t\tspecial = '%s',\n" "${luaspecial}" >> "${dest}" || die
fi
printf "\t},\n" >> "${dest}" || die
@@ -310,7 +283,7 @@ texlive-module_src_compile() {
for i in $(<"${T}/jobs");
do
- j="$(echo $i | tr '#' ' ')"
+ j="$(echo "${i}" | tr '#' ' ')"
command=${j%% *}
parameter=${j#* }
case ${command} in
@@ -325,16 +298,16 @@ texlive-module_src_compile() {
addDvipdfmMap)
echo "f ${parameter}" >> "${S}/${PN}-config";;
AddHyphen)
- texlive-module_make_language_def_lines ${parameter}
- texlive-module_make_language_dat_lines ${parameter}
- texlive-module_make_language_lua_lines ${parameter}
+ texlive-module_make_language_def_lines "${parameter}"
+ texlive-module_make_language_dat_lines "${parameter}"
+ texlive-module_make_language_lua_lines "${parameter}"
;;
AddFormat)
- texlive-module_add_format ${parameter};;
+ texlive-module_add_format "${parameter}";;
BuildFormat)
einfo "Format ${parameter} already built.";;
BuildLanguageDat)
- einfo "Language file $parameter already generated.";;
+ einfo "Language file ${parameter} already generated.";;
*)
die "No rule to process ${command}. Please file a bug."
esac
@@ -355,7 +328,7 @@ texlive-module_src_compile() {
mkdir texmf-var/web2c || die
fi
VARTEXFONTS="${T}/fonts" TEXMFHOME="${S}/texmf:${S}/texmf-dist:${S}/texmf-var"\
- env -u TEXINPUTS $fmt_call --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
+ env -u TEXINPUTS "${fmt_call}" --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
|| die "failed to build format ${i}"
fi
done
@@ -431,14 +404,14 @@ texlive-module_src_install() {
[[ -n ${TEXLIVE_MODULE_BINSCRIPTS} ]] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
if [[ -n ${TEXLIVE_MODULE_BINLINKS} ]] ; then
+ dodir "/usr/bin"
for i in ${TEXLIVE_MODULE_BINLINKS} ; do
- [[ -f ${ED}/usr/bin/${i%:*} ]] || die "Trying to install an invalid BINLINK. This should not happen. Please file a bug."
- dosym ${i%:*} /usr/bin/${i#*:}
+ [[ -f ${ED}/usr/bin/${i%:*} ]] || die "Trying to install an invalid BINLINK ${i%:*}. This should not happen. Please file a bug."
+ dosym "${i%:*}" "/usr/bin/${i#*:}"
done
fi
texlive-common_handle_config_files
- TEXMF_PATH=${TEXMF_DIST_PATH} texlive-common_handle_config_files
}
# @FUNCTION: texlive-module_pkg_postinst
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread