Skip to content

Commit c520482

Browse files
committed
UGLY! Forcing pkgCompiler to Nothing across the codebasy 😢
1 parent 35e6455 commit c520482

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

Cabal/src/Distribution/Backpack/Id.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ computeComponentId
3939
-- This is used by cabal-install's legacy codepath
4040
-> Maybe ([ComponentId], FlagAssignment)
4141
-> ComponentId
42-
computeComponentId deterministic mb_ipid mb_cid pid cname mb_details =
42+
computeComponentId deterministic mb_ipid mb_cid pid0 cname mb_details =
4343
-- show is found to be faster than intercalate and then replacement of
4444
-- special character used in intercalating. We cannot simply hash by
4545
-- doubly concatenating list, as it just flatten out the nested list, so
4646
-- different sources can produce same hash
47-
let hash_suffix
47+
let -- we do not want the compiler to show up in the Id.
48+
pid = pid0{pkgCompiler = Nothing}
49+
hash_suffix
4850
| Just (dep_ipids, flags) <- mb_details =
4951
"-"
5052
++ hashToBase62

Cabal/src/Distribution/Simple/InstallDirs.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ defaultInstallDirs' False comp userInstall _hasLibs = do
209209
case buildOS of
210210
Windows -> return "$prefix"
211211
_ -> return ("$prefix" </> "lib")
212-
return $
212+
return $ traceShowId $
213213
fmap toPathTemplate $
214214
InstallDirs
215215
{ prefix = installPrefix
@@ -267,7 +267,7 @@ substituteInstallDirTemplates
267267
:: PathTemplateEnv
268268
-> InstallDirTemplates
269269
-> InstallDirTemplates
270-
substituteInstallDirTemplates env dirs = dirs'
270+
substituteInstallDirTemplates env dirs = traceShow "BOOM" $ dirs'
271271
where
272272
dirs' =
273273
InstallDirs
@@ -441,7 +441,7 @@ packageTemplateEnv pkgId uid =
441441
, -- Invariant: uid is actually a HashedUnitId. Hard to enforce because
442442
-- it's an API change.
443443
(LibNameVar, PathTemplate [Ordinary $ prettyShow uid])
444-
, (PkgIdVar, PathTemplate [Ordinary $ prettyShow pkgId])
444+
, (PkgIdVar, PathTemplate [Ordinary $ prettyShow (pkgId{pkgCompiler = Nothing})])
445445
]
446446

447447
compilerTemplateEnv :: CompilerInfo -> PathTemplateEnv

cabal-install/src/Distribution/Client/DistDirLayout.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import Distribution.Package
3939
, PackageId
4040
, PackageIdentifier
4141
, UnitId
42+
, pkgCompiler
4243
)
4344
import Distribution.Simple.Compiler
4445
( Compiler (..)
@@ -200,7 +201,7 @@ defaultDistDirLayout projectRoot mdistDirectory haddockOutputDir =
200201
distBuildRootDirectory
201202
</> prettyShow (distParamPlatform params)
202203
</> prettyShow (distParamCompilerId params)
203-
</> prettyShow (distParamPackageId params)
204+
</> prettyShow ((distParamPackageId params){pkgCompiler = Nothing})
204205
</> ( case distParamComponentName params of
205206
Nothing -> ""
206207
Just (CLibName LMainLibName) -> ""

cabal-install/src/Distribution/Client/FetchUtils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ verifyFetchedTarball verbosity file mCallbacks pkgid =
201201
let warnAndFail s = warn verbosity ("Fetched tarball " ++ file ++ " does not match server, will redownload: " ++ s) >> return False
202202
in -- the do block in parens is due to dealing with the checked exceptions mechanism.
203203
( do
204-
fileInfo <- Sec.indexLookupFileInfo callbacks pkgid
204+
fileInfo <- Sec.indexLookupFileInfo callbacks (pkgid{pkgCompiler = Nothing})
205205
sz <- Sec.FileLength . fromInteger <$> getFileSize file
206206
if sz /= Sec.fileInfoLength (Sec.trusted fileInfo)
207207
then warnAndFail "file length mismatch"

cabal-install/src/Distribution/Client/ProjectBuilding.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ withTarballLocalDirectory
718718
verbosity
719719
tarball
720720
unpackdir
721-
pkgid
721+
pkgid{pkgCompiler = Nothing}
722722
pkgTextOverride
723723
buildPkg srcdir builddir
724724

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do
12111211
--
12121212
let allPkgLocations :: [(PackageId, PackageLocation (Maybe FilePath))]
12131213
allPkgLocations =
1214-
[ (packageId pkg, srcpkgSource pkg)
1214+
[ ((packageId pkg){pkgCompiler = Nothing}, srcpkgSource pkg)
12151215
| SolverInstallPlan.Configured (SolverPackage{solverPkgSource = pkg}) <-
12161216
SolverInstallPlan.toList solverPlan
12171217
]
@@ -1982,7 +1982,7 @@ elaborateInstallPlan
19821982
cid = case elabBuildStyle elab0 of
19831983
BuildInplaceOnly{} ->
19841984
mkComponentId $
1985-
prettyShow pkgid
1985+
prettyShow (pkgid{pkgCompiler = Nothing})
19861986
++ "-inplace"
19871987
++ ( case Cabal.componentNameString cname of
19881988
Nothing -> ""
@@ -2215,7 +2215,7 @@ elaborateInstallPlan
22152215

22162216
pkgInstalledId
22172217
| shouldBuildInplaceOnly pkg =
2218-
mkComponentId (prettyShow pkgid ++ "-inplace")
2218+
mkComponentId (prettyShow (pkgid{pkgCompiler = Nothing}) ++ "-inplace")
22192219
| otherwise =
22202220
assert (isJust elabPkgSourceHash) $
22212221
hashedInstalledPackageId
@@ -2226,7 +2226,7 @@ elaborateInstallPlan
22262226

22272227
-- Need to filter out internal dependencies, because they don't
22282228
-- correspond to anything real anymore.
2229-
isExt confid = confSrcId confid /= pkgid
2229+
isExt confid = (confSrcId confid){pkgCompiler = Nothing} /= pkgid{pkgCompiler = Nothing}
22302230
filterExt = filter isExt
22312231

22322232
filterExt' :: [(ConfiguredId, a)] -> [(ConfiguredId, a)]
@@ -2367,7 +2367,7 @@ elaborateInstallPlan
23672367
else cp
23682368

23692369
elabPkgSourceLocation = srcloc
2370-
elabPkgSourceHash = case Map.lookup pkgid sourcePackageHashes of
2370+
elabPkgSourceHash = case Map.lookup (pkgid{pkgCompiler = Nothing}) sourcePackageHashes of
23712371
Just h -> Just h
23722372
Nothing -> Nothing
23732373
elabLocalToProject = isLocalToProject pkg

0 commit comments

Comments
 (0)