[Git][ghc/ghc][master] 2 commits: ci: Unset ALEX/HAPPY variables when testing bootstrap jobs

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jul 9 10:18:08 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
3f9548fe by Matthew Pickering at 2024-07-09T06:17:36-04:00
ci: Unset ALEX/HAPPY variables when testing bootstrap jobs

Ticket #24826 reports a regression in 9.10.1 when building from a source
distribution. This patch is an attempt to reproduce the issue on CI by
more aggressively removing `alex` and `happy` from the environment.

- - - - -
aba2c9d4 by Andrea Bedini at 2024-07-09T06:17:36-04:00
hadrian: Ignore build-tool-depends fields in cabal files

hadrian does not utilise the build-tool-depends fields in cabal files
and their presence can cause issues when building source distribution
(see #24826)

Ideally Cabal would support building "full" source distributions which
would remove the need for workarounds in hadrian but for now we can
patch the build-tool-depends out of the cabal files.

Fixes #24826

- - - - -


3 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -708,7 +708,10 @@ test-bootstrap:
     - .gitlab/ci.sh setup
     # Bootstrapping should not depend on HAPPY or ALEX so set them to false
     # so the build fails if they are invoked.
-    - export HAPPY=/bin/false; export ALEX=/bin/false
+    - unset HAPPY; unset ALEX
+    # Check the commands are not available, parens are crucial to start a subshell
+    - (! command -v alex --version)
+    - (! command -v happy --version)
     - .gitlab/ci.sh configure
     - .gitlab/ci.sh build_hadrian
     - .gitlab/ci.sh test_hadrian


=====================================
.gitlab/ci.sh
=====================================
@@ -403,6 +403,12 @@ function configure() {
     else
     args+=("--disable-numa")
   fi
+  if [[ -n ${HAPPY:-} ]]; then
+    args+=("HAPPY=$HAPPY")
+  fi
+  if [[ -n ${ALEX:-} ]]; then
+    args+=("ALEX=$ALEX")
+  fi
 
   start_section "configuring"
   # See https://stackoverflow.com/questions/7577052 for a rationale for the
@@ -411,8 +417,6 @@ function configure() {
     --enable-tarballs-autodownload \
     "${args[@]+"${args[@]}"}" \
     GHC="$GHC" \
-    HAPPY="$HAPPY" \
-    ALEX="$ALEX" \
     || ( cat config.log; fail "configure failed" )
   end_section "configuring"
 }


=====================================
hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
=====================================
@@ -19,6 +19,7 @@ import Data.Bifunctor
 import Data.List.Extra
 import Development.Shake
 import qualified Distribution.Compat.Graph                     as Graph
+import qualified Distribution.Compat.Lens                      as CL
 import qualified Distribution.ModuleName                       as C
 import qualified Distribution.Package                          as C
 import qualified Distribution.PackageDescription               as C
@@ -37,6 +38,7 @@ import qualified Distribution.Simple.Utils                     as C
 import qualified Distribution.Simple.Program.Types             as C
 import qualified Distribution.Simple.Configure                 as C (getPersistBuildConfig)
 import qualified Distribution.Simple.Build                     as C
+import qualified Distribution.Types.BuildInfo.Lens             as CL (HasBuildInfo(..), traverseBuildInfos)
 import qualified Distribution.Types.ComponentLocalBuildInfo    as C
 import qualified Distribution.InstalledPackageInfo             as Installed
 import qualified Distribution.Simple.PackageIndex              as C
@@ -193,10 +195,21 @@ configurePackage context at Context {..} = do
     verbosity <- getVerbosity
     let v = shakeVerbosityToCabalFlag verbosity
         argList' = argList ++ ["--flags=" ++ unwords flagList, v]
+
     when (verbosity >= Verbose) $
         putProgressInfo $ "| Package " ++ quote (pkgName package) ++ " configuration flags: " ++ unwords argList'
+
+    -- See #24826 for why this workaround exists
+    -- In future `Cabal` versions we should pass the `--ignore-build-tools` flag when
+    -- calling configure.
+    -- See https://github.com/haskell/cabal/pull/10128
+    let gpdWithoutBuildTools =
+            CL.set (CL.traverseBuildInfos . CL.buildToolDepends) []
+          . CL.set (CL.traverseBuildInfos . CL.buildTools) []
+          $ gpd
+
     traced "cabal-configure" $
-        C.defaultMainWithHooksNoReadArgs hooks gpd argList'
+        C.defaultMainWithHooksNoReadArgs hooks gpdWithoutBuildTools argList'
 
     dir <- Context.buildPath context
     files <- liftIO $ getDirectoryFilesIO "." [ dir -/- "include" -/- "**"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ed8a8f0bf0cc866ca309ca07f996d85522c9c20e...aba2c9d4728262cd9a2d711eded9050ac131c6c1

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ed8a8f0bf0cc866ca309ca07f996d85522c9c20e...aba2c9d4728262cd9a2d711eded9050ac131c6c1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240709/8d7ba511/attachment-0001.html>


More information about the ghc-commits mailing list