Git Product home page Git Product logo

p2_composite's Introduction

This project contains a script that is used to maintain a p2 composite repository, for an Eclipse RCP application.

Introduction

Eclipse RCP applications are able to update themselves from a repository using the Eclipse P2 distribution model.

Rollback to previous versions can be offered if the repository contains those previous versions. This repository structure is termed a Composite Repository.

Issue

Software exists to support the maintenance of P2 repositories, available as Ant scripts or command-line utilities. But, it has proven challenging to get these applications to build, since those found typically haven't been updated for 5 years. Or, they require a running instance of Eclipse, which doesn't suit all target networks (including those that are headless or don't have a Java runtime).

Solution

Research into Composite Repositories has indicated that they are supported by two relatively straightforward XML files, similar in structure to this one:

<?xml version='1.0' encoding='UTF-8'?>
<?compositeArtifactRepository version='1.0.0'?>
<repository name='&quot;Eclipse Project Test Site&quot;'
    type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
  <properties size='1'>
    <property name='p2.timestamp' value='1243822502440'/>
  </properties>
  <children size='2'>
    <child location='childOne'/>
    <child location='childTwo'/>
  </children>
</repository>

The children element contains the URLs of a series of release versions. Experiments have demonstrated that these can just be a series of sub-folders, one for each unpacked release.

A python script has been developed to automate the addition of a new release. The script performs these steps:

  1. Verify that the current working folder is a valid repository (i.e. the assorted metadata files are present)
  2. Verify that the current working folder contains a .zip file (this is presumed to be a P2_Repository.zip file containing a new release)
  3. Generate a string with the current date-time (timestamp)
  4. Rename the .zip file to timestamp
  5. Unpack the zip file into a folder within the updates sub-folder named with that timestamp
  6. Modify the two XML definition files to add the new sub-folder path to the children element, and increment the counter
  7. Delete the zip file

Setup

Place a copy of the contents of the repository folder of this project on the target hosting environment that is visible to the client application. The files can be served by an HTTP-server, or a shared network drive.

Add the hosting location to the Eclipse RCP (client) application using the Add button from the Available Software Sites preference page.

add_software_site

Usage

  1. Navigate to the repository folder, on a system with Python3 available
  2. Copy a new release into this folder
  3. Execute python3 update.py from the command line
  4. A successful update will be indicated by a == COMPLETE == response.

Future

The script could be extended to accept a variable denoting the number of releases to store. When a release is added which results in the number of children exceeding that number, the relevant number of release version would be deleted from both the XML file and the updates sub-folder.

p2_composite's People

Contributors

ianmayo avatar wws22 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.