* [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8
@ 2023-04-08 14:37 Thomas Bracht Laumann Jespersen
2023-04-08 15:34 ` Ulrich Mueller
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-08 14:37 UTC (permalink / raw
To: gentoo-dev; +Cc: tex, Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
---
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:
# 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
# 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: <src> <dest>
# @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: <file>
# @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() {
# Install symlinks from formats to engines
texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}')
}
# @FUNCTION: dobin_texmf_scripts
# @USAGE: <file1> [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() {
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() {
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() {
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8
2023-04-08 14:37 [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8 Thomas Bracht Laumann Jespersen
@ 2023-04-08 15:34 ` Ulrich Mueller
2023-04-08 19:32 ` Thomas Bracht Laumann Jespersen
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 1/2] " Thomas Bracht Laumann Jespersen
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: " Thomas Bracht Laumann Jespersen
2 siblings, 1 reply; 7+ messages in thread
From: Ulrich Mueller @ 2023-04-08 15:34 UTC (permalink / raw
To: Thomas Bracht Laumann Jespersen; +Cc: gentoo-dev, tex
>>>>> On Sat, 08 Apr 2023, Thomas Bracht Laumann Jespersen wrote:
> - [ -f "${mark}" ]
> + [[ -f "${mark}" ]]
The quotes are no longer needed in [[ ]].
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8
2023-04-08 15:34 ` Ulrich Mueller
@ 2023-04-08 19:32 ` Thomas Bracht Laumann Jespersen
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-08 19:32 UTC (permalink / raw
To: Ulrich Mueller; +Cc: gentoo-dev, tex
>> - [ -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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH v2 1/2] texlive-common.eclass: add EAPI 8
2023-04-08 14:37 [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8 Thomas Bracht Laumann Jespersen
2023-04-08 15:34 ` Ulrich Mueller
@ 2023-04-09 15:58 ` Thomas Bracht Laumann Jespersen
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 2/2] texlive-module.eclass: " Thomas Bracht Laumann Jespersen
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: " Thomas Bracht Laumann Jespersen
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-09 15:58 UTC (permalink / raw
To: gentoo-dev; +Cc: tex, Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
---
v1 -> v2:
* remove unnecessary quotation in [[ .. ]] construct as per ulm's feedback
* add debug-print-function to all functions (just seems like a potentially
useful addition)
* remove blank line between function docs and declaration
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..401ccce31519 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 <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
# 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: <src> <dest>
# @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: <file>
# @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: <file1> [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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH v2 2/2] texlive-module.eclass: add EAPI 8
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 1/2] " Thomas Bracht Laumann Jespersen
@ 2023-04-09 15:58 ` Thomas Bracht Laumann Jespersen
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-09 15:58 UTC (permalink / raw
To: gentoo-dev; +Cc: tex, Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
---
Does not appear to need any additional EAPI 8 considerations. Add
debug-print-function lines to all functions.
eclass/texlive-module.eclass | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index fea4003c37a8..b0e48587bb68 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -1,453 +1,460 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: texlive-module.eclass
# @MAINTAINER:
# 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
# only have to inherit this eclass.
# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list
# of packages that it will install. (See below)
#
# For TeX Live versions prior to 2009, the ebuild was supposed to unpack the
# texmf and texmf-dist directories to ${WORKDIR} (which is what the default
# src_unpack does).
# Starting from TeX Live 2009, the eclass provides a src_unpack function taking
# care of unpacking and relocating the files that need it.
#
# It inherits texlive-common. Patching is supported via the PATCHES
# bash array.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed. This variable will be expanded to
# SRC_URI:
# foo -> texlive-module-foo-${PV}.tar.xz
# @ECLASS_VARIABLE: TEXLIVE_MODULE_DOC_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed if the doc useflag is enabled.
# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_SRC_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed if the source useflag is enabled.
# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_BINSCRIPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of files that are in fact scripts installed in the
# texmf tree and that we want to be available directly. They will be installed in
# /usr/bin.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_BINLINKS
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of links to add for BINSCRIPTS.
# The syntax is: foo:bar to create a symlink bar -> foo.
# @ECLASS_VARIABLE: TL_PV
# @INTERNAL
# @DESCRIPTION:
# Normally the module's PV reflects the TeXLive release it belongs to.
# If this is not the case, TL_PV takes the version number for the
# needed app-text/texlive-core.
# @ECLASS_VARIABLE: TL_MODULE_INFORMATION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Information to display about the package.
# e.g. for enabling/disabling a feature
case ${EAPI} in
- 7) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_TEXLIVE_MODULE_ECLASS} ]]; then
_TEXLIVE_MODULE_ECLASS=1
inherit texlive-common
HOMEPAGE="http://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 }
# 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"
for i in ${TEXLIVE_MODULE_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
# Forge doc SRC_URI
[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} doc? ("
for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} )"
# Forge source SRC_URI
if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]] ; then
SRC_URI="${SRC_URI} source? ("
for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
SRC_URI="${SRC_URI} )"
fi
RDEPEND="${COMMON_DEPEND}"
IUSE="${IUSE} doc"
# @ECLASS_VARIABLE: TEXLIVE_MODULE_OPTIONAL_ENGINE
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of Tex engines that can be made optional.
# e.g. "luatex luajittex"
if [[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] ; then
for engine in ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ; do
IUSE="${IUSE} +${engine}"
done
fi
S="${WORKDIR}"
# @FUNCTION: texlive-module_src_unpack
# @DESCRIPTION:
# 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() {
+ debug-print-function ${FUNCNAME} "${@}"
unpack ${A}
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
while read i; do
mv "${i}" "${RELOC_TARGET}/${i%/*}" || die
done < "${T}/reloclist"
}
# @FUNCTION: texlive-module_add_format
# @DESCRIPTION:
# Creates/appends to a format.${PN}.cnf file for fmtutil.
# It parses the AddFormat directive of tlpobj files to create it.
# This will make fmtutil generate the formats when asked and allow the remaining
# src_compile phase to build the formats.
texlive-module_add_format() {
+ debug-print-function ${FUNCNAME} "${@}"
local name engine mode patterns options
eval $@
einfo "Appending to format.${PN}.cnf for $@"
if [[ ! -d texmf-dist/fmtutil ]]; then
mkdir -p texmf-dist/fmtutil || die
fi
[[ -f texmf-dist/fmtutil/format.${PN}.cnf ]] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
[[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] && has ${engine} ${TEXLIVE_MODULE_OPTIONAL_ENGINE} && use !${engine} && mode="disabled"
if [[ ${mode} = disabled ]]; then
printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf || die
fi
[[ -z ${patterns} ]] && patterns="-"
printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf || die
}
# @FUNCTION: texlive-module_make_language_def_lines
# @DESCRIPTION:
# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d.
# It parses the AddHyphen directive of tlpobj files to create it.
texlive-module_make_language_def_lines() {
+ debug-print-function ${FUNCNAME} "${@}"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.def entry for $@"
[[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
[[ -z ${righthyphenmin} ]] && righthyphenmin="3"
echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
if [[ -n ${synonyms} ]]; then
for i in $(echo $synonyms | tr ',' ' ') ; do
einfo "Generating language.def synonym $i for $@"
echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
done
fi
}
# @FUNCTION: texlive-module_make_language_dat_lines
# @DESCRIPTION:
# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d.
# It parses the AddHyphen directive of tlpobj files to create it.
texlive-module_make_language_dat_lines() {
+ debug-print-function ${FUNCNAME} "${@}"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.dat entry for $@"
echo "$name $file" >> "${S}/language.${PN}.dat" || die
if [[ -n ${synonyms} ]]; then
for i in $(echo ${synonyms} | tr ',' ' ') ; do
einfo "Generating language.dat synonym ${i} for $@"
echo "=${i}" >> "${S}/language.${PN}.dat" || die
done
fi
}
# @FUNCTION: texlive-module_synonyms_to_language_lua_line
# @DESCRIPTION:
# Helper function for texlive-module_make_language_lua_lines to generate a
# correctly formatted synonyms entry for language.dat.lua.
texlive-module_synonyms_to_language_lua_line() {
+ debug-print-function ${FUNCNAME} "${@}"
local prev=""
for i in $(echo $@ | tr ',' ' ') ; do
printf "${prev} '%s'" ${i}
prev=","
done
}
# @FUNCTION: texlive-module_make_language_lua_lines
# @DESCRIPTION:
-# Only valid for TeXLive 2010 and later.
# Creates a language.${PN}.dat.lua entry to put in
# /etc/texmf/language.dat.lua.d.
# It parses the AddHyphen directive of tlpobj files to create it.
-
+# Only valid for TeXLive 2010 and later.
texlive-module_make_language_lua_lines() {
+ debug-print-function ${FUNCNAME} "${@}"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
local dest="${S}/language.${PN}.dat.lua"
eval $@
[[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
[[ -z ${righthyphenmin} ]] && righthyphenmin="3"
einfo "Generating language.dat.lua entry for $@"
printf "\t['%s'] = {\n" "${name}" >> "${dest}" || die
printf "\t\tloader = '%s',\n" "${file}" >> "${dest}" || die
printf "\t\tlefthyphenmin = %s,\n\t\trighthyphenmin = %s,\n" "${lefthyphenmin}" "${righthyphenmin}" >> "${dest}" || die
printf "\t\tsynonyms = {%s },\n" "$(texlive-module_synonyms_to_language_lua_line "${synonyms}")" >> "${dest}" || die
if [[ -n ${file_patterns} ]]; then
printf "\t\tpatterns = '%s',\n" "${file_patterns}" >> "${dest}" || die
fi
if [[ -n ${file_exceptions} ]]; then
printf "\t\thyphenation = '%s',\n" "${file_exceptions}" >> "${dest}" || die
fi
if [[ -n ${luaspecial} ]]; then
printf "\t\tspecial = '%s',\n" "$luaspecial" >> "${dest}" || die
fi
printf "\t},\n" >> "${dest}" || die
}
# @FUNCTION: texlive-module_src_compile
# @DESCRIPTION:
# exported function:
# Generates the config files that are to be installed in /etc/texmf;
# texmf-update script will take care of merging the different config files for
# different packages in a single one used by the whole tex installation.
#
# Once the config files are generated, we build the format files using fmtutil
# (provided by texlive-core). The compiled format files will be sent to
# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
# sandbox.
-
texlive-module_src_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
# Generate config files from the tlpobj files provided by TeX Live 2008 and
# later
for i in "${S}"/tlpkg/tlpobj/*;
do
grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' \t' '##' >> "${T}/jobs" || die
done
for i in $(<"${T}/jobs");
do
j="$(echo $i | tr '#' ' ')"
command=${j%% *}
parameter=${j#* }
case ${command} in
addMap)
echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
addMixedMap)
echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
addKanjiMap)
echo "KanjiMap ${parameter}" >> "${S}/${PN}.cfg";;
addDvipsMap)
echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
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}
;;
AddFormat)
texlive-module_add_format ${parameter};;
BuildFormat)
einfo "Format ${parameter} already built.";;
BuildLanguageDat)
einfo "Language file $parameter already generated.";;
*)
die "No rule to process ${command}. Please file a bug."
esac
done
# Determine texlive-core version for fmtutil call
- fmt_call="$(has_version '>=app-text/texlive-core-2019' \
- && echo "fmtutil-user" || echo "fmtutil")"
+ fmt_call="$(has_version '>=app-text/texlive-core-2019' \
+ && echo "fmtutil-user" || echo "fmtutil")"
# Build format files
for i in texmf-dist/fmtutil/format*.cnf; do
if [[ -f ${i} ]]; then
einfo "Building format ${i}"
if [[ ! -d texmf-var ]]; then
mkdir texmf-var || die
fi
if [[ ! -d texmf-var/web2c ]]; then
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\
|| die "failed to build format ${i}"
fi
done
# Delete ls-R files, these should not be created but better be certain they
# do not end up being installed.
find . -name 'ls-R' -delete || die
}
# @FUNCTION: texlive-module_src_install
# @DESCRIPTION:
# exported function:
# Installs texmf and config files to the system.
-
texlive-module_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
for i in texmf-dist/fmtutil/format*.cnf; do
[[ -f ${i} ]] && etexlinks "${i}"
done
dodir /usr/share
if use doc; then
if [[ -d texmf-doc ]]; then
cp -pR texmf-doc "${ED}/usr/share/" || die
fi
else
if [[ -d texmf-dist/doc ]]; then
rm -rf texmf-dist/doc || die
fi
if [[ -d texmf/doc ]]; then
rm -rf texmf/doc || die
fi
fi
if [[ -d texmf ]]; then
cp -pR texmf "${ED}/usr/share/" || die
fi
if [[ -d texmf-dist ]]; then
cp -pR texmf-dist "${ED}/usr/share/" || die
fi
if [[ -d tlpkg ]] && use source; then
cp -pR tlpkg "${ED}/usr/share/" || die
fi
if [[ -d texmf-var ]]; then
insinto /var/lib/texmf
doins -r texmf-var/.
fi
insinto /etc/texmf/updmap.d
[[ -f ${S}/${PN}.cfg ]] && doins "${S}/${PN}.cfg"
insinto /etc/texmf/dvips.d
[[ -f ${S}/${PN}-config.ps ]] && doins "${S}/${PN}-config.ps"
insinto /etc/texmf/dvipdfm/config
[[ -f ${S}/${PN}-config ]] && doins "${S}/${PN}-config"
if [[ -f ${S}/language.${PN}.def ]] ; then
insinto /etc/texmf/language.def.d
doins "${S}/language.${PN}.def"
fi
if [[ -f ${S}/language.${PN}.dat ]] ; then
insinto /etc/texmf/language.dat.d
doins "${S}/language.${PN}.dat"
fi
if [[ -f ${S}/language.${PN}.dat.lua ]] ; then
insinto /etc/texmf/language.dat.lua.d
doins "${S}/language.${PN}.dat.lua"
fi
[[ -n ${TEXLIVE_MODULE_BINSCRIPTS} ]] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
if [[ -n ${TEXLIVE_MODULE_BINLINKS} ]] ; then
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#*:}
done
fi
texlive-common_handle_config_files
TEXMF_PATH=${TEXMF_DIST_PATH} texlive-common_handle_config_files
}
# @FUNCTION: texlive-module_pkg_postinst
# @DESCRIPTION:
# exported function:
# Run texmf-update to ensure the tex installation is consistent with the
# installed texmf trees.
texlive-module_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "${@}"
etexmf-update
[[ -n ${TL_MODULE_INFORMATION} ]] && elog "${TL_MODULE_INFORMATION}"
}
# @FUNCTION: texlive-module_pkg_postrm
# @DESCRIPTION:
# exported function:
# Run texmf-update to ensure the tex installation is consistent with the
# installed texmf trees.
texlive-module_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "${@}"
etexmf-update
}
fi
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: add EAPI 8
2023-04-08 14:37 [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8 Thomas Bracht Laumann Jespersen
2023-04-08 15:34 ` Ulrich Mueller
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 1/2] " Thomas Bracht Laumann Jespersen
@ 2023-04-12 19:14 ` Thomas Bracht Laumann Jespersen
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 2/2] texlive-module.eclass: " Thomas Bracht Laumann Jespersen
2 siblings, 1 reply; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-12 19:14 UTC (permalink / raw
To: gentoo-dev; +Cc: tex, Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
---
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 <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
# 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: <src> <dest>
# @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: <file>
# @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: <file1> [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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH v3 2/2] texlive-module.eclass: add EAPI 8
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: " Thomas Bracht Laumann Jespersen
@ 2023-04-12 19:14 ` Thomas Bracht Laumann Jespersen
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bracht Laumann Jespersen @ 2023-04-12 19:14 UTC (permalink / raw
To: gentoo-dev; +Cc: tex, Thomas Bracht Laumann Jespersen
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
---
v2 -> v3:
* Change ${@} to $@
eclass/texlive-module.eclass | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index fea4003c37a8..6b9e443be9c0 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -1,453 +1,460 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: texlive-module.eclass
# @MAINTAINER:
# 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
# only have to inherit this eclass.
# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list
# of packages that it will install. (See below)
#
# For TeX Live versions prior to 2009, the ebuild was supposed to unpack the
# texmf and texmf-dist directories to ${WORKDIR} (which is what the default
# src_unpack does).
# Starting from TeX Live 2009, the eclass provides a src_unpack function taking
# care of unpacking and relocating the files that need it.
#
# It inherits texlive-common. Patching is supported via the PATCHES
# bash array.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed. This variable will be expanded to
# SRC_URI:
# foo -> texlive-module-foo-${PV}.tar.xz
# @ECLASS_VARIABLE: TEXLIVE_MODULE_DOC_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed if the doc useflag is enabled.
# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_SRC_CONTENTS
# @PRE_INHERIT
# @REQUIRED
# @DESCRIPTION:
# The list of packages that will be installed if the source useflag is enabled.
# Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_BINSCRIPTS
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of files that are in fact scripts installed in the
# texmf tree and that we want to be available directly. They will be installed in
# /usr/bin.
# @ECLASS_VARIABLE: TEXLIVE_MODULE_BINLINKS
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of links to add for BINSCRIPTS.
# The syntax is: foo:bar to create a symlink bar -> foo.
# @ECLASS_VARIABLE: TL_PV
# @INTERNAL
# @DESCRIPTION:
# Normally the module's PV reflects the TeXLive release it belongs to.
# If this is not the case, TL_PV takes the version number for the
# needed app-text/texlive-core.
# @ECLASS_VARIABLE: TL_MODULE_INFORMATION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Information to display about the package.
# e.g. for enabling/disabling a feature
case ${EAPI} in
- 7) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_TEXLIVE_MODULE_ECLASS} ]]; then
_TEXLIVE_MODULE_ECLASS=1
inherit texlive-common
HOMEPAGE="http://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 }
# 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"
for i in ${TEXLIVE_MODULE_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
# Forge doc SRC_URI
[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} doc? ("
for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} )"
# Forge source SRC_URI
if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]] ; then
SRC_URI="${SRC_URI} source? ("
for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
for tldev in ${TEXLIVE_DEVS}; do
SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}"
done
done
SRC_URI="${SRC_URI} )"
fi
RDEPEND="${COMMON_DEPEND}"
IUSE="${IUSE} doc"
# @ECLASS_VARIABLE: TEXLIVE_MODULE_OPTIONAL_ENGINE
# @DEFAULT_UNSET
# @DESCRIPTION:
# A space separated list of Tex engines that can be made optional.
# e.g. "luatex luajittex"
if [[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] ; then
for engine in ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ; do
IUSE="${IUSE} +${engine}"
done
fi
S="${WORKDIR}"
# @FUNCTION: texlive-module_src_unpack
# @DESCRIPTION:
# 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() {
+ debug-print-function ${FUNCNAME} "$@"
unpack ${A}
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
while read i; do
mv "${i}" "${RELOC_TARGET}/${i%/*}" || die
done < "${T}/reloclist"
}
# @FUNCTION: texlive-module_add_format
# @DESCRIPTION:
# Creates/appends to a format.${PN}.cnf file for fmtutil.
# It parses the AddFormat directive of tlpobj files to create it.
# This will make fmtutil generate the formats when asked and allow the remaining
# src_compile phase to build the formats.
texlive-module_add_format() {
+ debug-print-function ${FUNCNAME} "$@"
local name engine mode patterns options
eval $@
einfo "Appending to format.${PN}.cnf for $@"
if [[ ! -d texmf-dist/fmtutil ]]; then
mkdir -p texmf-dist/fmtutil || die
fi
[[ -f texmf-dist/fmtutil/format.${PN}.cnf ]] || { echo "# Generated for ${PN} by texlive-module.eclass" > texmf-dist/fmtutil/format.${PN}.cnf; }
[[ -n ${TEXLIVE_MODULE_OPTIONAL_ENGINE} ]] && has ${engine} ${TEXLIVE_MODULE_OPTIONAL_ENGINE} && use !${engine} && mode="disabled"
if [[ ${mode} = disabled ]]; then
printf "#! " >> texmf-dist/fmtutil/format.${PN}.cnf || die
fi
[[ -z ${patterns} ]] && patterns="-"
printf "${name}\t${engine}\t${patterns}\t${options}\n" >> texmf-dist/fmtutil/format.${PN}.cnf || die
}
# @FUNCTION: texlive-module_make_language_def_lines
# @DESCRIPTION:
# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d.
# It parses the AddHyphen directive of tlpobj files to create it.
texlive-module_make_language_def_lines() {
+ debug-print-function ${FUNCNAME} "$@"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.def entry for $@"
[[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
[[ -z ${righthyphenmin} ]] && righthyphenmin="3"
echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
if [[ -n ${synonyms} ]]; then
for i in $(echo $synonyms | tr ',' ' ') ; do
einfo "Generating language.def synonym $i for $@"
echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def" || die
done
fi
}
# @FUNCTION: texlive-module_make_language_dat_lines
# @DESCRIPTION:
# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d.
# It parses the AddHyphen directive of tlpobj files to create it.
texlive-module_make_language_dat_lines() {
+ debug-print-function ${FUNCNAME} "$@"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
eval $@
einfo "Generating language.dat entry for $@"
echo "$name $file" >> "${S}/language.${PN}.dat" || die
if [[ -n ${synonyms} ]]; then
for i in $(echo ${synonyms} | tr ',' ' ') ; do
einfo "Generating language.dat synonym ${i} for $@"
echo "=${i}" >> "${S}/language.${PN}.dat" || die
done
fi
}
# @FUNCTION: texlive-module_synonyms_to_language_lua_line
# @DESCRIPTION:
# Helper function for texlive-module_make_language_lua_lines to generate a
# correctly formatted synonyms entry for language.dat.lua.
texlive-module_synonyms_to_language_lua_line() {
+ debug-print-function ${FUNCNAME} "$@"
local prev=""
for i in $(echo $@ | tr ',' ' ') ; do
printf "${prev} '%s'" ${i}
prev=","
done
}
# @FUNCTION: texlive-module_make_language_lua_lines
# @DESCRIPTION:
-# Only valid for TeXLive 2010 and later.
# Creates a language.${PN}.dat.lua entry to put in
# /etc/texmf/language.dat.lua.d.
# It parses the AddHyphen directive of tlpobj files to create it.
-
+# Only valid for TeXLive 2010 and later.
texlive-module_make_language_lua_lines() {
+ debug-print-function ${FUNCNAME} "$@"
local lefthyphenmin righthyphenmin synonyms name file file_patterns file_exceptions luaspecial
local dest="${S}/language.${PN}.dat.lua"
eval $@
[[ -z ${lefthyphenmin} ]] && lefthyphenmin="2"
[[ -z ${righthyphenmin} ]] && righthyphenmin="3"
einfo "Generating language.dat.lua entry for $@"
printf "\t['%s'] = {\n" "${name}" >> "${dest}" || die
printf "\t\tloader = '%s',\n" "${file}" >> "${dest}" || die
printf "\t\tlefthyphenmin = %s,\n\t\trighthyphenmin = %s,\n" "${lefthyphenmin}" "${righthyphenmin}" >> "${dest}" || die
printf "\t\tsynonyms = {%s },\n" "$(texlive-module_synonyms_to_language_lua_line "${synonyms}")" >> "${dest}" || die
if [[ -n ${file_patterns} ]]; then
printf "\t\tpatterns = '%s',\n" "${file_patterns}" >> "${dest}" || die
fi
if [[ -n ${file_exceptions} ]]; then
printf "\t\thyphenation = '%s',\n" "${file_exceptions}" >> "${dest}" || die
fi
if [[ -n ${luaspecial} ]]; then
printf "\t\tspecial = '%s',\n" "$luaspecial" >> "${dest}" || die
fi
printf "\t},\n" >> "${dest}" || die
}
# @FUNCTION: texlive-module_src_compile
# @DESCRIPTION:
# exported function:
# Generates the config files that are to be installed in /etc/texmf;
# texmf-update script will take care of merging the different config files for
# different packages in a single one used by the whole tex installation.
#
# Once the config files are generated, we build the format files using fmtutil
# (provided by texlive-core). The compiled format files will be sent to
# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
# sandbox.
-
texlive-module_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
# Generate config files from the tlpobj files provided by TeX Live 2008 and
# later
for i in "${S}"/tlpkg/tlpobj/*;
do
grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' \t' '##' >> "${T}/jobs" || die
done
for i in $(<"${T}/jobs");
do
j="$(echo $i | tr '#' ' ')"
command=${j%% *}
parameter=${j#* }
case ${command} in
addMap)
echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
addMixedMap)
echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
addKanjiMap)
echo "KanjiMap ${parameter}" >> "${S}/${PN}.cfg";;
addDvipsMap)
echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
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}
;;
AddFormat)
texlive-module_add_format ${parameter};;
BuildFormat)
einfo "Format ${parameter} already built.";;
BuildLanguageDat)
einfo "Language file $parameter already generated.";;
*)
die "No rule to process ${command}. Please file a bug."
esac
done
# Determine texlive-core version for fmtutil call
- fmt_call="$(has_version '>=app-text/texlive-core-2019' \
- && echo "fmtutil-user" || echo "fmtutil")"
+ fmt_call="$(has_version '>=app-text/texlive-core-2019' \
+ && echo "fmtutil-user" || echo "fmtutil")"
# Build format files
for i in texmf-dist/fmtutil/format*.cnf; do
if [[ -f ${i} ]]; then
einfo "Building format ${i}"
if [[ ! -d texmf-var ]]; then
mkdir texmf-var || die
fi
if [[ ! -d texmf-var/web2c ]]; then
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\
|| die "failed to build format ${i}"
fi
done
# Delete ls-R files, these should not be created but better be certain they
# do not end up being installed.
find . -name 'ls-R' -delete || die
}
# @FUNCTION: texlive-module_src_install
# @DESCRIPTION:
# exported function:
# Installs texmf and config files to the system.
-
texlive-module_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
for i in texmf-dist/fmtutil/format*.cnf; do
[[ -f ${i} ]] && etexlinks "${i}"
done
dodir /usr/share
if use doc; then
if [[ -d texmf-doc ]]; then
cp -pR texmf-doc "${ED}/usr/share/" || die
fi
else
if [[ -d texmf-dist/doc ]]; then
rm -rf texmf-dist/doc || die
fi
if [[ -d texmf/doc ]]; then
rm -rf texmf/doc || die
fi
fi
if [[ -d texmf ]]; then
cp -pR texmf "${ED}/usr/share/" || die
fi
if [[ -d texmf-dist ]]; then
cp -pR texmf-dist "${ED}/usr/share/" || die
fi
if [[ -d tlpkg ]] && use source; then
cp -pR tlpkg "${ED}/usr/share/" || die
fi
if [[ -d texmf-var ]]; then
insinto /var/lib/texmf
doins -r texmf-var/.
fi
insinto /etc/texmf/updmap.d
[[ -f ${S}/${PN}.cfg ]] && doins "${S}/${PN}.cfg"
insinto /etc/texmf/dvips.d
[[ -f ${S}/${PN}-config.ps ]] && doins "${S}/${PN}-config.ps"
insinto /etc/texmf/dvipdfm/config
[[ -f ${S}/${PN}-config ]] && doins "${S}/${PN}-config"
if [[ -f ${S}/language.${PN}.def ]] ; then
insinto /etc/texmf/language.def.d
doins "${S}/language.${PN}.def"
fi
if [[ -f ${S}/language.${PN}.dat ]] ; then
insinto /etc/texmf/language.dat.d
doins "${S}/language.${PN}.dat"
fi
if [[ -f ${S}/language.${PN}.dat.lua ]] ; then
insinto /etc/texmf/language.dat.lua.d
doins "${S}/language.${PN}.dat.lua"
fi
[[ -n ${TEXLIVE_MODULE_BINSCRIPTS} ]] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
if [[ -n ${TEXLIVE_MODULE_BINLINKS} ]] ; then
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#*:}
done
fi
texlive-common_handle_config_files
TEXMF_PATH=${TEXMF_DIST_PATH} texlive-common_handle_config_files
}
# @FUNCTION: texlive-module_pkg_postinst
# @DESCRIPTION:
# exported function:
# Run texmf-update to ensure the tex installation is consistent with the
# installed texmf trees.
texlive-module_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "$@"
etexmf-update
[[ -n ${TL_MODULE_INFORMATION} ]] && elog "${TL_MODULE_INFORMATION}"
}
# @FUNCTION: texlive-module_pkg_postrm
# @DESCRIPTION:
# exported function:
# Run texmf-update to ensure the tex installation is consistent with the
# installed texmf trees.
texlive-module_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
etexmf-update
}
fi
EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-12 19:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-08 14:37 [gentoo-dev] [PATCH] texlive-common.eclass: add EAPI 8 Thomas Bracht Laumann Jespersen
2023-04-08 15:34 ` Ulrich Mueller
2023-04-08 19:32 ` Thomas Bracht Laumann Jespersen
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 1/2] " Thomas Bracht Laumann Jespersen
2023-04-09 15:58 ` [gentoo-dev] [PATCH v2 2/2] texlive-module.eclass: " Thomas Bracht Laumann Jespersen
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 1/2] texlive-common.eclass: " Thomas Bracht Laumann Jespersen
2023-04-12 19:14 ` [gentoo-dev] [PATCH v3 2/2] texlive-module.eclass: " Thomas Bracht Laumann Jespersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox