1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
module Settings.Builders.GhcPkg (ghcPkgBuilderArgs) where
import Settings.Builders.Common
ghcPkgBuilderArgs :: Args
ghcPkgBuilderArgs = mconcat
[ builder (GhcPkg Copy) ? do
verbosity <- expr getVerbosity
stage <- getStage
pkgDb <- expr $ packageDbPath stage
mconcat [ use_db pkgDb
, arg "register"
, verbosity < Chatty ? arg "-v0"
]
, builder (GhcPkg Unregister) ? do
verbosity <- expr getVerbosity
stage <- getStage
pkgDb <- expr $ packageDbPath stage
mconcat [ use_db pkgDb
, arg "unregister"
, arg "--force"
, verbosity < Chatty ? arg "-v0"
]
, builder (GhcPkg Update) ? do
verbosity <- expr getVerbosity
context <- getContext
config <- expr $ pkgInplaceConfig context
stage <- getStage
pkgDb <- expr $ packageDbPath stage
mconcat [ notStage0 ? use_db pkgDb
, arg "update"
, arg "--force"
, verbosity < Chatty ? arg "-v0"
, bootPackageDatabaseArgs
, arg config ] ]
where
use_db db = mconcat
-- We use ghc-pkg's --global-package-db to manipulate our databases.
-- We can't use --package-db (at least with stage0's ghc-pkg)
-- because units in stage0's global package db would be in scope and
-- ghc-pkg would disallow us the register a second "rts" unit in our
-- database.
--
-- However ghc-pkg uses the path to the global package db to find
-- the compiler "settings" file... So when it finds our newly
-- generated settings file in _build/stageN, it may crash if it
-- isn't the format it expects (#17601).
--
-- By chance, ghc-pkg only needs the "settings" file to query the
-- arch/os to generate the path to the user package db, which we
-- don't need. So we disable it below to avoid failures.
[ arg "--no-user-package-db"
, arg "--global-package-db"
, arg db
]
|