Commit a7adb799 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add a bunch of TODOs and minor doc changes

Most TODOs related to the new InstalledPackageId stuff.
parent 51b920c9
......@@ -113,7 +113,7 @@ instance Text PackageIdentifier where
-- * Installed Package Ids
-- ------------------------------------------------------------
-- | An InstalledPackageId uniquely identifies a package instance.
-- | An InstalledPackageId uniquely identifies an instance of an installed package.
-- There can be at most one package with a given 'InstalledPackageId'
-- in a package database, or overlay of databases.
--
......@@ -130,7 +130,8 @@ instance Text InstalledPackageId where
-- * Package source dependencies
-- ------------------------------------------------------------
-- | describes a source (API) dependency
-- | Describes a dependency on a source package (API)
--
data Dependency = Dependency PackageName VersionRange
deriving (Read, Show, Eq)
......
......@@ -47,6 +47,7 @@ generate _pkg_descr lbi = concat $
,"\n\n"
]
| pkgid@(PackageIdentifier name version) <-
--TODO: too many conversions from InstalledPackageId to source PackageId
map (packageId . getLocalPackageInfo lbi) $ externalPackageDeps lbi
, let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)
pkgname = map fixchar (display name)
......
......@@ -306,6 +306,10 @@ configure (pkg_descr0, pbi) cfg
-- libraries that could possibly be defined by the .cabal file.
let pid = packageId pkg_descr0
internalPackageSet = PackageIndex.fromList [ emptyInstalledPackageInfo {
--TODO: should use a per-compiler method to map the source
-- package ID into an installed package id we can use
-- for the internal package set. The open-codes use of
-- InstalledPackageId . display here is a hack.
Installed.installedPackageId = InstalledPackageId $ display $ pid,
Installed.sourcePackageId = pid
} ]
......@@ -381,6 +385,7 @@ configure (pkg_descr0, pbi) cfg
++ "package. To use this feature the package must specify at "
++ "least 'cabal-version: >= 1.8'."
--TODO: sort out this need to keep converting package id types.
let installedPackageIndex =
PackageIndex.listToInstalledPackageIndex $
PackageIndex.allPackages packageSet
......
......@@ -125,6 +125,12 @@ data ComponentLocalBuildInfo = ComponentLocalBuildInfo {
}
deriving (Read, Show)
--TODO: check how these are used. In particular check how we handle
-- intra-package deps, are they really InstalledPackageId?
--TODO: having to do (packageId . getLocalPackageInfo lbi) to convert
-- an InstalledPackageId to a PackageId is not really ideal.
componentPackageDeps :: LocalBuildInfo -> ComponentLocalBuildInfo -> [PackageId]
componentPackageDeps lbi =
map (packageId.getLocalPackageInfo lbi) . componentInstalledPackageDeps
......
......@@ -173,6 +173,8 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace distPref = do
--TODO: eliminate pwd!
pwd <- getCurrentDirectory
--TODO: the method of setting the InstalledPackageId is compiler specific
-- this aspect should be delegated to a per-compiler helper.
let comp = compiler lbi
ipid_suffix <-
if inplace
......@@ -192,8 +194,6 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace distPref = do
return installedPkgInfo{ IPI.installedPackageId = ipid }
registerPackage :: Verbosity
-> PackageDescription
-> Library
......@@ -292,6 +292,7 @@ generalInstalledPackageInfo
-> InstalledPackageInfo
generalInstalledPackageInfo adjustRelIncDirs pkg lib clbi installDirs =
InstalledPackageInfo {
--TODO: do not open-code this conversion from PackageId to InstalledPackageId
IPI.installedPackageId = InstalledPackageId (display (packageId pkg)),
IPI.sourcePackageId = packageId pkg,
IPI.license = license 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