Copyright | (c) Duncan Coutts 2008 |
---|---|
License | BSD-like |
Maintainer | [email protected] |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Distribution.Client.InstallSymlink
Description
Managing installing binaries with symlinks.
Synopsis
- data Symlink = Symlink {}
- symlinkBinaries :: Platform -> Compiler -> OverwritePolicy -> ConfigFlags -> InstallFlags -> InstallPlan -> BuildOutcomes -> IO [(PackageIdentifier, UnqualComponentName, FilePath)]
- symlinkBinary :: Symlink -> IO Bool
- symlinkableBinary :: Symlink -> IO Bool
- trySymlink :: Verbosity -> IO Bool
- promptRun :: String -> IO Bool -> IO Bool
Documentation
A record needed to either check if a symlink is possible or to create a symlink. Also used if copying instead of symlinking.
Constructors
Symlink | |
Fields
|
symlinkBinaries :: Platform -> Compiler -> OverwritePolicy -> ConfigFlags -> InstallFlags -> InstallPlan -> BuildOutcomes -> IO [(PackageIdentifier, UnqualComponentName, FilePath)] Source #
We would like by default to install binaries into some location that is on
the user's PATH. For per-user installations on Unix systems that basically
means the ~bin
directory. On the majority of platforms the ~bin
directory will be on the user's PATH. However some people are a bit nervous
about letting a package manager install programs into ~bin
.
A compromise solution is that instead of installing binaries directly into
~bin
, we could install them in a private location under ~.cabalbin
and then create symlinks in ~bin
. We can be careful when setting up the
symlinks that we do not overwrite any binary that the user installed. We can
check if it was a symlink we made because it would point to the private dir
where we install our binaries. This means we can install normally without
worrying and in a later phase set up symlinks, and if that fails then we
report it to the user, but even in this case the package is still in an OK
installed state.
This is an optional feature that users can choose to use or not. It is controlled from the config file. Of course it only works on POSIX systems with symlinks so is not available to Windows users.
symlinkBinary :: Symlink -> IO Bool Source #
Symlink binary.
The paths are take in pieces, so we can make relative link when possible.
True
if creating the symlink was successful. False
if there was another
file there already that we did not own. Other errors like permission errors
just propagate as exceptions.
symlinkableBinary :: Symlink -> IO Bool Source #
Can we symlink a binary?
True
if creating the symlink would be succeed, being optimistic that the user will
agree if prompted to overwrite.