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

Hash-based depdendcies – please review



Hi,

with ghc6-6.12.1, it is really easy to use hash-based dependencies. I
implemented it in haskell-devscripts, but it needs review and testing.
The patches in question are:
http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts;a=commitdiff;h=20100113144802-23c07-8f7a769bd7667634221c1704664325477902f5d5.gz
and
http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-devscripts;a=commitdiff;h=20100113144820-23c07-d2240efeab042b06c76b1e522b4607f6b63511dd.gz

Here is an overview of how it works:

== Background ==

If you use ghc-pkg from 6.12, you will see that each package has a field
"id", comprising of the package name, the version, and a hash that
represents the particular ABI:

# ghc-pkg6 field mtl id
id: mtl-1.1.0.2-23ca4de7c573fd4df309067199a40634

Packages also depend on these full ids:

# cat haskell-ifelse-0.85/debian/libghc6-ifelse-dev/var/lib/ghc-6.12.1/package.conf.d/IfElse-0.85.conf 
name: IfElse
version: 0.85
id: IfElse-0.85-2ff8a6635b2bda1737cc09f054feaeee
[..]
depends: base-4.2.0.0-2cc27b7e43511c4ca001642a7f77a8f6
         mtl-1.1.0.2-23ca4de7c573fd4df309067199a40634

The ids can change even when the upstream version does not for various
reasons, and our current dependency system does not catch this.

== Part 1 ==

So now there is dh_haskell_provides in the haskell-devscripts code. It
creates a ${haskell:Provides} substvar for the -dev and -proc packages:

# grep Provides haskell-mtl-1.1.0.2/debian/*substvars
haskell-mtl-1.1.0.2/debian/libghc6-mtl-dev.substvars:haskell:Provides=libghc6-mtl-dev-1.1.0.2-23ca4
haskell-mtl-1.1.0.2/debian/libghc6-mtl-prof.substvars:haskell:Provides=libghc6-mtl-prof-1.1.0.2-23ca4

As you can see, the name it provides is built up like this:
libghc6-<lowercase cabal name>-{dev,prof}-h<cabal version>-<first 5 chars from hash>

The id is shortened to keep the names legible. (Idea stolen from the
ocaml people). It is still very unlikely that we ever hit a collision.

The virtual package name is built purely from information from the cabal
package description, the debian package does not influence this. This is
a feature, as it makes the names predictable. In most cases, they will
look the same, but e.g. libghc6-quickcheck1-dev will provide
libghc6-quickcheck-dev-1.0.1-abcde.

Packages need a sourceful upload to add the line
Provides: ${haskell:Provides}
to both -dev and -prof package.

== Part 2 ==

dh_haskell_depends know how to hande this. For each cabal packages that
the library we are building it depends upon, it takes the id from the
package description. It transforms it to the (predictable) virtual
package name.

Now, if we’d agree to move to this system all at once, i.e. don’t do
binNMUs for 6.12 but sourceful uploads, adding the Provides field, we’d
be done: We could just put the derived virtual package name in the
Depends field and we are done.

But the code does allow for a gradial change. It runs "dpkg -W <virtual
package name>" and if dpkg does not return an error, it knows about this
particular virtual package and we depend on it. If it is not known to
dpkg, we fall back to the old mechanism.

== Effect ==

Before:
# dpkg -I libghc6-ifelse-dev_0.85-1_amd64_before.deb
[..]
 Package: libghc6-ifelse-dev
 Version: 0.85-1
 Depends: ghc6 (>= 6.12.1-1), ghc6 (<< 6.12.1+), libghc6-mtl-dev (>= 1.1.0.2-7), libghc6-mtl-dev (<< 1.1.0.2+), libc6 (>= 2.3.3), libffi5 (>= 3.0.4), libgmp3c2
[..]

After:
# dpkg -I libghc6-mtl-dev_1.1.0.2-7_amd64.deb
 Package: libghc6-mtl-dev
[..]
 Provides: libghc6-mtl-dev-1.1.0.2-23ca4

# dpkg -I libghc6-ifelse-dev_0.85-1_amd64.deb
[..]
 Package: libghc6-ifelse-dev
 Version: 0.85-1
 Depends: ghc6 (>= 6.12.1-1), ghc6 (<< 6.12.1+), libghc6-mtl-dev-1.1.0.2-23ca4, libc6 (>= 2.3.3), libffi5 (>= 3.0.4), libgmp3c2

== Summary ==

So besides having more robust binary dependencies, we even get short and
(IMHO) more readable Depend lines. Thanks to the edos-debcheck support
in wanna-build, this has no effect on the buildds or the binNMUs. I
think this is a good system.

Nevertheless, it might have bugs. So please look at the code and test it
a bit. When kaol decides that ghc6-6.12 is ready for unstable, I’d like
to see this uploaded with it.

We need to decide if we want to switch completely to this and remove
support for the version-based dependencies from haskell-devscripts. I’m
in favour of this. But if we want to do it gradually, I can live with
that as well.

Greetings,
Joachim

PS: I’ll be on vacation from Saturday to Saturday. 


-- 
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: Dies ist ein digital signierter Nachrichtenteil


Reply to: