Commit 17af6b98 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

UHC: registerPackage stop using source pkg and inplace args

UHC's version of registerPackage is the only one that makes use of the
PackageDescription and inplace :: Bool args, and it's quite wrong for
doing so. Registering a package should depend on the content of the
InstalledPackageInfo and the PackageDBStack to register into and the
Compiler to register with. It should not depend on the original source
PackageDescription, and should not need a separate inplace arg. The
location is determined by the PackageDBStack. UHC was not following
this pattern and thereby forcing the general compiler independent
registerPackage to take annoying and unnecessary arguments.

With this patch, the register location is determined by the
PackageDBStack. The source package id also comes from the
InstalledPackageInfo rather than the source PackageDescription.

This patch does not yet change the registerPackage type.
parent 0501e50a
......@@ -270,13 +270,15 @@ registerPackage
-> Bool
-> PackageDBStack
-> IO ()
registerPackage verbosity installedPkgInfo pkg lbi inplace _packageDbs = do
let installDirs = absoluteInstallDirs pkg lbi NoCopyDest
pkgdir | inplace = buildDir lbi </> uhcPackageDir (display pkgid) (display compilerid)
| otherwise = libdir installDirs </> uhcPackageSubDir (display compilerid)
registerPackage verbosity installedPkgInfo _pkg lbi _inplace packageDbs = do
dbdir <- case last packageDbs of
GlobalPackageDB -> getGlobalPackageDir verbosity (withPrograms lbi)
UserPackageDB -> getUserPackageDir
SpecificPackageDB dir -> return dir
let pkgdir = dbdir </> uhcPackageDir (display pkgid) (display compilerid)
createDirectoryIfMissingVerbose verbosity True pkgdir
writeUTF8File (pkgdir </> installedPkgConfig)
(showInstalledPackageInfo installedPkgInfo)
where
pkgid = packageId pkg
pkgid = sourcePackageId installedPkgInfo
compilerid = compilerId (compiler lbi)
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