diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-04-03 20:14:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-04-03 20:14:29 +0100 |
commit | 56ef021c58088c79bc71257eb348ff6decc47607 (patch) | |
tree | 1dd58f8c1917d4338e207c3868b0360c9066e5b9 /eclass/texlive-module.eclass | |
parent | a1d3b28d34c46d8e93a8286b1d3706a3e6c75fcc (diff) |
gentoo auto-resync : 03:04:2024 - 20:14:28
Diffstat (limited to 'eclass/texlive-module.eclass')
-rw-r--r-- | eclass/texlive-module.eclass | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass index 9fc4e619ff9b..bfe5e12bf250 100644 --- a/eclass/texlive-module.eclass +++ b/eclass/texlive-module.eclass @@ -420,6 +420,61 @@ texlive-module_src_install() { texlive-common_handle_config_files } +# @FUNCTION: texlive-module_update_tlpdb +# @DESCRIPTION: +# Update the TexLive package database at /usr/share/tlpkg/texlive.tlpdb. + +texlive-module_update_tlpdb() { + [[ ${TL_PV} -lt 2023 ]] && return + + # If we are updating this package, then there is no need to update + # the tlpdb in postrm, as it will be again updated in postinst. + [[ ${EBUILD_PHASE} == postrm && -n ${REPLACED_BY_VERSION} ]] && return + + local tlpkg="${EROOT}"/usr/share/tlpkg + local tlpobj="${tlpkg}"/tlpobj + local tlpdb="${tlpkg}"/texlive.tlpdb + + ebegin "Regenerating TexLive package database" + + local new_tlpdb="${T}"/texlive.tlpdb + + touch "${new_tlpdb}" || die + + find "${tlpobj}" -maxdepth 1 -type f -name "*.tlpobj" -print0 | + sort -z | + xargs -0 --no-run-if-empty cat >> "${new_tlpdb}" + assert "generating tlpdb failed" + + if [[ -f ${tlpdb} ]]; then + cmp -s "${new_tlpdb}" "${tlpdb}" + local ret=$? + case ${ret} in + # content equal + 0) + # Nothing to do, return. + eend 0 + return + ;; + # content differs + 1) + ;; + # cmp failed with an error + *) + eend ${ret} "comparing new and existing tlpdb failed (exit status: ${ret})" + die + ;; + esac + fi + + mv "${new_tlpdb}" "${tlpdb}" + eend $? "moving tlpdb into position failed (exit status: ${?})" || die + + if [[ ! -s ${tlpdb} ]]; then + rm "${tlpdb}" || die + fi +} + # @FUNCTION: texlive-module_pkg_postinst # @DESCRIPTION: # exported function: @@ -428,6 +483,7 @@ texlive-module_src_install() { texlive-module_pkg_postinst() { etexmf-update + texlive-module_update_tlpdb [[ -n ${TL_MODULE_INFORMATION} ]] && elog "${TL_MODULE_INFORMATION}" } @@ -438,7 +494,8 @@ texlive-module_pkg_postinst() { # installed texmf trees. texlive-module_pkg_postrm() { - etexmf-update + [[ -z ${REPLACED_BY_VERSION} ]] && etexmf-update + texlive-module_update_tlpdb } fi |