Skip to content
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

resolve: Avoid presenting duplicate capabilities to the resolver #4409

Merged
merged 7 commits into from
Nov 12, 2020
Merged

resolve: Avoid presenting duplicate capabilities to the resolver #4409

merged 7 commits into from
Nov 12, 2020

Conversation

bjhargrave
Copy link
Member

Multiple repositories can reference the same resources. For example an index generated in maven can refer to files in the local maven repo and the ImplicitFileSetRepository can also reference them. These repositories are constructed in different ways and they were not consistent. And we ended up with capabilities from each repository which should have been equals (and same hashCode) but were not. Bnd Versions cannot be compared with OSGi Versions. bnd.hashes attributes were not consistently present. Integers cannot be compared with Longs.

So this PR fixes these issues to avoid presenting equivalent capabilities to the resolver which horrible confused it.

Fixes #4382

The referenced folders could need quoting.

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
They are written as List<Long> to resource indexes and read back in that
way. By being consistent in using Long, we get consistent results for
equals and hashCode on capabilities.

This is important to the resolve context to avoid duplicate resources
being shown to the resolver.

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
We use addFile to add hashes to the package capability. This is
consistent with indexing and other repository types and ensures
we get consistent behavior of equals and hashCode on capabilities for
comparison in the resolve context to avoid presenting duplicate
capabilities to the resolver.

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
The XMLResourceParser used Bnd Version and the ResourceBuilder used
OSGi Version. So we can fail to compare some version values. So we
are now consistent which enables proper capability behavior of equals
and hashCode to enable the resolve context to not expose the resolver
to duplicate capabilities.

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
Based upon the previous commits to fix equals and hashCode behavior of
capabilities, we now avoid duplicate capabilities in the values
supplied to the resolver.

Fixes #4382

Signed-off-by: BJ Hargrave <bj@bjhargrave.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant