Do's and Do not's about p2
-
Upload
pascal-rapicault -
Category
Technology
-
view
3.099 -
download
3
description
Transcript of Do's and Do not's about p2
![Page 1: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/1.jpg)
p2, your savior
or your Achilles
heel?
Everything an
Eclipse team
needs to know
about p2!
R. Ian Bull
Pascal Rapicault
![Page 2: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/2.jpg)
Alternate Titles
10 reasons we closed your p2 bugs as INVALID?
10 ways to get booted from the p2 mailing list!
10 excuses why we didn’t buy you a beer
p2, 10 common pitfalls and how to avoid them.
4/11/20112
![Page 3: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/3.jpg)
#1Move / remove files on disk
Leading cause of p2 failures:
developers tampering with plugins/ folder
If you no longer need a plugin DO NOT
REMOVE IT BY HAND
Do not move, unzip or change a plug-in in
your plugins/ directory
4/11/20113
![Page 4: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/4.jpg)
Instead:
Let p2 manage your installOther plug-ins may depend on it
If a plug-in is no longer needed, p2 will
remove it
Run the Garbage Collector manually if you
want
# ./eclipse –application \
org.eclipse.equinox.p2.garbagecollector.application
4/11/20114
![Page 5: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/5.jpg)
#2 Unzip your plug-ins over Eclipse
Do you provide a zip file for your plugins?
Do you instruct your users to unzip over
eclipse
We don’t like you! (And we will sabotage your wiki page )
4/11/20115
![Page 6: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/6.jpg)
Instead:
Provide a repository Repositories can be zipped and
downloaded!
Users can simply point to the compressed
repository to properly install your plug-in
Avoid the use of drop-ins too
4/11/20116
![Page 7: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/7.jpg)
#3Replace published content
Never publish different content with the
same version number!
Do not make a change and use the same
version number
Do not build plug-ins as Foo v1.0.0.HEAD
You’ll never know what your user runs.
4/11/20117
![Page 8: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/8.jpg)
Remember:
Version / ID pairs are immutable
If the Version / ID has not changed, the content hasn’t changed!
Always publish new metadata and artifacts for each code change
Use .qualifiers for all bundles / plug-ins and features
If you can’t rebuild everything, provide patches to deliver surgical updates
4/11/20118
![Page 9: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/9.jpg)
Reuse:
Tips and Tricks Context repositories
Qualifier replacement / bundle reuse forceContextQualifier: Replaces the qualifier of all
your bundles (use build timestamp)
Feature patches:http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/project_wizards/new_feature_patch.htm(or google: eclipse p2 feature patch)
4/11/20119
build.properties:repoBaseLocation=${buildDirectory}/inputRepositories
transformedRepoLocation=${buildDirectory}/transformedRepo
![Page 10: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/10.jpg)
#4 Alter a released repository
“Release” repositories are serious stuffs!
People will refer to them from their repo to
avoid duplicating your content
People will refer to them from their build
Removing content from a “release” repo
is a felony!
4/11/201110
![Page 11: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/11.jpg)
Instead:
Be mindful of your users / repos Preserve content at the same URL
If you put out bad bytes, publish a new version. Don’t remove the old one !
Append new version to existing repo.
Disk is cheap, users not patient (and they’ll blame p2).
For this, use p2 composite repositories.
Define clear retention policies
For example, the policies for the SDKhttp://wiki.eclipse.org/Eclipse_Project_Update_Sites
4/11/201111
![Page 12: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/12.jpg)
#5Don’t categorize things
p2 only shows what’s been categorized
Repository designers are responsible for
designing their categories
Classic consumer / producer problem
4/11/201112
![Page 13: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/13.jpg)
Remember:
Category tricks Use categories !
The category publisher is here to help
Use composite repositories where one of
the repo carry the categories
Use meaningful name, and use the
description. The feature name is shorter
than a tweet.
4/11/201113
![Page 14: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/14.jpg)
#6Ignore your version ranges
Specify a strict dependency on 3.6.1 and
wonder why your users can’t install on
3.6.2?
Most illegible p2 error messages are a result
of poorly set version ranges
4/11/201114
![Page 15: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/15.jpg)
Instead:
Consider your version ranges
Version your packages, bundles and
features
Use version ranges for dependencies:
Up-to by not including [3.6.0, 3.7.0)
Unbounded lower [0.0.0, 3.7.0)
Unbounded higher 2.0
Strict Versions [3.6.1, 3.6.1]
You need to know what the producer does.
4/11/201115
![Page 16: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/16.jpg)
#7Don’t USE API If you find yourself reaching into
internals, ask yourself why?
If you manually write to the bundles.infofile, ask yourself why?
If you edit content.xml / artifacts.xml by hand, ask yourself why?
Two problems when you don’t use API:
We could break you
You could break you
4/11/201116
![Page 17: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/17.jpg)
Instead:
Be mindful of what you use Look for provisional API (if real API doesn’t
exist)
Ask on the p2-mailing list
4/11/201117
![Page 18: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/18.jpg)
#8Use the Metadata generator
If you are using the Metadata generator… sorry
(org.eclipse.equinox.p2.metadata.generator)
Deprecated two years ago
Removed for Indigo
4/11/201118
![Page 19: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/19.jpg)
Instead:
Use the Publisher Publisher Applications & Ant Tasks
Publish from an Update Site
Publish from Features / Bundles
Publish from a Product
Publish categories
# ./eclipse -application
org.eclipse.equinox.p2.publisher.UpdateSitePublisher
-metadataRepository file:///repo
-artifactRepository file:///repo
-source http://foo/site.xml-compress
-publishArtifacts
4/11/201119
![Page 20: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/20.jpg)
#9Use legacy update sites
Legacy update sites don’t include
complete metadata
Features are downloaded before any
dependency resolution can occur
Big lag at install time.
We will blame you for all p2’s performance problems
4/11/201120
![Page 21: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/21.jpg)
Instead:
Use a real build tool PDE Build, Tycho and derivatives
(Athena, Buckminster, etc.) all provide
facilities to build p2 repositories.
If you can’t change your build
technology, at lease use the Update Site
Publisher.
4/11/201121
![Page 22: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/22.jpg)
#10Spell it P2
I don’t call your project Mylin, έMF, or BERT
4/11/201122
![Page 23: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/23.jpg)
Remember:
The project is:
4/11/201123
![Page 24: Do's and Do not's about p2](https://reader033.fdocuments.us/reader033/viewer/2022052908/55946ccc1a28ab972b8b47dc/html5/thumbnails/24.jpg)
Useful links http://wiki.eclipse.org/Equinox_p2
http://wiki.eclipse.org/Equinox/p2/Getting_Started
http://wiki.eclipse.org/Equinox/p2/Publisher
http://aniefer.blogspot.com/2008/06/example-
headless-build-for-rcp-product.html
4/11/201124