From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 finch.gentoo.org (Postfix) with ESMTPS id 67D84158287 for ; Thu, 15 May 2025 07:11:09 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 54AEF34388B for ; Thu, 15 May 2025 07:11:09 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id CE8231103C1; Thu, 15 May 2025 07:11:03 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 bobolink.gentoo.org (Postfix) with ESMTPS id C97581103C1 for ; Thu, 15 May 2025 07:11:03 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 71CE634317E for ; Thu, 15 May 2025 07:11:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D1607289B for ; Thu, 15 May 2025 07:11:01 +0000 (UTC) From: "Arsen Arsenović" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arsen Arsenović" Message-ID: <1747292993.8ae4c6d315b09451163b0f8fdc95b52ce1f1374c.arsen@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/haskell-cabal.eclass X-VCS-Directories: eclass/ X-VCS-Committer: arsen X-VCS-Committer-Name: Arsen Arsenović X-VCS-Revision: 8ae4c6d315b09451163b0f8fdc95b52ce1f1374c X-VCS-Branch: master Date: Thu, 15 May 2025 07:11:01 +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: fb89c09d-8076-40f3-970f-74db9ab4790c X-Archives-Hash: 946f3fba94b61e597328c90897c5de02 commit: 8ae4c6d315b09451163b0f8fdc95b52ce1f1374c Author: hololeap protonmail com> AuthorDate: Sat Apr 12 17:41:40 2025 +0000 Commit: Arsen Arsenović gentoo org> CommitDate: Thu May 15 07:09:53 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ae4c6d3 haskell-cabal.eclass: Add early check for invalid GHC cache If the GHC cache is invalid, it can create a confusing error during src_compile. Add a check in haskell-cabal-pkg_setup that checks for and fixes an invalid cache. Closes: https://bugs.gentoo.org/916785 Closes: https://bugs.gentoo.org/916971 Closes: https://bugs.gentoo.org/920879 Closes: https://github.com/gentoo-haskell/gentoo-haskell/issues/1469 Thanks-to: Tom Gillespie gmail.com> Signed-off-by: hololeap protonmail.com> Part-of: https://github.com/gentoo/gentoo/pull/41562 Closes: https://github.com/gentoo/gentoo/pull/41562 Signed-off-by: Arsen Arsenović gentoo.org> eclass/haskell-cabal.eclass | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index e228d7fbc1bc..bb73c0e4881d 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -661,6 +661,23 @@ cabal-is-dummy-lib() { return 1 } +# @FUNCTION: cabal-check-cache +# @DESCRIPTION: +# Check the state of the GHC cache by running 'ghc-pkg check' and looking +# for the string "WARNING: cache is out of date". If the string is not found, +# the cache is considered valid and the function returns 0. If it is found, +# the cache is considered invalid and the function returns 1. +cabal-check-cache() { + if $(ghc-getghcpkg) check 2>&1 \ + | grep -q 'WARNING: cache is out of date' + then + ewarn 'GHC cache is out of date!' + return 1 + else + return 0 + fi +} + # exported function: check if cabal is correctly installed for # the currently active ghc (we cannot guarantee this with portage) haskell-cabal_pkg_setup() { @@ -672,6 +689,13 @@ haskell-cabal_pkg_setup() { fi if cabal-is-dummy-lib; then einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." + else + # bug 916785 + if ! cabal-check-cache; then + # avoid running ghc-recache-db so as not to set _GHC_RECACHE_CALLED + einfo "Recaching GHC package DB" + $(ghc-getghcpkg) recache + fi fi }