Hi Ondrej,
this hits pretty close to much of what me and Mark talked about too. For
every case the question is whether we have constraint solving or not. I
don't expect to be able to do constraint solving this spring, but I'll
discuss both cases.
On 05/22/2015 01:40 AM, Ondřej Čertík wrote:
> Hi,
>
> I talked about this with Francois Bissey as well as with Chris Kees
> some time ago, and I would like to discuss it publicly here.
> Currently, all dependencies must be unique, as they are build using
> the same profile.
>
> Use case 1: I would like to have two packages A and B in the same
> profile, where A only builds with older swig, and B only builds with
> newer swig. It's only a build time dependency, so why not to allow it?
Once my current parameter refactor is done this should be easy to add by
adding some syntax to use a package spec twice.
WITHOUT CONSTRAINT SOLVING:
packages:
swig as swig_for_A:
version: 1
swig:
version: 2
A:
swig: swig_for_A # use an older swig here
B:
# gets swig version 2 by default
WITH CONSTRAINT SOLVING:
If the A package has
constraints:
- swig.version <= 1.3
and package B has
constraints:
- swig.version >= 1.5.2
then we could have the constraint solver decide to instantiate two
copies of swig. The question is whether this is wanted behavior in all
cases; we may well need some sort of annotation to declare that this is
safe (like the ones you suggest). But until we have constraint solving
you would need to handle this manually in the profile anyway.
> Use case 2: library A is linked against older Lapack, library B is
> linked against newer lapack. Program C is linked against A and B, but
> doesn't explicitly depend on Lapack. These are all build time
> dependencies. The problem is, that we should not allow this kind of
> linking, as the symbols will be mixed up with the two versions of
> Lapack.
Well, unless you do something special the lapack will be the same for A
and B, right? But assume again we had this:
packages:
lapack as lapack_old:
version: 1
lapack:
version: 2
A:
lapack: lapack_old
B: # deps [lapack]
C: # deps [A, B]
In this case, what we should do is add a constraint to C.yaml:
constraints:
- A.lapack == B.lapack # forces these to be same build artifact
So now the profile above will give an error, because the user tried to
do something that is explicitly forbidden in C.yaml. Remove the C
package, and the profile builds fine with different lapacks for A and B.
This is fundamentally what must happen; the question is whether we want
that constraint to be auto-generated through some syntax candy or not.
On this topic I sort of want to wait until this kind of constraint is
commonly in use, then look at what annotation is natural to deduce such
a constraint for the dependencies declaration.
> Use case 3: You have the same A and B libraries, however this time the
> package C has a binary c1 that is linked with A, and binary c2 that is
> linked with B. Then there is no problem.
So this is the example above but you just drop the constraints section.
> It needs to be the package maintainer who decides what the situation
> is. One solution is to have these kind of dependencies in Hashdist:
>
> * build-nonlink (do not need to be unique)
>
> * build-link (must be recursively unique for the given package, but do
> not need to be unique for the profile)
>
> * run (must be unique for the whole profile)
I do like these categories. But my proposal is we get the
parameter-and-constraints system up and running well first, use the
constraints like I describe above when we need them, then view what you
state here as syntax candy to auto-generate/inhibit constraints that we
can put on top. That should increase the odds of making the right
categories.
Dag Sverre