Commit 22c6b7f2 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Update Cabal submodule to latest version.



Summary:
Note that Cabal needs one more bugfix which is in PR to
fix GHC bootstrapping. But the rest of the patch is
ready for review.

Needs a filepath submodule update because cabal check
became more strict.

This patch handles the abstract-ification of Version and
PackageName.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2555
parent eda5a4ab
Subproject commit f8d6f17a09d14e3f1851190f18fefa23be2ae02f
Subproject commit c4e91c94b3642f10812a8c04ba8b5e71d56be1cd
Subproject commit f510e50feefe9995334769dd5e26c79edbe6fdc1
Subproject commit 07b334b406a45057a80e821e72c4b973117caae9
......@@ -39,7 +39,6 @@ expectedGhcOnlyExtensions :: [String]
expectedGhcOnlyExtensions = ["RelaxedLayout",
"AlternativeLayoutRule",
"AlternativeLayoutRuleTransitional",
"TypeFamilyDependencies",
"UnboxedSums",
"DerivingStrategies"]
......
......@@ -52,7 +52,7 @@ test('haddock.base',
test('haddock.Cabal',
[unless(in_tree_compiler(), skip), req_haddock
,stats_num_field('bytes allocated',
[(wordsize(64), 16014171248, 5)
[(wordsize(64), 20619433656, 5)
# 2012-08-14: 3255435248 (amd64/Linux)
# 2012-08-29: 3324606664 (amd64/Linux, new codegen)
# 2012-10-08: 3373401360 (amd64/Linux)
......@@ -88,6 +88,7 @@ test('haddock.Cabal',
# of modules in Cabal. This Cabal update added a large number
# of new modules; if you exclude them from the haddock run
# the stats are comparable.
# 2016-10-01: 20619433656 (amd64/Linux) - Cabal update
,(platform('i386-unknown-mingw32'), 3293415576, 5)
# 2012-10-30: 1733638168 (x86/Windows)
......
......@@ -150,7 +150,7 @@ doCopy directory distDir
where
noGhcPrimHook f pd lbi us flags
= let pd'
| packageName pd == PackageName "ghc-prim" =
| packageName pd == mkPackageName "ghc-prim" =
case library pd of
Just lib ->
let ghcPrim = fromJust (simpleParse "GHC.Prim")
......@@ -312,7 +312,7 @@ generate directory distdir dll0Modules config_args
do cwd <- getCurrentDirectory
let ipid = mkUnitId (display (packageId pd))
let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir
pd (AbiHash "") lib lbi clbi
pd (mkAbiHash "") lib lbi clbi
final_ipi = mangleIPI directory distdir lbi $ installedPkgInfo {
Installed.installedUnitId = ipid,
Installed.compatPackageKey = display (packageId pd),
......@@ -350,7 +350,7 @@ generate directory distdir dll0Modules config_args
-- stricter than gnu ld). Thus we remove the ldOptions for
-- GHC's rts package:
hackRtsPackage index =
case PackageIndex.lookupPackageName index (PackageName "rts") of
case PackageIndex.lookupPackageName index (mkPackageName "rts") of
[(_,[rts])] ->
PackageIndex.insert rts{
Installed.ldOptions = [],
......
......@@ -18,6 +18,7 @@ import qualified GHC.PackageDb as GhcPkg
import GHC.PackageDb (BinaryStringRep(..))
import qualified Distribution.Simple.PackageIndex as PackageIndex
import qualified Data.Graph as Graph
import qualified Data.Version as V
import qualified Distribution.ModuleName as ModuleName
import Distribution.ModuleName (ModuleName)
import Distribution.InstalledPackageInfo as Cabal
......@@ -324,8 +325,8 @@ data AsPackageArg
-- | Represents how a package may be specified by a user on the command line.
data PackageArg
-- | A package identifier foo-0.1; the version might be a glob.
= Id PackageIdentifier
-- | A package identifier foo-0.1, or a glob foo-*
= Id GlobPackageIdentifier
-- | An installed package ID foo-0.1-HASH. This is guaranteed to uniquely
-- match a single entry in the package database.
| IUId UnitId
......@@ -487,26 +488,32 @@ parseCheck parser str what =
[x] -> return x
_ -> die ("cannot parse \'" ++ str ++ "\' as a " ++ what)
readGlobPkgId :: String -> IO PackageIdentifier
-- | Either an exact 'PackageIdentifier', or a glob for all packages
-- matching 'PackageName'.
data GlobPackageIdentifier
= ExactPackageIdentifier PackageIdentifier
| GlobPackageIdentifier PackageName
displayGlobPkgId :: GlobPackageIdentifier -> String
displayGlobPkgId (ExactPackageIdentifier pid) = display pid
displayGlobPkgId (GlobPackageIdentifier pn) = display pn ++ "-*"
readGlobPkgId :: String -> IO GlobPackageIdentifier
readGlobPkgId str = parseCheck parseGlobPackageId str "package identifier"
parseGlobPackageId :: ReadP r PackageIdentifier
parseGlobPackageId :: ReadP r GlobPackageIdentifier
parseGlobPackageId =
parse
fmap ExactPackageIdentifier parse
+++
(do n <- parse
_ <- string "-*"
return (PackageIdentifier{ pkgName = n, pkgVersion = globVersion }))
return (GlobPackageIdentifier n))
readPackageArg :: AsPackageArg -> String -> IO PackageArg
readPackageArg AsUnitId str =
parseCheck (IUId `fmap` parse) str "installed package id"
readPackageArg AsDefault str = Id `fmap` readGlobPkgId str
-- globVersion means "all versions"
globVersion :: Version
globVersion = Version [] ["*"]
-- -----------------------------------------------------------------------------
-- Package databases
......@@ -1088,10 +1095,9 @@ convertPackageInfoToCacheFormat pkg =
GhcPkg.unitId = installedUnitId pkg,
GhcPkg.sourcePackageId = sourcePackageId pkg,
GhcPkg.packageName = packageName pkg,
GhcPkg.packageVersion = packageVersion pkg,
GhcPkg.packageVersion = V.Version (versionNumbers (packageVersion pkg)) [],
GhcPkg.depends = depends pkg,
GhcPkg.abiHash = let AbiHash abi = abiHash pkg
in abi,
GhcPkg.abiHash = unAbiHash (abiHash pkg),
GhcPkg.importDirs = importDirs pkg,
GhcPkg.hsLibraries = hsLibraries pkg,
GhcPkg.extraLibraries = extraLibraries pkg,
......@@ -1113,7 +1119,7 @@ convertPackageInfoToCacheFormat pkg =
where convertExposed (ExposedModule n reexport) = (n, reexport)
instance GhcPkg.BinaryStringRep PackageName where
fromStringRep = PackageName . fromStringRep
fromStringRep = mkPackageName . fromStringRep
toStringRep = toStringRep . display
instance GhcPkg.BinaryStringRep PackageIdentifier where
......@@ -1123,7 +1129,7 @@ instance GhcPkg.BinaryStringRep PackageIdentifier where
instance GhcPkg.BinaryStringRep UnitId where
fromStringRep = mkUnitId . fromStringRep
toStringRep (SimpleUnitId (ComponentId cid_str)) = toStringRep cid_str
toStringRep (SimpleUnitId cid) = toStringRep (unComponentId cid)
instance GhcPkg.BinaryStringRep ModuleName where
fromStringRep = ModuleName.fromString . fromStringRep
......@@ -1340,7 +1346,7 @@ showPackageDot verbosity myflags = do
-- ToDo: This is no longer well-defined with unit ids, because the
-- dependencies may be varying versions
latestPackage :: Verbosity -> [Flag] -> PackageIdentifier -> IO ()
latestPackage :: Verbosity -> [Flag] -> GlobPackageIdentifier -> IO ()
latestPackage verbosity my_flags pkgid = do
(_, _, flag_db_stack) <-
getPkgDatabases verbosity False{-modify-} False{-use user-}
......@@ -1401,18 +1407,16 @@ findPackagesByDB db_stack pkgarg
[] -> die ("cannot find package " ++ pkg_msg pkgarg)
ps -> return ps
where
pkg_msg (Id pkgid) = display pkgid
pkg_msg (Id pkgid) = displayGlobPkgId pkgid
pkg_msg (IUId ipid) = display ipid
pkg_msg (Substring pkgpat _) = "matching " ++ pkgpat
matches :: PackageIdentifier -> PackageIdentifier -> Bool
pid `matches` pid'
= (pkgName pid == pkgName pid')
&& (pkgVersion pid == pkgVersion pid' || not (realVersion pid))
realVersion :: PackageIdentifier -> Bool
realVersion pkgid = versionBranch (pkgVersion pkgid) /= []
-- when versionBranch == [], this is a glob
matches :: GlobPackageIdentifier -> PackageIdentifier -> Bool
GlobPackageIdentifier pn `matches` pid'
= (pn == pkgName pid')
ExactPackageIdentifier pid `matches` pid'
= pkgName pid == pkgName pid' &&
(pkgVersion pid == pkgVersion pid' || pkgVersion pid == nullVersion)
matchesPkg :: PackageArg -> InstalledPackageInfo -> Bool
(Id pid) `matchesPkg` pkg = pid `matches` sourcePackageId pkg
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment