summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2024-04-04 10:10:03 +0200
committerFlorian Schmaus <flow@gentoo.org>2024-04-04 10:17:55 +0200
commit0977b78999668cebc0aac4235ccf47d9502f1e00 (patch)
tree89727009e536bce7338bf94d2221beb7e1fcba06 /eclass/texlive-common.eclass
parentwww-servers/tomcat: add 10.1.20 unbundling bnd (diff)
downloadgentoo-0977b78999668cebc0aac4235ccf47d9502f1e00.tar.gz
gentoo-0977b78999668cebc0aac4235ccf47d9502f1e00.tar.bz2
gentoo-0977b78999668cebc0aac4235ccf47d9502f1e00.zip
texlive-*.eclass: move update_tldb from texlive-module to texlive-common
The TexLive package database (tlpdb) also needs to be updated by app-text/texlive-core, which only inherits texlive-common.eclass. Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'eclass/texlive-common.eclass')
-rw-r--r--eclass/texlive-common.eclass54
1 files changed, 54 insertions, 0 deletions
diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index e8a740df1f27..66d3999bd103 100644
--- a/eclass/texlive-common.eclass
+++ b/eclass/texlive-common.eclass
@@ -249,4 +249,58 @@ texlive-common_append_to_src_uri() {
fi
}
+# @FUNCTION: texlive-common_update_tlpdb
+# @DESCRIPTION:
+# Update the TexLive package database at /usr/share/tlpkg/texlive.tlpdb.
+texlive-common_update_tlpdb() {
+ [[ -v TL_PV && ${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
+}
+
fi