summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2023-01-27 16:22:35 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2023-02-01 13:18:47 +0000
commit329097fce9aa68af32fabbf0b7e8b4999b486303 (patch)
tree331ccbf4f26338318d869adfbed25473eb52713d
parentadf17604bc6b3eebb66b063383156a722718c2fb (diff)
downloadhaskell-329097fce9aa68af32fabbf0b7e8b4999b486303.tar.gz
Fixes for cabal-reinstall CI job
* Allow filepath to be reinstalled * Bump some version bounds to allow newer versions of libraries * Rework testing logic to avoid "install --lib" and package env files Fixes #22344 (cherry picked from commit 7cbdaad0396cee561f125c95f3352cebabd8ed99)
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--cabal.project-reinstall3
-rw-r--r--compiler/ghc.cabal.in2
-rw-r--r--hadrian/src/Rules/CabalReinstall.hs18
-rw-r--r--hadrian/src/Settings/Builders/Cabal.hs17
-rw-r--r--libraries/ghc-boot/ghc-boot.cabal.in2
-rw-r--r--linters/lint-commit-msg/lint-commit-msg.cabal2
-rw-r--r--linters/lint-whitespace/lint-whitespace.cabal2
8 files changed, 24 insertions, 23 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ba338a8ff2..eda6e147ed 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -451,6 +451,7 @@ test-cabal-reinstall-x86_64-linux-deb10:
TEST_ENV: "x86_64-linux-deb10-cabal-install"
rules:
- if: $NIGHTLY
+ - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-reinstall.*/'
########################################
# Testing ABI is invariant across builds
diff --git a/cabal.project-reinstall b/cabal.project-reinstall
index 1886bcb297..181efe48a6 100644
--- a/cabal.project-reinstall
+++ b/cabal.project-reinstall
@@ -12,7 +12,7 @@ packages: ./compiler
-- ./libraries/deepseq/
./libraries/directory/
./libraries/exceptions/
- -- ./libraries/filepath/
+ ./libraries/filepath/
-- ./libraries/ghc-bignum/
./libraries/ghc-boot/
-- ./libraries/ghc-boot-th/
@@ -55,7 +55,6 @@ constraints: ghc +internal-interpreter +dynamic-system-linke,
any.array installed,
any.base installed,
any.deepseq installed,
- any.filepath installed,
any.ghc-bignum installed,
any.ghc-boot-th installed,
any.integer-gmp installed,
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 6a824f63e7..08e579c03a 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -39,7 +39,7 @@ extra-source-files:
custom-setup
- setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, process, filepath
+ setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, process, filepath
Flag internal-interpreter
Description: Build with internal interpreter support.
diff --git a/hadrian/src/Rules/CabalReinstall.hs b/hadrian/src/Rules/CabalReinstall.hs
index c34362171a..2bfc8f92b0 100644
--- a/hadrian/src/Rules/CabalReinstall.hs
+++ b/hadrian/src/Rules/CabalReinstall.hs
@@ -11,6 +11,7 @@ import qualified System.Directory.Extra as IO
import Data.Either
import Rules.BinaryDist
import Hadrian.Haskell.Cabal (pkgIdentifier)
+import Oracles.Setting
{-
Note [Testing reinstallable GHC]
@@ -26,18 +27,11 @@ The libdir of the reinstalled GHC points to the libdir of the stage 2 compiler (
cabalExcludedPackages :: [Package]
cabalExcludedPackages = [array, base, deepseq, filepath, ghcBignum, ghcBootTh, ghcPrim, integerGmp, integerSimple, pretty, templateHaskell]
-findCabalPackageDb :: String -> FilePath
-findCabalPackageDb env = go $ map (\l -> (words l, l)) (lines env)
- where
- go [] = error $ "Couldn't find installed package db in " ++ show env
- go (("package-db":_, l):_) = drop 11 l
- go (_:xs) = go xs
-
cabalBuildRules :: Rules ()
cabalBuildRules = do
root <- buildRootRules
- root -/- "stage-cabal" -/- "cabal-packages" %> \_ -> do
+ root -/- "stage-cabal" -/- "cabal-packages" %> \outpath -> do
-- Always rerun to pass onto cabal's own recompilation logic
alwaysRerun
all_pkgs <- stagePackages Stage1
@@ -45,6 +39,7 @@ cabalBuildRules = do
withVerbosity Diagnostic $
buildWithCmdOptions [] $
target (vanillaContext Stage2 pkg) (Cabal Install Stage2) [] []
+ liftIO $ writeFile outpath "done"
phony "build-cabal" $ need [root -/- "stage-cabal" -/- "bin" -/- ".stamp"]
@@ -73,8 +68,11 @@ cabalBuildRules = do
createDirectory outputDir
need [root -/- "stage-cabal" -/- "cabal-packages"]
- env <- liftIO $ readFile $ root -/- "stage-cabal" -/- "cabal-packages"
- let cabal_package_db = findCabalPackageDb env
+
+ cwd <- liftIO $ IO.getCurrentDirectory
+ version <- setting ProjectVersion
+
+ let cabal_package_db = cwd -/- root -/- "stage-cabal" -/- "dist-newstyle" -/- "packagedb" -/- "ghc-" ++ version
forM_ (filter ((/= iserv) . fst) bin_targets) $ \(bin_pkg,_bin_path) -> do
let pgmName pkg
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
index 03e1f1c5ac..2e421857e5 100644
--- a/hadrian/src/Settings/Builders/Cabal.hs
+++ b/hadrian/src/Settings/Builders/Cabal.hs
@@ -27,9 +27,10 @@ cabalInstallArgs = builder (Cabal Install) ? do
| otherwise = pkgName pkg
assertNoBuildRootLeak $
mconcat [ arg $ "--store-dir=" ++ (root -/- "stage-cabal" -/- "cabal-store")
- , arg "install"
- , if isProgram pkg then arg $ "exe:" ++ pgmName else mconcat [arg "--lib", arg $ pkgName pkg]
+ , if isProgram pkg then arg "install" else arg "build"
+ , if isProgram pkg then (arg $ "exe:" ++ pgmName) else (arg $ pkgName pkg)
, commonReinstallCabalArgs
+ , if isProgram pkg then extraInstallArgs else mempty
]
-- | Checks that _build/stageN/lib/* doesn't leak into the arguments for
@@ -45,6 +46,13 @@ assertNoBuildRootLeak args = do
| libPath <- libPaths]) xs)
xs
+extraInstallArgs :: Args
+extraInstallArgs = do
+ root <- getBuildRoot
+ mconcat [ arg $ "--install-method=copy"
+ , arg $ "--overwrite-policy=always"
+ , arg $ "--installdir=" ++ (root -/- "stage-cabal" -/- "cabal-bin") ]
+
commonReinstallCabalArgs :: Args
commonReinstallCabalArgs = do
top <- expr topDirectory
@@ -56,12 +64,7 @@ commonReinstallCabalArgs = do
, arg $ top -/- "cabal.project-reinstall"
, arg "--distdir"
, arg $ root -/- "stage-cabal" -/- "dist-newstyle"
- , arg ("--ghc-option=-j" ++ show threads)
- , arg $ "--install-method=copy"
- , arg $ "--overwrite-policy=always"
, arg $ "--with-compiler=" ++ top -/- compiler
- , arg $ "--installdir=" ++ (root -/- "stage-cabal" -/- "cabal-bin")
- , arg $ "--package-env=" ++ (root -/- "stage-cabal" -/- "cabal-packages")
, arg "--enable-executable-dynamic"
, arg "--enable-library-vanilla"
]
diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in
index 0b1569c9cf..990f7d3adf 100644
--- a/libraries/ghc-boot/ghc-boot.cabal.in
+++ b/libraries/ghc-boot/ghc-boot.cabal.in
@@ -28,7 +28,7 @@ build-type: Custom
extra-source-files: changelog.md
custom-setup
- setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, filepath
+ setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, filepath
source-repository head
type: git
diff --git a/linters/lint-commit-msg/lint-commit-msg.cabal b/linters/lint-commit-msg/lint-commit-msg.cabal
index 8020a925a4..7d1dbd0fcb 100644
--- a/linters/lint-commit-msg/lint-commit-msg.cabal
+++ b/linters/lint-commit-msg/lint-commit-msg.cabal
@@ -22,7 +22,7 @@ executable lint-commit-msg
build-depends:
linters-common,
mtl
- >=2.1 && <2.3,
+ >=2.1 && <2.4,
base
>= 4.14 && < 5,
text
diff --git a/linters/lint-whitespace/lint-whitespace.cabal b/linters/lint-whitespace/lint-whitespace.cabal
index e3d2aa3a06..61e376d1f9 100644
--- a/linters/lint-whitespace/lint-whitespace.cabal
+++ b/linters/lint-whitespace/lint-whitespace.cabal
@@ -20,7 +20,7 @@ executable lint-whitespace
build-depends:
linters-common,
mtl
- >=2.1 && <2.3,
+ >=2.1 && <2.4,
process
^>= 1.6,
containers