caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Virtual packages in findlib
@ 2009-07-08 10:35 Dario Teixeira
  2009-07-13 22:55 ` Gerd Stolpmann
  0 siblings, 1 reply; 4+ messages in thread
From: Dario Teixeira @ 2009-07-08 10:35 UTC (permalink / raw)
  To: caml-list, Stefano Zacchiroli


Hi,

> Can you explain that? I don't see why virtual packages can resolve
> ordering problems.

Because without virtual packages, one cannot list the true dependencies
of a package, thus causing ordering problems.

Consider the minimal example of there being two packages: A and B, with
B depending on A, and therefore having to be linked after.  However, A is
not a real package, but instead a virtual one instantiated by either
A1, A2, A3, etc.

But alas, there is no virtual package support in findlib (I assume).
Because of this, the META file for B does not list A as a dependency.
(Yes, the META is "wrong", but how could it be made right?)

Now, we tell ocamlbuild that the project depends on A1 (for instance) and B.
Because there is no *declared* dependency between A1 and B (though in fact
there should be), ocamlbuild probably assumes that it is indifferent to
link "A1; B" or "B; A1".  However, the latter case will cause an error.

Therefore, there are two solutions to this problem:

a) Make ocamlbuild preserve the order of the given packages *when there
   is no explicit dependency among them*.  (Obviously if there are dependencies
   then Ocamlbuild should re-order the packages as fit).

b) Find some virtual package mechanism in findlib (thus rendering the
   hack a) moot).

Cheers,
Dario Teixeira






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Virtual packages in findlib
  2009-07-08 10:35 [Caml-list] Virtual packages in findlib Dario Teixeira
@ 2009-07-13 22:55 ` Gerd Stolpmann
  2009-07-14 20:47   ` Dario Teixeira
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Stolpmann @ 2009-07-13 22:55 UTC (permalink / raw)
  To: Dario Teixeira; +Cc: caml-list, Stefano Zacchiroli


Am Mittwoch, den 08.07.2009, 03:35 -0700 schrieb Dario Teixeira:
> Hi,
> 
> > Can you explain that? I don't see why virtual packages can resolve
> > ordering problems.
> 
> Because without virtual packages, one cannot list the true dependencies
> of a package, thus causing ordering problems.
> 
> Consider the minimal example of there being two packages: A and B, with
> B depending on A, and therefore having to be linked after.  However, A is
> not a real package, but instead a virtual one instantiated by either
> A1, A2, A3, etc.
> 
> But alas, there is no virtual package support in findlib (I assume).
> Because of this, the META file for B does not list A as a dependency.
> (Yes, the META is "wrong", but how could it be made right?)
> 
> Now, we tell ocamlbuild that the project depends on A1 (for instance) and B.
> Because there is no *declared* dependency between A1 and B (though in fact
> there should be), ocamlbuild probably assumes that it is indifferent to
> link "A1; B" or "B; A1".  However, the latter case will cause an error.
> 
> Therefore, there are two solutions to this problem:
> 
> a) Make ocamlbuild preserve the order of the given packages *when there
>    is no explicit dependency among them*.  (Obviously if there are dependencies
>    then Ocamlbuild should re-order the packages as fit).
> 
> b) Find some virtual package mechanism in findlib (thus rendering the
>    hack a) moot).

Well, you can make dependencies conditional using the predicate feature.
In B you can write:

requires(P_A1) = "A1"
requires(P_A2) = "A2"
etc.

and when linking you have to select which dependency to take by giving
the right -predicates switch: e.g. -predicates P_A1.

Also, there are subpackages (useful when you want to put A1 and A2 into
the same directory). So you can create a fancy package A with
subpackages A1 and A2 like:

requires(P_A1) = "A.A1"
requires(P_A2) = "A.A2"
requires = "A.A1"    (* default *)

package "A1" (
  (* definitions for A1	*)
  requires = ...
  archive(byte) = ...
  archive(native) = ...
)

package "A2" (
  (* definitions for A2	*)
  requires = ...
  archive(byte) = ...
  archive(native) = ...
)

And B simply lists A as dep, and A is dependent on either A.A1 or A.A2,
as given by predicates.

This is not really a virtual package as you describe it. It was
developed to support several versions of the same package, e.g. one
version with enabled debugging, and the other without. The predicates
work more or less orthogonal to the dependency graph.

Gerd

> 
> Cheers,
> Dario Teixeira
> 
> 
> 
>       
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Virtual packages in findlib
  2009-07-13 22:55 ` Gerd Stolpmann
@ 2009-07-14 20:47   ` Dario Teixeira
  0 siblings, 0 replies; 4+ messages in thread
From: Dario Teixeira @ 2009-07-14 20:47 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: caml-list, Stefano Zacchiroli


Hi,

> Well, you can make dependencies conditional using the predicate feature.
> In B you can write:
> (...)

Thanks! The predicates mechanism is enough to fix my problem...

Best regards,
Dario Teixeira






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Virtual packages in findlib
  2009-07-07 18:07 Dario Teixeira
@ 2009-07-08  7:41 ` Stefano Zacchiroli
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Zacchiroli @ 2009-07-08  7:41 UTC (permalink / raw)
  To: caml-list

On Tue, Jul 07, 2009 at 11:07:55AM -0700, Dario Teixeira wrote:
> having an order-preserving Ocamlbuild would be moot if findlib
> supported some sort of virtual packages).

Can you explain that? I don't see why virtual packages can resolve
ordering problems.

(Following your analogy, the same problems exist with Debian packages:
if you have pre-dependencies which force an order among packages, you
cannot fix that by resorting to virtual packages.)

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-14 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08 10:35 [Caml-list] Virtual packages in findlib Dario Teixeira
2009-07-13 22:55 ` Gerd Stolpmann
2009-07-14 20:47   ` Dario Teixeira
  -- strict thread matches above, loose matches on Subject: below --
2009-07-07 18:07 Dario Teixeira
2009-07-08  7:41 ` [Caml-list] " Stefano Zacchiroli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).