[commit: Cabal] master: Rearrange the symlinking code slightly (ad51a33)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:57:20 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/ad51a33081200d162646ca5cdf852a500accb057
>---------------------------------------------------------------
commit ad51a33081200d162646ca5cdf852a500accb057
Author: Duncan Coutts <duncan at haskell.org>
Date: Wed Aug 6 14:26:56 2008 +0000
Rearrange the symlinking code slightly
Will make it easier to create the bin dir, if that's what we want to do.
>---------------------------------------------------------------
.../Distribution/Client/InstallSymlink.hs | 39 ++++++++++++--------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/cabal-install/Distribution/Client/InstallSymlink.hs b/cabal-install/Distribution/Client/InstallSymlink.hs
index 7153b31..7239930 100644
--- a/cabal-install/Distribution/Client/InstallSymlink.hs
+++ b/cabal-install/Distribution/Client/InstallSymlink.hs
@@ -99,27 +99,34 @@ symlinkBinaries :: ConfigFlags
symlinkBinaries configFlags installFlags plan =
case flagToMaybe (installSymlinkBinDir installFlags) of
Nothing -> return []
- Just symlinkBinDir -> do
+ Just symlinkBinDir
+ | null exes -> return []
+ | otherwise -> do
publicBinDir <- canonicalizePath symlinkBinDir
+-- TODO: do we want to do this here? :
+-- createDirectoryIfMissing True publicBinDir
fmap catMaybes $ sequence
- [ let publicExeName = PackageDescription.exeName exe
+ [ do privateBinDir <- pkgBinDir pkg
+ ok <- symlinkBinary
+ publicBinDir privateBinDir
+ publicExeName privateExeName
+ if ok
+ then return Nothing
+ else return (Just (pkgid, publicExeName,
+ privateBinDir </> privateExeName))
+ | (pkg, exe) <- exes
+ , let publicExeName = PackageDescription.exeName exe
privateExeName = prefix ++ publicExeName ++ suffix
+ pkgid = packageId pkg
prefix = substTemplate pkgid prefixTemplate
- suffix = substTemplate pkgid suffixTemplate
- in do privateBinDir <- pkgBinDir pkg
- ok <- symlinkBinary
- publicBinDir privateBinDir
- publicExeName privateExeName
- if ok
- then return Nothing
- else return (Just (pkgid, publicExeName,
- privateBinDir </> privateExeName))
- | InstallPlan.Installed cpkg _ <- InstallPlan.toList plan
- , let pkg = pkgDescription cpkg
- pkgid = packageId pkg
- , exe <- PackageDescription.executables pkg
- , PackageDescription.buildable (PackageDescription.buildInfo exe) ]
+ suffix = substTemplate pkgid suffixTemplate ]
where
+ exes =
+ [ (pkg, exe)
+ | InstallPlan.Installed cpkg _ <- InstallPlan.toList plan
+ , let pkg = pkgDescription cpkg
+ , exe <- PackageDescription.executables pkg
+ , PackageDescription.buildable (PackageDescription.buildInfo exe) ]
pkgDescription :: ConfiguredPackage -> PackageDescription
pkgDescription (ConfiguredPackage (AvailablePackage _ pkg _) flags _) =
More information about the Cvs-libraries
mailing list