Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Equinox p2 director application/Examples/Install into eclipse using SDKProfile

Ant script

Here's how the p2.director can be used to install from an Update zip into the Eclipse install used to run headless JUnit tests.

<target name="install">
  <property name="p2dirTmp" value="${buildDir}/testing/p2dirTmp" />
  <mkdir dir="${p2dirTmp}/eclipse"/>
  <unzip src="${buildDirectory}/${buildLabel}/${MasterZip}" dest="${p2dirTmp}" overwrite="true" />
  <unzip src="${buildDirectory}/${buildLabel}/${updateZip}" dest="${p2dirTmp}/eclipse" overwrite="false"/>
  <echo>Install ${mainFeatureToBuildID} feature to ${install}</echo>
  <ant target="run.director" antfile="${helper}">
    <property name="p2.director.installIU" value="${mainFeatureToBuildID}.feature.group" />
    <property name="p2.director.install.path" value="${install}/eclipse" />
    <property name="p2.director.destination" value="${install}/eclipse" />
    <property name="p2.director.input.repo" value="${p2dirTmp}/eclipse" />
  </ant>
</target>
<target name="run.director">
  <property name="p2.director.extraArgs" value="" />
  <property name="p2.director.installIU" value="${mainFeatureToBuildID}.feature.group" />
  <property name="p2.director.install.path" value="${install}/eclipse" />
  <property name="p2.director.destination" value="${install}/eclipse" />
  <property name="p2.director.input.repo" value="${p2dirTmp}/eclipse" />
  <echo>
p2.director.destination  = ${p2.director.destination}
p2.director.input.repo   = ${p2.director.input.repo}
p2.director.install.path = ${p2.director.install.path}
</echo>
  <mkdir dir="${p2.director.install.path}" />
  <chmod perm="ugo+rwx" file="${p2.director.destination}/eclipse" />
  <exec executable="${p2.director.destination}/eclipse" failonerror="true" dir="${p2.director.destination}" timeout="900000" taskname="p2.dir">
    <arg line=" -vm ${JAVA_HOME}/bin/java" />
    <arg line=" -application org.eclipse.equinox.p2.director.app.application" />
    <arg line=" -nosplash" />
    <arg line=" --launcher.suppressErrors" />
    <arg line=" -consoleLog" />
    <arg line=" -flavor tooling" />
    <arg line=" -roaming" />
    <arg line=" -profile SDKProfile" />
    <arg line=" -destination ${p2.director.install.path}" />
    <arg line=" -bundlepool ${p2.director.destination}" />
    <arg line=" -installIU ${p2.director.installIU}" />
    <arg line=" -metadataRepository file:${p2.director.input.repo},file:${p2.director.destination}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile"/>
    <arg line=" -artifactRepository file:${p2.director.input.repo},file:${p2.director.destination}" />
    <arg line=" -profileProperties org.eclipse.update.install.features=true" />
    <arg line=" -vmargs" />
    <arg line=" -Declipse.p2.data.area=${p2.director.destination}/p2" />
    <arg line=" -Declipse.p2.MD5Check=false" />
  </exec>
</target>

Bash script

To install the GMF SDK and all its prereqs from the Ganymede Update site into the default eclipse/ folder (using the built-in SDKProfile), run this. This matches the p2 Update UI's default behaviour.

#!/bin/bash
workspace=/tmp/workspace-clean-34
eclipseroot=~/eclipse/34clean/p2director
installTargetFeatureGroup=org.eclipse.gmf.sdk.feature.group
bundlepoolDir=$eclipseroot/${installTargetFeatureGroup}/eclipse

pushd $eclipseroot >/dev/null
if [[ $# -eq 0 ]]; then
	rm -fr eclipse $workspace $bundlepoolDir
	eclipse=eclipse-SDK-3.4-linux-gtk.tar.gz
	echo "[`date +%H:%M:%S`] Unpack $eclipse ...";
	tar xzf $eclipse
fi

vm=/opt/sun-java2-5.0/bin/java
#vm=/opt/ibm-java2-5.0/bin/java

echo ""
echo "Using:       vm=$vm and workspace=$workspace";
echo "Installing:  ${installTargetFeatureGroup}";
echo "Destination: $bundlepoolDir";
echo ""

echo "[`date +%H:%M:%S`] Running p2.director ... ";
#  -console -noexit -debug 
./eclipse/eclipse -vm $vm -nosplash \
  -data $workspace -consolelog -clean \
  -application org.eclipse.equinox.p2.director.app.application \
  -metadataRepository http://download.eclipse.org/releases/ganymede \
  -artifactRepository http://download.eclipse.org/releases/ganymede \
  -installIU ${installTargetFeatureGroup} \
  -destination $eclipseroot \
  -bundlepool $bundlepoolDir \
  -profile SDKProfile
  -profileProperties org.eclipse.update.install.features=true \
  -p2.os linux -p2.ws gtk -p2.arch x86 \
  -vmargs \
    -Declipse.p2.data.area=$eclipseroot/eclipse/p2 \
    -Xms128M -Xmx256M -XX:PermSize=128M -XX:MaxPermSize=256M 
echo "Installed sizes: "; du -shc $eclipseroot/eclipse $bundlepoolDir

echo "";
echo -n "[`date +%H:%M:%S`] Starting Eclipse workbench (to verify installation) ...";
#  -console -noexit -debug 
./eclipse/eclipse -vm $vm \
  -data $workspace -consolelog -clean \
  -vmargs \
    -Xms128M -Xmx256M -XX:PermSize=128M -XX:MaxPermSize=256M 

popd >/dev/null
echo " done."

See Also

Back to the top