RE: Extending the dependency syntax

On 28 July 2005 22:36, Duncan Coutts wrote:
While the sensible normal behaviour might be to just pick up as many dependencies as the environment supports, packaging systems like to know about all dependencies and control them. For example it is normal to build a package on one system and deploy it on another. If there are extra dependencies that are picked up (because they happen to be in the build environment) it may cause a failure on the target system because the dependency is not present.
A very good point.
As an example consider Gtk2Hs which has a number of optional dependencies (libglade, GConf, Mozilla). If you do a normal build then it will automatically build all the optional bits for which the dependencies are satisfied. This is what casual users want.
However for packagers we provide a --enable-packager-mode flag which turns off all automatic dependency decisions and so the packager must explicitly specify --enable-gconf --enable-libglade etc.
Thank you, you've provided an excellent example to demonstrate the flexibility of the scheme I proposed :-) I need one more operator, which I'll write ':', and which means the same as a Prolog cut(!). Don't worry if you're not familiar with Prolog, all will become clear. So here's how you express the Gtk dependencies: build-depends: ("packager-mode": ("enable-gconf": gconf>=1.0 [gconf] ||) ("enable-libglade": libglade>=1.0 [libglade] ||) ) || ( (gconf>=1.0 [gconf] ||) (libglade>=1.0 [libglade] ||) ) In words, this says - if "packager-mode" is defined, then - if "enable-gconf" is defined then require gconf>=1.0 and process the [gconf] stanza - if "enable-libglade" is defined then require libglade>=1.0 and process the [libglade] stanza - otherwise, - if gconf>=1.0 is available, process the [gconf] stanza - if libglade>=1.0 is available, process the [libglade] stanza I have to admit, I think this is beautiful. But I'm prepared to believe that others might prefer to go for something a bit more concrete. I imagine that the packager-mode concept is something that we'd want every package to conform to, so we don't want to require every packager to write the appropriate build-depends magic. OTOH, I still like the simplicity of the design. We could add built-in packager-mode support like this: (a) --packager-mode causes all dependencies inside a disjunction to fail by default, and (b) --enable-foo forces an optional dependency on foo to be required. So then the packager just writes build-depends: (gconf>=1.0 [gconf] ||) (libglade>=1.0 [libglade] ||) But this is starting to get a bit subtle. Cheers, Simon

On Thu, 2005-07-28 at 23:42 +0100, Simon Marlow wrote:
build-depends: (gconf>=1.0 [gconf] ||) (libglade>=1.0 [libglade] ||)
But this is starting to get a bit subtle.
Just on a note about syntax. Gentoo uses this syntax for optional dependencies: flag? ( dep ) So for example we write the Gtk2Hs build dependencies like this: DEPEND=">=virtual/ghc-5.04 >=x11-libs/gtk+-2 gnome? ( >=gnome-base/libglade-2 >=x11-libs/gtksourceview-0.6 >=gnome-base/gconf-2 ) mozilla? ( >=www-client/mozilla-1.4 ) doc? ( >=dev-haskell/haddock-0.6 )" Of course cabal doesn't have the complication of package catageories and such so for a cabal style it'd look more like: build-depends: ghc >= 5.04, gnome? ( libglade >= 2, gtksourceview >= 0.6, gconf >= 2 ), mozilla? ( mozilla >= 1.4 ), doc? ( haddock >= 0.6 ) and also of course these Gtk2Hs deps are actually mostly C libraries. But you get the idea. And then we match up these "use" flags (more or less) 1-to-1 with configure flags that enable/disable optional features. Just an idea. Duncan
participants (2)
-
Duncan Coutts
-
Simon Marlow