diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-06-20 18:04:30 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-09 22:56:18 -0400 |
commit | 24782b89907ab36fb5aef3a17584f4c10f1e2690 (patch) | |
tree | b0d55f9b146f33fc901aa10b166a647aeded0c0e /utils/ghc-pkg/Main.hs | |
parent | 0472f0f6a92395d478e9644c0dbd12948518099f (diff) | |
download | haskell-24782b89907ab36fb5aef3a17584f4c10f1e2690.tar.gz |
Deduplicate "unique subdir" code between GHC and Cabal
The code, including the generated module with the version, is now in
ghc-boot. Config.hs reexports stuff as needed, ghc-pkg doesn't need any
tricks at all.
Diffstat (limited to 'utils/ghc-pkg/Main.hs')
-rw-r--r-- | utils/ghc-pkg/Main.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 0e28ce9353..bace7356cd 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -30,7 +30,6 @@ module Main (main) where -import Version ( version ) import qualified GHC.PackageDb as GhcPkg import GHC.PackageDb (BinaryStringRep(..)) import GHC.HandleEncoding @@ -40,6 +39,10 @@ import GHC.Platform ( platformArch, platformOS , stringEncodeArch, stringEncodeOS ) +import GHC.UniqueSubdir + ( uniqueSubdir0 + ) +import GHC.Version ( cProjectVersion ) import qualified Distribution.Simple.PackageIndex as PackageIndex import qualified Data.Graph as Graph import qualified Distribution.ModuleName as ModuleName @@ -229,7 +232,7 @@ deprecFlags = [ ] ourCopyright :: String -ourCopyright = "GHC package manager version " ++ Version.version ++ "\n" +ourCopyright = "GHC package manager version " ++ GHC.Version.cProjectVersion ++ "\n" shortUsage :: String -> String shortUsage prog = "For usage information see '" ++ prog ++ " --help'." @@ -654,7 +657,7 @@ getPkgDatabases verbosity mode use_user use_cache expand_vars my_flags = do case getTargetPlatform settingsFile mySettings of Right platform -> pure (stringEncodeArch $ platformArch platform, stringEncodeOS $ platformOS platform) Left e -> die e - let subdir = arch ++ '-':os ++ '-':Version.version + let subdir = uniqueSubdir0 arch os dir = appdir </> subdir r <- lookForPackageDBIn dir case r of @@ -2016,9 +2019,9 @@ checkHSLib :: Verbosity -> [String] -> String -> Validate () checkHSLib _verbosity dirs lib = do let filenames = ["lib" ++ lib ++ ".a", "lib" ++ lib ++ "_p.a", - "lib" ++ lib ++ "-ghc" ++ Version.version ++ ".so", - "lib" ++ lib ++ "-ghc" ++ Version.version ++ ".dylib", - lib ++ "-ghc" ++ Version.version ++ ".dll"] + "lib" ++ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".so", + "lib" ++ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dylib", + lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dll"] b <- liftIO $ doesFileExistOnPath filenames dirs when (not b) $ verror ForceFiles ("cannot find any of " ++ show filenames ++ |