how to implement uninstall & Logging paths of installed files?

Johan Tibell johan.tibell at gmail.com
Tue Sep 19 15:03:07 EDT 2006


> > I have essentially already implemented the find algorithm under the
> > assumption that files that would be copied to for example /usr/bin
> > will be but in /my/tmp/dir/usr/bin during the build.
>
> I don't think I understand your assumption. What do you mean "during
> the build"? I think the only way to make sure that your paths are
> correct is to do a "fake" install into a temp directory and then do a
> recursive copy.
>
> For instance, I think we have dist/build/foo/foo.exe (or something)
> would get installed in /usr/bin/foo.exe, and dist/doc/foo.html would
> be installed in /usr/share/doc/foo/foo.html.  So the install paths
> aren't correct at build time, only at install time.

Sorry for being a bit unclear. My algorithm takes a directory prefix
such as /tmp and recursively creates a list of absolute paths with the
prefix removed. Example:

Actuall files and dirs:

/tmp/usr/bin/foo.exe
/tmp/usr/share/doc/doc.txt

The log file I create would look like this when run with /tmp as prefix:

/usr/bin/foo.exe _SHA-1_or_something_
/usr/share/doc/doc.txt _SHA-1_or_something_

I have a function:

-- | @writeInstallLog file dir@ creates a file @file@ that contains a list of
-- all directories and files in @dir@ with the prefix @dir@ removed and /
-- prepended.
writeInstallLog :: FilePath -> FilePath -> IO ()

> > The files are removed in a way that will also remove empty
> > directories. I was thinking of putting a timestamp on the files as
> > well.
>
> And maybe a sha1 sum?

Perhaps it would be a good idea to come up with things that could go
wrong during an uninstall. Here are some:

* File missing (deleted by user).
* File modified.
* File shared with some other Cabal package.
* Configuration file (may not be removed).

- Johan


More information about the cabal-devel mailing list