[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Merging three direcories in postinst


in the Haskell packaging we have made a mistake that we want to
work-around without having to sourcefully upload 230 packages.
Eventually, we will have to do these uploads anyways (with the next
major ghc release), so the work-around will not be in place forever.

Here is the situation:

A haskell library consists of a -dev and a -doc package. The -doc
package contains a .haddock file which is placed
under /usr/lib/ghc-$(GHC_VERSION)/haddock/. The -dev part contains a
package description which, among other things, has a reference to the
path. So far so good.

Now -dev is arc:any and -doc is arch:all. A lot of packages were built
with ghc-7.0.2, and, after the upload of ghc-7.0.3, binNMUed. This has
the effect that the .haddock file lies in /usr/lib/ghc-7.0.2/haddock but
the package registry refers to /usr/lib/ghc-7.0.3/haddock and the index
is broken.

The proper thing that should have been done is to install stuff in a
directory not containing the ghc version, e.g. /usr/lib/haddock. This is
what we want to do in the future.

Nevertheless, we want to be able to use the previous builds. I am
considering to do the following:

In ghc’s postinst script, I’d do approximately this:

for dir in /usr/lib/ghc-7.0.2/haddock /usr/lib/ghc-7.0.3/haddock
  if test -d $dir
    mv $dir/* /usr/lib/haddock
    rmdir $dir
    ln -s ../haddock $dir

But before doing so, I’d like to get comments as to what can go wrong.
Especially, does dpkg mind if I replace something that dpkg thinks is a
proper directory by a symbolic link? Will it still cleanly remove files
that were installed by libghc-foo-doc into /usr/lib/ghc-7.0.3/haddock/
when libghc-foo-doc is removed? Or is there a neater way?


Joachim "nomeata" Breitner
Debian Developer
  nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: