how to implement uninstall & Logging paths of installed files?
ijones at syntaxpolice.org
Mon Sep 18 20:15:06 EDT 2006
> On 9/16/06, Isaac Jones <ijones at syntaxpolice.org> wrote:
>> "Johan Tibell" <johan.tibell at gmail.com> writes:
>> > I'm trying to write a module that logs all files installed by Cabal to
>> > a file. I've looked through parts of the source and conclude that some
>> > of the information (the one used to generate prefixes) needed to
>> > construct absolute file paths for installed files exists in
>> > Distribution.Simple.LocalBuildInfo. Where does the actual copying take
>> > place and is there a way to list the files being copied or am I better
>> > of trying to list all files in the dist/ dir and prepend the prefixes
>> > myself? What code decides how files are laid out in dist/?
Hi all, FWIW, Johan is still interested in this.
I would look especially at the "copy" and "install" commands.
Look at Distribution.Simple.Utils, lots of "copy" related functions in
there. Look especially at the "prefix" type parameters.
The Distribution.Simple.Install.install function also implements the
"copy" command; so "install" is more general, the prefix is all that
changes, so look especially at this function. Look at the copydest
Someone (else?) was looking into writing an "uninstall" feature, which
would log the files installed so that it could remove them later.
I think that logging & uninstall could be implemented quite
effectively by tweaking the "install" target so that it first copies
stuff into a temporary location, then uses a "find" type algorithm to
discover all of the files that are meant to be installed.
The find algorithm would create this list of files and dump it to a
log. It would then use a recursive copy algorithm to copy all of
these files into place. (The copy command would do pretty much the
same, but skip the copy-in-place step.)
The recursive copy function would have to not freak out if the
directories already exist, of course.
Install should also install this "log" of files somplace (where?), for
the sake of uninstall.
How's that sound?
More information about the cabal-devel