Define update sites in config.ini file
Asked Answered
H

2

7

I'm creating a product based on Eclipse 3.6.2 for our project. The idea is to create an Eclipse installation that has all the plugins we require and all configuration are setup as we need them for the project.

As part of that, I want to make sure our update sites are included, but how can I do that?

If I choose to export preferences update sites are not included. I can export update sites from the preference page and get an XML file with them, but how can I include it in my config.ini file? Or is there some other way?

Goal is, when the user runs the custom Eclipse product our update sites will be in the list of sites. Ideally, the only ones in the list.

Hurds answered 4/10, 2012 at 14:10 Comment(0)
B
7

You can add a p2.inf file that instructs particular update sites when things are installed:

instructions.configure=\
addRepository(type:0,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);\  addRepository(type:1,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);

This would add www.eclipse.org/equinox/p2/testing/updateSite.

This file (p2.inf) needs to go in the same directory as your MANIFEST.MF file. You can read more about this here.

Brothers answered 4/10, 2012 at 16:18 Comment(3)
Thanks, but its not working. When will the p2.inf be run? I've added it to my feature that the product consists of. I then use Eclipse export product wizard to create a product and a repo. Running the product or installing from the repo doesn't give me an Eclipse with the update sites added. Has the phase in the p2 file got anything to do with this? I'm using 'configure' at the moment.Hurds
The instructions for it should be created during the build and stored in the content.xml. When you install from the repo, it should be added. This example adds the defaults to the eclipse SDK: git.eclipse.org/c/platform/…Fado
Weird, it's working now even though I dont think I've done anything different. Guess I'll blame in on computer gremling. Thanks @PaulWebster and IanHurds
H
1

Since there is a likely chance I'll have to do this again, and no chance I remember how to do it the next time, I'll write down the steps I went through:

I created a p2.inf file with instructions;

instructions.configure=\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:0,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:1,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:0,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:1,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);`

According to the Eclipse wiki the inf-file could be placed in the same dir as my feature.xml, so that's what I did.

I had a product that consisted of this feature, so I exported the product using Eclipse product export wizard. I made sure to build a repository.

After the build was done, the repository had a content.jar. Inside the content.jar there was a content.xml. Examining it, I could find:

<touchpointData size='1'>
   <instructions size='1'>
     <instruction key='configure'>
       org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(<all my update sites>);
     </instruction>
   </instructions>
 </touchpointData>

So this verified that the export did actually see my p2.inf file and do something with it.

To install from the repository I used an Eclipse Director script:

cmd /c "C:\Program\Eclipse\director\director -consoleLog -bundlepool c:/program/eclipse/eclipse3.6_custom -profileProperties "org.eclipse.update.install.features=true" -i MyProduct.Product -r "file:/C:\eclipse\exported\repository" -d c:/program/eclipse/eclipse3.6_custom -p helios"`

The script installed the product from the repository to the destination.

Hurds answered 11/10, 2012 at 13:16 Comment(2)
Thanks past-Fredrik, that was great information to have written down, high-five! :)Hurds
It's kind of unfair though, that future-Fredrik can't upvote past-Fredrik (because he's lost and gone in the flow of time).Teaspoon

© 2022 - 2024 — McMap. All rights reserved.