To answer myself: I am probably not correct.
I though I understood uses constraints well, but trying to formalize the
problem makes me feel daft.

A bundle can consume objects transitively through any chain of wires and
feed them somewhere else transitively as well. It doesn't have to see the
entire type hierarchy of the objects to do this. It is sufficient to load
only the types present in the bundle code.

So when we take all wires of a bundle and then expand them transitively we
must not hit two versions of any package.
I.e. any two chains of wires that start form the bundle can not terminate
at two versions of the same package.

I hope this covers it.

Todor

On Thu, Jan 11, 2018 at 1:59 PM, Todor Boev <rinsv...@gmail.com> wrote:

> I am trying to describe the most obvious brute force way to verify uses
> constraints of one wire are satisfied:
>
> i) Build recursively a set of all "reachable" packages:
>   0. Start with the capability of the wire
>   1. For every package in the capability "uses" list
>   2. Search the wire host bundle for requirements of that package
>   3. For every requirement find all matching capabilities
>   4. Recursively repeat for each capability
>
> ii) Then find the subset of reachable packages that are directly imported
> by the initial bundle
>  1. Match each requirement of the bundle to each candidate capability
>  2. Get only the matches
>
> iii) Then split the resulting set into sub-sets of duplicate package
> versions
>   E.g. {{org.foo 1.0, org.foo 2.0, ...}, ..., {org.bar 1.0, org.bar 2.0,
> ...}, ...}
>
> iv) Then require that the bundle wires to only one version per sub-set:
>   E.g. {org.foo 1.0, org.bar 2.0}
>
> I am not considering Require-Bundle yet.
>
> Is this correct?
>
> Todor
>
_______________________________________________
p2-dev mailing list
p2-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/p2-dev

Reply via email to