[commit: Cabal] master: Allow cabal-install to re-install itself on Windows (9746b0a)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:58:15 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/9746b0a1ad456383023237078006db754386ec12
>---------------------------------------------------------------
commit 9746b0a1ad456383023237078006db754386ec12
Author: Duncan Coutts <duncan at haskell.org>
Date: Tue Aug 12 21:51:38 2008 +0000
Allow cabal-install to re-install itself on Windows
This is a fairly heavyweight solution, but then it's quite
a nasty problem. What we do is when we notice that we're
about to install something in place of our own .exe file,
we move our exe file out of the way (but in the same dir).
Then after we've installed the new exe we call it and ask
it to delete the old file (so we do not litter the bin dir
with lots of old versions). That requires synchronising
between the old and new programs and for the new program
to understand a command to do the syncing and deleting of
the old program. Lots of Win32 FFI imports. :-(
On the plus side it seems to work and is transparent to
the user and the rest of cabal-install. In particular the
actual file-installation code (which is burried deep
within Cabal) does not need to know about the special case
of installing over our own exe file.
cabal-install/Distribution/Client/Install.hs | 65 +++++-
.../Distribution/Client/Win32SelfUpgrade.hs | 222 ++++++++++++++++++++
cabal-install/Main.hs | 16 ++-
cabal-install/cabal-install.cabal | 1 +
4 files changed, 293 insertions(+), 11 deletions(-)
Diff suppressed because of size. To see it, use:
git show 9746b0a1ad456383023237078006db754386ec12
More information about the Cvs-libraries
mailing list