summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-28 14:31:43 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2022-04-01 11:07:27 +0100
commitb84380d383cc723644199977dfc2cfbf467358c4 (patch)
treef6ba4f30d4ff1655179763e408aa0ff8b2860a60
parent3e209a62148a45b4af7441ee963f6f055b333864 (diff)
downloadhaskell-b84380d383cc723644199977dfc2cfbf467358c4.tar.gz
hadrian: Remove linters-common from bindist
Zubin observed that the bindists contains the utility library linters-common. There are two options: 1. Make sure only the right files are added into the bindist.. a bit tricky due to the non-trivial structure of the lib directory. 2. Remove the bad files once they get copied in.. a bit easier So I went for option 2 but we perhaps should go for option 1 in the future. Fixes #21203
-rw-r--r--hadrian/src/Context.hs13
-rw-r--r--hadrian/src/Rules/BinaryDist.hs12
2 files changed, 22 insertions, 3 deletions
diff --git a/hadrian/src/Context.hs b/hadrian/src/Context.hs
index 6c2c5bd899..ad6ead3f9b 100644
--- a/hadrian/src/Context.hs
+++ b/hadrian/src/Context.hs
@@ -7,7 +7,8 @@ module Context (
-- * Paths
contextDir, buildPath, buildDir, pkgInplaceConfig, pkgSetupConfigFile,
- pkgHaddockFile, pkgRegisteredLibraryFile, pkgLibraryFile, pkgGhciLibraryFile,
+ pkgHaddockFile, pkgRegisteredLibraryFile, pkgRegisteredLibraryFileName,
+ pkgLibraryFile, pkgGhciLibraryFile,
pkgConfFile, objectPath, contextPath, getContextPath, libPath, distDir,
haddockStatsFilesDir
) where
@@ -97,13 +98,19 @@ pkgRegisteredLibraryFile :: Context -> Action FilePath
pkgRegisteredLibraryFile context@Context {..} = do
libDir <- libPath context
pkgId <- pkgIdentifier package
- extension <- libsuf stage way
- fileName <- pkgFileName package "libHS" extension
+ fileName <- pkgRegisteredLibraryFileName context
distDir <- distDir stage
return $ if Dynamic `wayUnit` way
then libDir -/- distDir -/- fileName
else libDir -/- distDir -/- pkgId -/- fileName
+-- | Just the final filename portion of pkgRegisteredLibraryFile
+pkgRegisteredLibraryFileName :: Context -> Action FilePath
+pkgRegisteredLibraryFileName Context{..} = do
+ extension <- libsuf stage way
+ pkgFileName package "libHS" extension
+
+
-- | Path to the library file of a given 'Context', e.g.:
-- @_build/stage1/libraries/array/build/libHSarray-0.5.1.0.a@.
pkgLibraryFile :: Context -> Action FilePath
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index e53f686512..b47eff4eec 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -203,6 +203,18 @@ bindistRules = do
ghcPkgName <- programName (vanillaContext Stage1 ghcPkg)
cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"]
+
+ -- HACK: Drop stuff from lintersCommon package as this for GHC developers and not of interest to end-users (#21203)
+ pkg_id <- pkgIdentifier lintersCommon
+ cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["unregister", pkg_id]
+ removeDirectory (bindistFilesDir -/- "lib" -/- distDir -/- pkg_id)
+
+ removeFile =<<
+ ((bindistFilesDir -/- "lib" -/- distDir) -/-)
+ <$> pkgRegisteredLibraryFileName (Context Stage1 lintersCommon dynamic)
+
+
+
-- The settings file must be regenerated by the bindist installation
-- logic to account for the environment discovered by the bindist
-- configure script on the host. Not on Windows, however, where