[Git][ghc/ghc][wip/romes/hardwire-ghc-unit-id] 2 commits: add flag
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Mon Apr 3 16:35:48 UTC 2023
Matthew Pickering pushed to branch wip/romes/hardwire-ghc-unit-id at Glasgow Haskell Compiler / GHC
Commits:
104c2b4c by Matthew Pickering at 2023-04-03T17:31:17+01:00
add flag
- - - - -
5d179c5d by Matthew Pickering at 2023-04-03T17:33:33+01:00
Use hash-unit-ids in release jobs
- - - - -
4 changed files:
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- hadrian/src/CommandLine.hs
- hadrian/src/Hadrian/Haskell/Hash.hs
Changes:
=====================================
.gitlab/gen_ci.hs
=====================================
@@ -760,7 +760,7 @@ nightly arch opsys bc =
release :: Arch -> Opsys -> BuildConfig -> NamedJob Job
release arch opsys bc =
let NamedJob n j = job arch opsys (bc { buildFlavour = Release })
- in NamedJob { name = "release-" ++ n, jobInfo = addJobRule ReleaseOnly . keepArtifacts "1 year" . ignorePerfFailures . highCompression $ j}
+ in NamedJob { name = "release-" ++ n, jobInfo = addJobRule ReleaseOnly . keepArtifacts "1 year" . ignorePerfFailures . useHashUnitIds . highCompression $ j}
-- Specific job modification functions
@@ -785,6 +785,9 @@ ignorePerfFailures = addVariable "IGNORE_PERF_FAILURES" "all"
highCompression :: Job -> Job
highCompression = addVariable "XZ_OPT" "-9"
+useHashUnitIds :: Job -> Job
+useHashUnitIds = addVariable "HADRIAN_ARGS" "--hash-unit-ids"
+
-- | Mark the validate job to run in fast-ci mode
fastCI :: JobGroup Job -> JobGroup Job
fastCI = modifyValidateJobs (addJobRule FastCI)
=====================================
.gitlab/jobs.yaml
=====================================
@@ -2222,7 +2222,7 @@
"BIN_DIST_NAME": "ghc-aarch64-darwin-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi ",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MACOSX_DEPLOYMENT_TARGET": "11.0",
@@ -2286,6 +2286,7 @@
"BIN_DIST_NAME": "ghc-aarch64-linux-deb10-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "aarch64-linux-deb10-release+no_split_sections",
"XZ_OPT": "-9"
@@ -2346,6 +2347,7 @@
"BIN_DIST_NAME": "ghc-i386-linux-deb9-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "i386-linux-deb9-release+no_split_sections",
"XZ_OPT": "-9"
@@ -2406,7 +2408,7 @@
"BIN_DIST_NAME": "ghc-x86_64-darwin-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi ",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MACOSX_DEPLOYMENT_TARGET": "10.10",
@@ -2473,7 +2475,7 @@
"BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
"BUILD_FLAVOUR": "release+fully_static",
"CONFIGURE_ARGS": "--disable-ld-override ",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
"TEST_ENV": "x86_64-linux-alpine3_12-int_native-release+fully_static",
@@ -2536,7 +2538,7 @@
"BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
"BUILD_FLAVOUR": "release+fully_static+no_split_sections",
"CONFIGURE_ARGS": "--disable-ld-override ",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
"TEST_ENV": "x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
@@ -2598,7 +2600,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-centos7-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-centos7-release+no_split_sections",
"XZ_OPT": "-9"
@@ -2659,6 +2661,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-deb10-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-deb10-release",
"XZ_OPT": "-9"
@@ -2719,6 +2722,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-deb10-release+debug_info",
"BUILD_FLAVOUR": "release+debug_info",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-deb10-release+debug_info",
"XZ_OPT": "-9"
@@ -2779,6 +2783,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-deb11-release",
"XZ_OPT": "-9"
@@ -2839,6 +2844,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-deb11-release+boot_nonmoving_gc",
"BUILD_FLAVOUR": "release+boot_nonmoving_gc",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"RUNTEST_ARGS": "--way=nonmoving --way=nonmoving_thr --way=nonmoving_thr_sanity",
"TEST_ENV": "x86_64-linux-deb11-release+boot_nonmoving_gc",
@@ -2900,6 +2906,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-deb9-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-deb9-release+no_split_sections",
"XZ_OPT": "-9"
@@ -2960,6 +2967,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"LLC": "/bin/false",
"OPT": "/bin/false",
@@ -3022,6 +3030,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release+debug_info",
"BUILD_FLAVOUR": "release+debug_info",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"LLC": "/bin/false",
"OPT": "/bin/false",
@@ -3084,7 +3093,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
- "HADRIAN_ARGS": "--haddock-base-url",
+ "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"LLC": "/bin/false",
"OPT": "/bin/false",
@@ -3147,7 +3156,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-rocky8-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-rocky8-release",
"XZ_OPT": "-9"
@@ -3208,6 +3217,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu18_04-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-ubuntu18_04-release",
"XZ_OPT": "-9"
@@ -3268,6 +3278,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-ubuntu20_04-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "",
+ "HADRIAN_ARGS": "--hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"TEST_ENV": "x86_64-linux-ubuntu20_04-release",
"XZ_OPT": "-9"
@@ -3325,7 +3336,7 @@
"CABAL_INSTALL_VERSION": "3.8.1.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.4.3",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MSYSTEM": "CLANG64",
@@ -3385,7 +3396,7 @@
"CABAL_INSTALL_VERSION": "3.8.1.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.4.3",
- "HADRIAN_ARGS": "--docs=no-sphinx",
+ "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
"IGNORE_PERF_FAILURES": "all",
"LANG": "en_US.UTF-8",
"MSYSTEM": "CLANG64",
=====================================
hadrian/src/CommandLine.hs
=====================================
@@ -1,7 +1,7 @@
module CommandLine (
optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, lookupFreeze2, lookupSkipDepends,
cmdBignum, cmdBignumCheck, cmdProgressInfo, cmdCompleteSetting,
- cmdDocsArgs, lookupBuildRoot, TestArgs(..), TestSpeed(..), defaultTestArgs,
+ cmdDocsArgs, cmdUnitIdHash, lookupBuildRoot, TestArgs(..), TestSpeed(..), defaultTestArgs,
cmdPrefix, DocArgs(..), defaultDocArgs
) where
@@ -28,6 +28,7 @@ data CommandLineArgs = CommandLineArgs
, freeze1 :: Bool
, freeze2 :: Bool
, skipDepends :: Bool
+ , unitIdHash :: Bool
, bignum :: Maybe String
, bignumCheck :: Bool
, progressInfo :: ProgressInfo
@@ -47,6 +48,7 @@ defaultCommandLineArgs = CommandLineArgs
, freeze1 = False
, freeze2 = False
, skipDepends = False
+ , unitIdHash = False
, bignum = Nothing
, bignumCheck = False
, progressInfo = Brief
@@ -141,6 +143,9 @@ readFreeze1 = Right $ \flags -> flags { freeze1 = True }
readFreeze2 = Right $ \flags -> flags { freeze1 = True, freeze2 = True }
readSkipDepends = Right $ \flags -> flags { skipDepends = True }
+readUnitIdHash :: Either String (CommandLineArgs -> CommandLineArgs)
+readUnitIdHash = Right $ \flags -> flags { unitIdHash = True }
+
readProgressInfo :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readProgressInfo ms =
maybe (Left "Cannot parse progress-info") (Right . set) (go =<< lower <$> ms)
@@ -289,6 +294,8 @@ optDescrs =
"Freeze Stage1 GHC."
, Option [] ["freeze2"] (NoArg readFreeze2)
"Freeze Stage2 GHC."
+ , Option [] ["hash-unit-ids"] (NoArg readUnitIdHash)
+ "Include package hashes in unit ids."
, Option [] ["skip-depends"] (NoArg readSkipDepends)
"Skip rebuilding dependency information."
, Option [] ["bignum"] (OptArg readBignum "BACKEND")
@@ -400,6 +407,9 @@ lookupFreeze2 = freeze2 . lookupExtra defaultCommandLineArgs
lookupSkipDepends :: Map.HashMap TypeRep Dynamic -> Bool
lookupSkipDepends = skipDepends . lookupExtra defaultCommandLineArgs
+cmdUnitIdHash :: Action Bool
+cmdUnitIdHash = unitIdHash <$> cmdLineArgs
+
cmdBignum :: Action (Maybe String)
cmdBignum = bignum <$> cmdLineArgs
=====================================
hadrian/src/Hadrian/Haskell/Hash.hs
=====================================
@@ -35,6 +35,7 @@ import Utilities
import Base
import Context
import System.Directory.Extra (listFilesRecursive)
+import CommandLine
-- | Read a Cabal file and return the package identifier, e.g. @base-4.10.0.0-abcd at .
@@ -43,7 +44,7 @@ pkgUnitId :: Context -> Package -> Action String
pkgUnitId ctx' pkg = do
let ctx = ctx'{package = pkg}
pid <- pkgSimpleIdentifier (package ctx)
- phash <- pkgHash ctx
+ use_hash <- cmdUnitIdHash
if pkgName pkg == "rts"
-- The unit-id will change depending on the way, we need to treat the rts separately
then pure pid
@@ -52,7 +53,13 @@ pkgUnitId ctx' pkg = do
-- can have hadrian generate a different unit-id for them just as cabal does
-- because the boot packages unit-ids are overriden by setting -this-unit-id
-- in the cabal file
- pure $ pid <> "-" <> truncateHash 4 phash
+ hash <- if use_hash
+ then do
+ phash <- pkgHash ctx
+ return $ truncateHash 4 phash
+ else
+ return "inplace"
+ pure $ pid <> "-" <> hash
where
truncateHash :: Int -> String -> String
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/13824cd5c871bd11e802ae157eee010fa40580e6...5d179c5d73e643dd8457457b95f4666e288eaf5d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/13824cd5c871bd11e802ae157eee010fa40580e6...5d179c5d73e643dd8457457b95f4666e288eaf5d
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/20230403/b91f255f/attachment-0001.html>
More information about the ghc-commits
mailing list