Bundles and Oranges: Dare to Compare
>> Friday, May 28, 2010
Equinox p2 provides several tools to manage repositories.
Image by Oliver Delgado
The mirroring task is used extensively in the Eclipse and RT Equinox build. Mirroring a p2 repository allows you to copy the metadata and artifacts to a new location. You can mirror your entire repository or a subset of IUs to a new location. We call mirroring a subset of IUs slicing.
Image by Safari11
The granularity of your slicing operation is dependent on the IUs you specify.
Image by shin0
We run the mirroring task with a comparator. This allows us to compare the bundles that have just been built with the bundles that already exist from other builds in the composite repository. We want to guarantee that the bundles with the same unique identifier and version have the same binary content. Do you know which of or your bundles is not like the other?
Image by Stephanie Berghaeuser
A different compiler with the same source could produce different byte code. Using a new builder can change the content of your bundles, for instance if you enable source references.
We use a comparator with a baseline to compare the bundles with the same name and id available in our repositories with the ones that were just created in the current build. Newer bundles with the same id and version are discarded. This process guarantees that if a user installs a build from a repository or a zip, they will have the same bundles in their install. Otherwise, you risk inconsistent bundles for your users. Not good.
We call the p2.mirror task like this:
We are mirroring from the source (unzipped repository of our build time feature containing all features and plugins in the build) to the child repository location. The IgnoreErrors flag is set to true so the mirroring operation doesn't fail if there are differences. The org.eclipse.equinox.p2.repository.tools.jar.comparator is used to compare the bundles between the two locations and output the differences to a log. The repository location or baseline is the existing composite repository with content from older builds. The comparatorLog is parsed by a JUnit test which generates a failure if the log indicates differences. You can also exclude certain bundles from being compared, as you can see in the exclude stanza.
Other information on p2 repository tools and the comparator
Bug 302283 - add ability to exclude bundles when running comparator with mirror task
Bug 312962 - Exclude doc bundles from comparator
Implementing composite repositories in your build
Slicing and dicing the p2 way
Andrew's comparator slides from EclipseCon 2009
Hey Kim, what's with all the oranges? I'm very fortunate that I have the opportunity to run my first marathon with my friends on a beautiful course in Ottawa and Gatineau this Sunday. It will be a challenge. After the race, there will be sweet orange slices in the recovery area for the 39,000 people running in Ottawa this weekend.
0 comments:
Post a Comment