-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add and
constraints in depopts cnf
#200
Comments
Translating any formluas into CNF in the depends field should be easy, however the depots field has a different semantics, so I'm not sure (yet) how to do that properly. |
This is part of #200, where we want to express more complex (optional) dependencies between packages, for instance: depopts: [ "async" {="108.00.02"} | ("lwt" {>="2.4.1"} "ssl") | "mirage-net" ]
So now we can write: %{lwt+ssl:enable}%, which is expanded to "enable" iff %{lwt:enable}% and %{ssl:enable}%. This should help fixing #200.
OK, I've done some digging in there, and it appears that it is not easy to change the semantics of depopts without too much changes in the solver. Indeed, if you want what appears in "depots" to force the installation of some packages in some cases (for instance, if you want "ssl" to install when "lwt" is already there), then you need either:
So finally, I've come up with a simpler solution:
|
Ok, so if I understand this, for cohttp we keep |
yes, you could either:
|
ok...I'll make this change in a few days when 0.7.6 is out, as it breaks backwards compatibility with the repository format. On 3 Oct 2012, at 12:43, Thomas Gazagnaire notifications@github.com wrote:
|
We just had a little discussion here at Irill on this issue with Pietro and Ralf: the encoding into CUDF for the solver of the ("lwt" & "ssl") is doable by a simple manipulation of the CUDF document passed to the solver:
That's all :-) In general you can extend this encoding to arbitrary CNF formulae containing & . |
Hi Roberto. I'm not sure I understand how this will help. The problem can be summarized as follow: I have 3 packages, A, B and C. A optionally depends on "B+C", which means the only "valid" universes are:
Does your trick help to solve this ? |
Hi Thomas,
The only correct universes will be the ones you want. The point of this encoding is that it is simple, does not take up much space, and We can disuss this on a blackboard when you are in Paris :-) |
Let me add for clarity that the translated CUDF would be package: A package: B+C |
Anyway, I suggest we discuss all the translation together at the first occasion. |
Hum, I'm still not totally convinced. If you start with the universe: {B} then if you call the solver to install {A}, what constraint will cause either B to be uninstalled or C to be installed ? |
ok, I see what you mean, will be back on this later :-)
|
Hi Thomas, here is a more extensive discussion of this issue. Looking at your last message, I think we misunderstood your requirement: we thought that, since you are compiling sources from scratch, the presence or absence of B and C together is only relevant when installing A, as that is the moment when you recompile A, and you link in the libraries from B and C; in this particular case the suggested translation was reasonable; but of course there are situation where you do dynamic linking etc., so opam must ensure at any time that A's runtime dependencies are satisied, and you need a more thorough translation (see better suggestion below). Since you really want to have either B and C or none of them together with A, it is necessary to encode somehow in A's dependencies the fact that B<=>C. We suggest to consider taking full advantage of what CUDF solvers offer today; if you have access to MISC-competition compliant external solvers, like aspcud, p2cudf, mccs or packup, you may proceed as follows:
In any case, some tracking work is needed to recompile A if one discovers that some of its optional dependencies have changed, but I imagine you do that already. |
This should be fixed by the recent changes in the solver API. Now, if
is rewritten as:
|
Unfortunately, this does not prevent the solver from returning a solution that violates a conjunctive depopt if no one of the conjunct is previously installed. |
From a cl-mirage question about cohttp:
The text was updated successfully, but these errors were encountered: