diff options
author | Florian Schmaus <flow@gentoo.org> | 2023-11-17 10:40:04 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-11-17 10:43:42 +0100 |
commit | 13ea75aeff018cb119264c9a5935ba91f7ce495a (patch) | |
tree | c5c65a7a09f328b91eefb92bb3060c7e2755eb88 | |
parent | texlive-module.elcass: fuse EAPI case (diff) | |
download | tex-overlay-13ea75aeff018cb119264c9a5935ba91f7ce495a.tar.gz tex-overlay-13ea75aeff018cb119264c9a5935ba91f7ce495a.tar.bz2 tex-overlay-13ea75aeff018cb119264c9a5935ba91f7ce495a.zip |
texlive-{common,module}.eclass: reduce diff and cleanup
In preperation for the review of the eclass changes on the gentoo-dev
mailing list, cleanup the code and reduce the diff to the current
eclasses.
Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r-- | eclass/texlive-common.eclass | 60 | ||||
-rw-r--r-- | eclass/texlive-module.eclass | 11 |
2 files changed, 37 insertions, 34 deletions
diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass index 9d6e959..7cab06f 100644 --- a/eclass/texlive-common.eclass +++ b/eclass/texlive-common.eclass @@ -18,7 +18,7 @@ case ${EAPI} in 7) inherit eapi8-dosym dosym(){ dosym8 "$@"; } - ;; # BUG + ;; 8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -26,37 +26,39 @@ esac if [[ -z ${_TEXLIVE_COMMON_ECLASS} ]]; then _TEXLIVE_COMMON_ECLASS=1 -# BUG -TEXMF_PATH=/usr/share/texmf-dist -# TEXMF_DIST_PATH=/usr/share/texmf-dist -# TEXMF_VAR_PATH=/var/lib/texmf - -TEXDIR= -TEXMFDIST= -TEXMFSYSVAR= -TEXMFSYSCONFIG= -TEXMFLOCAL= -TEXMFVAR= - # @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 symlink them from their original location. -# This is to allow easy update of texlive's configuration -# VIA app-text/texlive-core eclass/texlive-module.eclass +# 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. +# 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 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." - dosym -r "/etc/texmf/$(dirname "${f}").d/$(basename "${f}")" "${TEXMF_PATH}/${f}" + 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") } @@ -64,7 +66,7 @@ texlive-common_handle_config_files() { # @DESCRIPTION: # Return if a file is present in the texmf tree # Call it from the directory containing texmf and texmf-dist -# VIA app-text/texlive-core +# Called by app-text/texlive-core. texlive-common_is_file_present_in_texmf() { local mark="${T}/${1}.found" if [[ -d texmf ]]; then @@ -88,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. -# VIA eclass/texlive-common.eclass eclass/texlive-module.eclass +# Called by texlive-common.eclass and texlive-module.eclass. texlive-common_do_symlinks() { while [[ ${#} != 0 ]]; do case ${1} in @@ -125,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. -# VIA eclass/texlive-module.eclass +# Called by texlive-module.eclass. etexlinks() { # Install symlinks from formats to engines texlive-common_do_symlinks $(sed '/^[ ]*#/d; /^[ ]*$/d' "$1" | awk '{print $1, $2}') @@ -136,7 +138,7 @@ 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. -# VIA app-text/epspdf eclass/texlive-module.eclass +# Called by app-text/epspdf and texlive-module.eclass. dobin_texmf_scripts() { while [[ ${#} -gt 0 ]] ; do local trg @@ -153,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. -# VIA app-text/dvipsk app-text/texlive-core dev-libs/kpathsea eclass/texlive-module.eclass +# 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 @@ -171,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. -# VIA efmtutil-sys() { if has_version 'app-text/texlive-core' ; then if [[ -z ${ROOT} && -x "${EPREFIX}"/usr/bin/fmtutil-sys ]] ; then @@ -225,5 +227,3 @@ texlive-common_append_to_src_uri() { } fi - -unset TEXDIR TEXMFDIST TEXMFSYSVAR TEXMFSYSCONFIG TEXMFLOCAL TEXMFVAR diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass index 0ecab81..2a1d7bb 100644 --- a/eclass/texlive-module.eclass +++ b/eclass/texlive-module.eclass @@ -155,7 +155,8 @@ texlive-module_src_unpack() { # @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. +# This will make fmtutil generate the formats when asked and allow the remaining +# src_compile phase to build the formats. texlive-module_add_format() { local name engine mode patterns options @@ -405,7 +406,7 @@ texlive-module_src_install() { 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." + [[ -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 @@ -416,7 +417,8 @@ texlive-module_src_install() { # @FUNCTION: texlive-module_pkg_postinst # @DESCRIPTION: # exported function: -# Run texmf-update to ensure the tex installation is consistent with the installed texmf trees. +# Run texmf-update to ensure the tex installation is consistent with the +# installed texmf trees. texlive-module_pkg_postinst() { etexmf-update @@ -426,7 +428,8 @@ texlive-module_pkg_postinst() { # @FUNCTION: texlive-module_pkg_postrm # @DESCRIPTION: # exported function: -# Run texmf-update to ensure the tex installation is consistent with the installed texmf trees. +# Run texmf-update to ensure the tex installation is consistent with the +# installed texmf trees. texlive-module_pkg_postrm() { etexmf-update |