summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2024-04-02 16:05:29 +0200
committerFlorian Schmaus <flow@gentoo.org>2024-04-03 19:34:44 +0200
commit92f953a24b62bcce256f3f138c98f9fbb5126cd5 (patch)
tree5c709a5c2e206ea301196535d4633bb9adc1345e /eclass
parenttexlive-module.eclass: only invoke etexmf-update in postinst if not replacing... (diff)
downloadgentoo-92f953a24b62bcce256f3f138c98f9fbb5126cd5.tar.gz
gentoo-92f953a24b62bcce256f3f138c98f9fbb5126cd5.tar.bz2
gentoo-92f953a24b62bcce256f3f138c98f9fbb5126cd5.zip
texlive-module.eclass: add texlive-module_update_tlpdb
Update (or create) the tlpdb based on the contents of /usr/share/tlpkg/tlpobj. Closes: https://bugs.gentoo.org/928162 Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/texlive-module.eclass57
1 files changed, 57 insertions, 0 deletions
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 14e3280128a8..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}"
}
@@ -439,6 +495,7 @@ texlive-module_pkg_postinst() {
texlive-module_pkg_postrm() {
[[ -z ${REPLACED_BY_VERSION} ]] && etexmf-update
+ texlive-module_update_tlpdb
}
fi