From a7adb7998548102f244189b012f949db19db94c6 Mon Sep 17 00:00:00 2001 From: Duncan Coutts <duncan@haskell.org> Date: Sat, 22 Aug 2009 13:47:21 +0000 Subject: [PATCH] Add a bunch of TODOs and minor doc changes Most TODOs related to the new InstalledPackageId stuff. --- Distribution/Package.hs | 5 +++-- Distribution/Simple/Build/Macros.hs | 1 + Distribution/Simple/Configure.hs | 5 +++++ Distribution/Simple/LocalBuildInfo.hs | 6 ++++++ Distribution/Simple/Register.hs | 5 +++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Distribution/Package.hs b/Distribution/Package.hs index d6502efd9c..5aa0a5270e 100644 --- a/Distribution/Package.hs +++ b/Distribution/Package.hs @@ -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) diff --git a/Distribution/Simple/Build/Macros.hs b/Distribution/Simple/Build/Macros.hs index 250a430df8..dc25c71612 100644 --- a/Distribution/Simple/Build/Macros.hs +++ b/Distribution/Simple/Build/Macros.hs @@ -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) diff --git a/Distribution/Simple/Configure.hs b/Distribution/Simple/Configure.hs index 1f80def0c0..172d28b0dc 100644 --- a/Distribution/Simple/Configure.hs +++ b/Distribution/Simple/Configure.hs @@ -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 diff --git a/Distribution/Simple/LocalBuildInfo.hs b/Distribution/Simple/LocalBuildInfo.hs index 8228e63ffa..67a795612e 100644 --- a/Distribution/Simple/LocalBuildInfo.hs +++ b/Distribution/Simple/LocalBuildInfo.hs @@ -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 diff --git a/Distribution/Simple/Register.hs b/Distribution/Simple/Register.hs index c94076d500..f0cc098606 100644 --- a/Distribution/Simple/Register.hs +++ b/Distribution/Simple/Register.hs @@ -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, -- GitLab