Vladimir Prus


vladimirprus.com

Thursday, March 20, 2014

Eclipse P2 Product Installer

Last year, the Sourcery CodeBench team have implemented a new installer, using Eclipse P2. This week, at EclipseCon 2014, two of key developers gave a talk about it, and announced that all of the source code is available under Eclipse Public License, at https://github.com/MentorEmbedded/p2-installer.

Before, we used certain commercial installer technology, and it was not much fun. There were annoying bugs (like randomly creating corrupted installers), and there were fundamental issues. It did not know anything about Eclipse components, so it could only install everything. And it used an XML-based description, which worked nice for simple projects, but became a nightmare to create or generate. We decided it's best to start from square one.

The P2-based installer has everything you would expect. There are pages to select components, to review licenses, and to select installation path. It can create shortcuts, change environment variables and supports uninstall. All components to install are provided in a P2 repository, and you can use bundled P2 repositories as well as remote. So, for example, you can include core functionality in the installer users download, and provide optional components via HTTP, and the installer supports selecting of optional components. It is also extensible using Java, both via P2 touchpoints and using installer modules that contribute custom pages. There's also an utility to pack everything together in an executable file you can download and run.



We hope it will be useful for anybody building products based on Eclipse platform. Kudos go to Mark Bozeman, Mike Wrighton and Richard Memory who worked hard on this. I am also thankful to management of Mentor Graphics' Embedded Software Division, who supported releasing this project into open source. Enjoy!




7 comments:

Anonymous said...

I really like the look of this installer (both the concept and the default visual appearance while running).

Unfortunately I haven't been able to get it to install my application. Since I don't have a working example, I'm not really sure what things are supposed to look like.

I've created by own p2 repository and copied it to feature.com.codesourcery.installer/repos. I also updated the installer.properties file.

I'm able to launch the installer with "Installer - GUI", and my feature does show up in the "Required Components" list.

The error is "p2-installer/features/com.codesourcery.installer/setup does not exist"

Do I need to do something to build this executable? I've looked through the various folders but haven't found anything that builds something called setup. I did find and build the instmon binary, but it doesn't seem to have made a difference.

I'm sorry to bug you with this support-type question in an announcement
blog post, I'm just wondering if this points to something obvious to you that would get me over this hump.

Anonymous said...

I think the error you are seeing in the log is just the uninstaller not copying. There is an eclipse.p2.uninstallFiles property in the installer.properties that tells what files to copy to the /uninstall directory for the uninstaller. The default set of files (setup, etc.) are only available in an exported installer. They wont be available when running directly from the workbench (and that property can be commented out). If you look at the section, Exporting the P2 Installer, in the documentation, it has information on how to export the installer (it's basically the same steps for exporting any RCP application). This will allow the installer to be run outside the workbench and the setup and other files will then be available.

Anonymous said...

I found that the installer did work as expected, even with the error message. I'm trying to export the installer (so I can see if that message goes away), but keep getting errors.

The error messages says that the jface plugin cannot be found (to export). The version of the jface plugin is the same as what is used in my target platform, and my own product pulls this plugin when in it's own export (same workspace). Any idea what could be happening there (I'm using the Export wizard exactly as described in the .pdf).

Also, I'm confused about where the setup binary is supposed to come from. I haven't found it anywhere in the p2-installer working directory. Is it supposed to be generated as part of the .product export?

Finally, what is the instmon binary (instmon-linux-x86 on my system) used for? Does this somehow turn into the setup binary?

Anonymous said...

Switching to Luna-M6 fixed this problem. Earlier I was running in a 3.8.2 workbench and export failed everytime. It works GREAT on Luna M6. I haven't looked into why, but I'm guessing the installer.product file has some value that doesn't work in 3.8.

Thanks again for making this installer available.

Anonymous said...

This is great work. I'm excited to start using the installer and tailoring it towards our needs and contributing any fixes/improvements back upstream.

Is the source code available for the previous incarnation of the installer with the install steps listed vertically on the left hand side of the window as opposed to listed horizontally across the top?

Vladimir Prus said...

The location of navigator is controlled by the org.eclipse.p2.wizardNavigation property. If you use "left" you'll get navigation on the left, as it was initially.

Anonymous said...

Works great. Thanks for the tip!