[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Uses constraints support in the p2 Projector

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.


On Thu, Jan 11, 2018 at 1:59 PM, Todor Boev <rinsvind@xxxxxxxxx> 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?