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 2B17F158041 for ; Tue, 2 Apr 2024 14:08:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 010C7E2AAE; Tue, 2 Apr 2024 14:07:51 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A6A11E2AA5 for ; Tue, 2 Apr 2024 14:07:50 +0000 (UTC) From: Florian Schmaus To: gentoo-dev@lists.gentoo.org Cc: Paul Zander , tex@gentoo.org, Florian Schmaus Subject: [gentoo-dev] [PATCH 2/2] texlive-module.eclass: add texlive-module_update_tlpdb Date: Tue, 2 Apr 2024 16:07:38 +0200 Message-ID: <20240402140738.359511-2-flow@gentoo.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240402140738.359511-1-flow@gentoo.org> References: <20240402140738.359511-1-flow@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 12d750dc-63cf-4e81-b793-654e622242e1 X-Archives-Hash: 5059fdb6e3745448f6ade90752db036b 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 --- eclass/texlive-module.eclass | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass index d19e02f02647..15346a3535eb 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. + [[ -n ${REPLACING_VERSIONS} && ${EBUILD_PHASE} == postrm ]] && return + + local tlpkg="${EROOT}"/usr/share/tlpkg + local tlpobj="${tlpkg}"/tlpobj + local tlpdb="${tlpkg}"/texlive.tlpdb + + ebegin "Regenerating TexLive package database (${tlpdb}, ${EBUILD_PHASE})" + + 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 ${REPLACING_VERSIONS} ]] && etexmf-update + texlive-module_update_tlpdb } fi -- 2.43.2