From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BA0AB158041 for ; Wed, 3 Apr 2024 17:38:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 271F1E2ACC; Wed, 3 Apr 2024 17:38:07 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 08E6AE2ACC for ; Wed, 3 Apr 2024 17:38:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F363E3431F3 for ; Wed, 3 Apr 2024 17:38:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 648D1166C for ; Wed, 3 Apr 2024 17:38:04 +0000 (UTC) From: "Florian Schmaus" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Florian Schmaus" Message-ID: <1712165684.92f953a24b62bcce256f3f138c98f9fbb5126cd5.flow@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/texlive-module.eclass X-VCS-Directories: eclass/ X-VCS-Committer: flow X-VCS-Committer-Name: Florian Schmaus X-VCS-Revision: 92f953a24b62bcce256f3f138c98f9fbb5126cd5 X-VCS-Branch: master Date: Wed, 3 Apr 2024 17:38:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: aeae5f5b-7c4c-4f47-9749-67e457c550aa X-Archives-Hash: 81e123edc249cf3dbfb0472dd79f4160 commit: 92f953a24b62bcce256f3f138c98f9fbb5126cd5 Author: Florian Schmaus gentoo org> AuthorDate: Tue Apr 2 14:05:29 2024 +0000 Commit: Florian Schmaus gentoo org> CommitDate: Wed Apr 3 17:34:44 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92f953a2 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 gentoo.org> eclass/texlive-module.eclass | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) 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