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

Difference between revisions of "Equinox/p2/Engine/Touchpoint Instructions"

< Equinox‎ | p2‎ | Engine
m (Introduction)
 
(54 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=Introduction=
+
The information from this page is now in the formal platform documentation:
A p2 Installable Unit (IU) is installed using the facilities provided by a ''touchpoint''. The IU metadata consists of a reference to the touchpoint (Touchpoint Type) which also defines the version of the touchpoint (i.e an expectancy that it supports a certain set of operations),  and describes instructions to execute in various p2 engine phases. The instructions are named after the phases - the phases "install", "uninstall", "configure", "unconfigure" are of interest when authoring, but there are also some internal phases  such as "collect" and "checktrust" executed by the engine. Each instruction (e.g. "install") describes a sequence of actions to execute on the referenced touchpoint. Examples of actions are create and remove directories, change permissons, install and remove bundles. Currently, two touchpoints (native, and eclipse) have been implemented. The native touchpoint has approximately 5 different actions, and the eclipse touchpoint has approximately 20. Most of these actions take parameters. This wiki page describes these actions in detail.
+
  
The instructions are grouped and described in a Touchpoint Data Element. The touchpoint data element uses a Map where the key is the name of a p2 engine phase (such as "install"), and the
+
http://help.eclipse.org/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_actions_touchpoints.html
value is a string representation of a sequence of actions. Using multiple touchpoint data elements is useful as it allows separation between sets of actions for install/uninstall/configure/unconfigure which makes it easier to maintain the meta data.  
+
  
This wiki page describes the two touchpoints, the instructions they understand, and the format used to represent an action sequence.
+
This page has been deleted to avoid duplication.
 
+
=Actions=
+
 
+
==Native Touchpoint Actions==
+
The native touchpoint is used to install things "outside of eclipse".
+
 
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''instruction'''
+
| '''parameters'''
+
| '''description'''
+
|- valign="top"
+
| style="font-weight:bold;font-family:monospace"|cleanupzip
+
| <code>source, target</code>
+
| removes unzipped files and directories that where unzipped from ''source'' into ''target'' - i.e. an "undo operation" of an ''unzip'' instruction.
+
|- valign="top"
+
{{Command|unzip}}
+
{{Parameters|source, target}}
+
| unzips the ''source'' into the ''target'' directory. The ''source'' can be the special <code>@artifact</code> source path, which denotes the download cache location for the first artifact key in the IU. ''Comments in code indicates that the use of <code>@artifact</code> may be deprecated.''
+
|- valign="top"
+
{{Command|chmod}}
+
{{Parameters|targetDir, targetFile, permissions}}
+
| changes mode on the ''targetFile'' in the ''targetDir'' (a path), ''permissions'' is written the same way as to the system command ''chmod'',
+
|- valign="top"
+
{{Command|collect|style=color:#626262}}
+
{{Parameters|-}}
+
|collects all associated artifacts for an IU and places them in a local touchpoint addressable cache. This action is not meant to be called directly and is used as part of the main Collect and Sizing phases.
+
|- valign="top"
+
{{Command|link}}
+
{{Parameters|targetDir, linkTarget, linkName, force}}
+
| Performs the system action <code>ln -s</code> with the parameters ''linkTarget'' being the source-file, ''targetDir'' is the directory where the symbolic link will be created, and ''linkName'' is the name of the resulting link in the ''targetDir''. The ''force'' parameter is a boolean in string form (i.e. "true"/"false") and indicates if an existing link with the same name should be removed before the new link is created. {{CommentBox|the parameter names are quite confusing}}
+
|}
+
 
+
==Eclipse Touchpoint Actions==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''instruction'''
+
| '''parameters'''
+
| '''description'''
+
|- valign="top"
+
{{Command|collect|style=color:#626262}}
+
{{Parameters|-}}
+
|collects all associated artifacts for an IU and places them in a local touchpoint addressable cache. This action is not meant to be called directly and is used as part of the main Collect and Sizing phases.
+
|-valign="top"
+
{{Command|installBundle}}
+
{{Parameters|bundle}}
+
| Installs a bundle artifact specified by the parameter ''bundle''
+
|-valign="top"
+
{{Command|uninstallBundle}}
+
{{Parameters|bundle}}
+
| Uninstalls a bundle artifact with a bundle-id specified by the paramter ''bundle''
+
|-valign="top"
+
{{Command|addSourceBundle}}
+
{{Parameters|bundle}}
+
| Installs a source bundle artifact with the bundle-id specified by the parameter ''bundle''
+
|-valign="top"
+
{{Command|removeSourceBundle}}
+
{{Parameters|bundle}}
+
| Removes/uninstalls the source bundle artifact with the bundle-id specified by the parameter ''bundle''
+
|-valign="top"
+
{{Command|installFeature}}
+
{{Parameters|feature, featureId, version}}
+
| Installs the feature referenced by the parameter ''feature'' (matched against artifacts in the iu). The feature is installed with the id specified by the parameter ''featureId'', or if this parameter has the value <code>default</code>, with the id specified in the artifact referenced by ''feature''. The features is installed with the version specified in ''version'', or with the version specified in the artifact referenced by the ''feature'' parameter if the ''version'' parameter has the value <code>default</code>
+
|-valign="top"
+
{{Command|uninstallFeature}}
+
{{Parameters|feature, featureId, version}}
+
| Uninstalls a feature. Parameters have the same meaning as for the command <code>installFeature</code>
+
|-valign="top"
+
{{Command|setLauncherName}}
+
{{Parameters|name}}
+
| Sets the name of the launcher to <code>name</code>. The launcher name is used to configure launcher name specific ini files.
+
|-valign="top"
+
{{Command|addProgramArgument}}
+
{{Parameters|programArg}}
+
| Adds the string specified in the parameter ''programArg'' as an argument to the program. If the parameters is the special value <code>@artifact</code>, the location of the artifact referenced by the first artifact key in the IU is used as the parameter value.
+
|-valign="top"
+
{{Command|removeProgramArgument}}
+
{{Parameters|programArg}}
+
| Removes the program argument specified in the string ''programArg'' - if the parameters is the special value <code>@artifact</code>, the location of the artifact referenced by the first artifact key in the IU is used as the parameter value.
+
|-valign="top"
+
{{Command|setStartLevel}}
+
{{Parameters|startLevel}}
+
| Sets the start level to the integer value specified in the parameter ''startValue''
+
|-valign="top"
+
{{Command|markStarted}}
+
{{Parameters|started}}
+
| Marks the bundle referenced by the first artifact key in the IU as started / not started, as controlled by the boolean parameter ''started'' (in string form i.e. "true"/"false").
+
|-valign="top"
+
{{Command|setFrameworkDependentProperty}}
+
{{Parameters|propName, propValue}}
+
| Sets the framework dependant property named ''propName'' to the value specified in ''propValue''. Framework dependent properties are properties specific to the Equinox implementation of the OSGi framework.
+
|-valign="top"
+
{{Command|setFrameworkIndependentProperty}}
+
{{Parameters|propName, propValue}}
+
| Sets the framework independant property named ''propName'' to the value specified in ''propValue''. Framework independent properties do not specifically target Eclipse and are generally applicable to other OSGi frameworks.
+
|-valign="top"
+
{{Command|setProgramProperty}}
+
{{Parameters|propName, propValue}}
+
| Sets the program property named ''propName'' to the value specified in ''propValue''. Program properties are used by the executable program to among other things locate the jars needed to start Eclipse.
+
|-valign="top"
+
{{Command|addJVMArg}}
+
{{Parameters|jvmArg}}
+
| Adds the string specified in the parameter ''jvmArg'' to the arguments passed to the JVM.
+
|-valign="top"
+
{{Command|removeJVMArg}}
+
{{Parameters|jvmArg}}
+
| Removes the string specified in the parameter ''jvmArg'' from the arguments passed to the JVM.
+
|-valign="top"
+
{{Command|mkdir}}
+
{{Parameters|path}}
+
| Creates the directory specified by the parameter ''path''.
+
|-valign="top"
+
{{Command|rmdir}}
+
{{Parameters|path}}
+
| Removes the directory specified by the parameter ''path''.
+
|-valign="top"
+
{{Command|link}}
+
{{Parameters|targetDir, linkTarget, linkName, force}}
+
| Performs the system action <code>ln -s</code> with the parameters ''linkTarget'' being the source-file, ''targetDir'' is the directory where the symbolic link will be created, and ''linkName'' is the name of the resulting link in the ''targetDir''. The ''force'' parameter is a boolean in string form (i.e. "true"/"false") and indicates if an existing link with the same name should be removed before the new link is created. If the parameter ''targetDir'' is set to the special value <code>@artifact</code>, the source is the file specified by the first artifact key in the IU. {{CommentBox|the parameter names are quite confusing}}
+
|-valign="top"
+
{{Command|chmod}}
+
{{Parameters|targetDir, targetFile, permissions}}
+
| Changes permission on a file using the system chmod command. The ''targetDir'' parameter is either a path, or the special <code>@artifact</code> which is a reference to the directory where the first artifact included in the installable unit is located. The parameter ''targetFile'' is the name of a file, and ''permissions'' is written like for the ''chmod'' system command.
+
|-valign="top"
+
{{Command|checkTrust|style=color:#626262}}
+
{{Parameters|-}}
+
|collects the set of bundle files on which the signature trust check should be performed. The checkTrust action is not meant to be user callable and is done as part of the CheckTrust phase.
+
|}
+
 
+
=Action Format=
+
The Touchpoint Data Element has a Map that describes the actions to execute in the various p2 engine phases (e.g. "install", "uninstall", "configure", "unconfigure", "collect" and "checktrust"). The key of the Map entry is the name of a phase (i.e. when the actions should be executed), and the value is a ''statement-sequence'':
+
  statement-sequence :
+
      | statement ';'
+
      | statement-sequence statement
+
      ;
+
 
+
Where a statement is on the  format:
+
  statement :
+
      | actionName '(' parameters ')'
+
      ;
+
 
+
  parameters :
+
      | // empty
+
      | parameter
+
      | parameters ',' parameter
+
      ;
+
 
+
    parameter :
+
      | paramName ':' paramValue
+
      ;
+
+
  actionName, paramName, paramValue :
+
      | String
+
      ;
+
 
+
In the p2 engine, the Phase will lookup the "actionName" using it's own phase specific actions (e.g. "collect") and also those made available by the associated touchpoint (e.g. "mkdir" in the native touchpoint, and "installBundle" in the Eclipse touchpoint) .
+
 
+
As an example - an "install" instruction for a bundle might consist of the following statement:
+
 
+
  installBundle(bundle:${artifact});
+
 
+
* ''installBundle'' is the action name
+
* ''bundle'' is the parameter name
+
* ''${artifact}'' is the parameter value. The value ${artifact} signifies the use of a pre-defined variable named "artifact".
+
 
+
=Built-in Action Variables=
+
What follows is a catalog of the variables made available by the phases and touchpoints. Many of these are mostly useful to the implementor of new actions and touchpoint types.
+
 
+
==Variables Available in all phases==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|#nnnn}}
+
|the unicode value of a character.
+
''[[Note:]] This is especially important for the six characters that require escaping.''
+
# $ = ${#36}
+
# , = ${#44}
+
# : = ${#58}
+
# ; = ${#59}
+
# { = ${#123}
+
# } = ${#125}
+
|- valign="top"
+
{{Command|profile }}
+
|the profile being modified.
+
|- valign="top"
+
{{Command|phaseId }}
+
|the name of the phase e.g. collect, install, etc.
+
|- valign="top"
+
{{Command|operand }}
+
|the actions operand (e.g. IU pair)
+
|- valign="top"
+
{{Command|touchpoint }}
+
|the touchpoint associated with the IUs in the operand
+
|}
+
 
+
==Collect Phase Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|artifactRequests }}
+
|A list that a touchpoints "collect" action will use to add mirroring requests to.
+
|}
+
 
+
==Unconfigure Phase Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|iu }}
+
|The IU being unconfigured. This is set from the first IU of the operand pair.
+
|- valign="top"
+
{{Command|artifact}}
+
|The artifact id of the first artifact listed in the IU.
+
|}
+
 
+
==Uninstall Phase Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|iu }}
+
|The IU being uninstalled. This is set from the first IU of the operand pair.
+
|- valign="top"
+
{{Command|artifact}}
+
|The artifact id of the first artifact listed in the IU.
+
|}
+
 
+
==Install Phase Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|iu }}
+
|The IU being installed. This is set from the second IU of the operand pair.
+
|- valign="top"
+
{{Command|artifact}}
+
|The artifact id of the first artifact listed in the IU.
+
|}
+
 
+
==Configure Phase Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|iu }}
+
|The IU being configured. This is set from the second IU of the operand pair.
+
|- valign="top"
+
{{Command|artifact}}
+
|The artifact id of the first artifact listed in the IU.
+
|}
+
 
+
==Eclipse Touchpoint Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|manipulator }}
+
|an instance of the Manipulator class used to alter the configuration of an Eclipse install.
+
|- valign="top"
+
{{Command|installFolder }}
+
|the root folder for this profile.
+
|}
+
 
+
==Native Touchpoint Variables==
+
{| {{Greytable}}
+
|-valign="top" style="background-color:#eeeeee;color:#444444;"
+
| '''variable'''
+
| '''description'''
+
|- valign="top"
+
{{Command|installFolder }}
+
|the root folder for this profile.
+
|}
+
 
+
= Authoring touchpoint data =
+
Touchpoint data can be added to a bundle by adding a file called p2.inf to the bundle's META-INF directory. The format of this file is key=value pairs as follow:
+
 
+
  instructions.<phase> = <raw actions>
+
 
+
Where <phase> is one of the p2 phases (collect, configure, install, uninstall, unconfigure, etc). The <raw actions> will be appended to the end of any instructions already being generated.
+
 
+
As a concrete example chmod/ln would look something like
+
 
+
  instructions.install = \
+
    ln(targetDir:@artifact,linkTarget:foo/lib.1.so,linkName:lib.so);\
+
    chmod(targetDir:@artifact,targetFile:lib/lib.so,permissions:755);
+
 
+
[[Category:Equinox p2|Metadata Authoring]]
+

Latest revision as of 12:18, 14 December 2012

The information from this page is now in the formal platform documentation:

http://help.eclipse.org/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_actions_touchpoints.html

This page has been deleted to avoid duplication.

Back to the top