Many times I've been asked why p2 got created when there were other solutions around, namely OBR. To understand why p2 got created, it takes a little bit of understanding on the requirements that drove the work on p2, but also some history.
So let's start with the requirements.
The work on p2 started in 2006 / 2007 at at time where companies contributing to Eclipse were wondering how to increase their ROI. For this, they were all sure that having an easy path from the free Eclipse distress to their cool add-ons or full suite of products would be the solution. The term coined for that was "on-ramp". Nowadays what best embodies this is the Eclipse Marketplace and its client.
It is in this context that IBM spearheaded an internal effort to replace the aging update manager. The requirements were to provide a "provisioning platform" that would allow to install the complete Eclipse SDK from scratch (not only bundles and features like the old solution was), and also deal with more native things like dlls, .net assemblies, rpms, etc. and provide desktop integrations. In addition to that, the solution was expected to:
- allow both fine grained provisioning (just want to install a bundle) or large grained provisioning (install a complete product) -- this is why we used the term "right-grained provisioning" to describe a solution that would let its user decide the right granularity for himself.
- provide a "transactional" update, meaning that a failed or cancelled install could not leave the system in an unknown state
- allow to install and uninstall without having the provisioned system be up and running
- separate the metadata from the payload
- support mirroring
With those requirements, I spent a fair amount of time looking at what was being provided in the Java and OSGi ecosystems, as well as what could be offered from the linux package managers and other esoteric technologies. This was a phase of research were I was harvesting as many ideas as possible, comparing them with each others, matching them with my requirements. It is really this phase that defined much of what p2 has become. Without being exhaustive, here are some of the things that I looked at: SDD (http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sdd) from oasis, OBR from OSGi, Deployment Admin from OSGi, JSR 124 (http://jcp.org/en/jsr/detail?id=124), another similar JSR for embedded device (can't remember the number), Maven, debian, conary (http://wiki.rpath.com/wiki/Conary), RPM, numerous Java installers, etc. From their I went down the path of research papers for dependency resolvers, looked at constraints programming, and was lucky to come across the paper from Tucker that studied the usage of a SAT solver to resolve install problems (unfortunately his work never made it to production).
So why not OBR?
OBR was not up to the task. OBR was a repository format, a resolver, and a downloader but each of these element was far away from being sufficient to build what we needed on top.
- OBR focus was bundle centric. No "group" (aka features), no native files, …
- The repository format was fixed and was XML only, no possibility of extension.
- Each bundle listed in the repository was referring to the payload (the actual jar for the bundle) using a fix URL rather than abstracting the artifact location in a coordinate -- like Maven does with its concept of GAV or like p2 does with "artifact keys" -- which makes mirroring just plain painful (I know it is possible to provide URL handlers, but come on…).
- The provided API was not allowing for transactional state change (some bundles could be installed, but not all the required ones if the download failed)
- The metadata did not accommodate the expression of what needed to happen to the bundle (e.g. should it be started, set the start level, etc.) and thus even less to other things.
- The resolver always insisted on installing all the fragments available (which in complex repos like Indigo means that installing JDT will bring in parts of WindowBuilder since it has some fragment to JDT UI iirc)
As you've seen, a fair amount due diligence to OBR and plenty of technologies had been done. Rather than being a thing that just came to be by itself, p2 claims lineage from pretty much all these technologies, and the whys could be repeated and inverted at will :).
PS: Short lineage: InstallableUnit and Touchpoint terminology comes from SDD, parts of the transactional aspect of the p2 engine is inspired from OSGi deployment admin, the list of phase is from debian, the metadata content is inspired from OBR and OSGi Manifest, Maven for the idea of coordinate system...
Update: Changing the title to reflect the intent of the post