Combine/aggregate eclipse p2 repositories / extendable p2 repository
Asked Answered
E

1

12

With maven/tycho build for Nodeclipse Eclipse plugin there is new p2 repository every release.

Release is done on Bintray that does not allow to update files. So every version goes in its folder.

BaseFolder
BaseFolder/VersionFolder1
BaseFolder/VersionFolder2
BaseFolder/VersionFolder3

Is it possible to have BaseFolder prepared once as extendable p2 repository, and VersionFolderN added later?

So that there would be only one URL for updates and Eclipse platform could discover updates in the repository.

Equities answered 6/1, 2014 at 14:15 Comment(2)
Found example of download.eclipse.org/datatools/updates is lists all versions of Eclipse Data Tools Platform (DTP) Project eclipse.org/datatools ( note that for users (download.eclipse.org/datatools/updates/1.11) URL s given)Equities
Is there really no way you can edit the index files? If yes, there are only pretty hacky solutions which involve guessing all potential future releases.Jankell
J
19

What you are looking for is a composite p2 repository. You'll just need the following two files in the base folder:

  • A compositeContent.xml with the following content:

    <?xml version='1.0' encoding='UTF-8'?>
    <?compositeMetadataRepository version='1.0.0'?>
    <repository name='Project XYZ Releases Repository' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
        <properties size='1'>
            <property name='p2.atomic.composite.loading' value='true'/>
        </properties>
        <children size='3'>
            <child location='VersionFolder1'/>
            <child location='VersionFolder2'/>
            <child location='VersionFolder3'/>
        </children>
    </repository>
    
  • A compositeArtifacts.xml with the following, similar content:

    <?xml version='1.0' encoding='UTF-8'?>
    <?compositeArtifactRepository version='1.0.0'?>
    <repository name='Project XYZ Releases Repository' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
        <properties size='0'>
        </properties>
        <children size='3'>
            <child location='VersionFolder1'/>
            <child location='VersionFolder2'/>
            <child location='VersionFolder3'/>
        </children>
    </repository>
    

When a new version is released, just add the new folder as child in both files.

The two files may also be compressed as ZIP and named compositeContent.jar and compositeArtifacts.jar to save network bandwidth. However this makes editing the files a little less practical.

The Eclipse simultaneous release repositories also use this approach. E.g., at the time of writing this, the Eclipse Luna repository contains only the original release and SR 1 (see compositeContent, compositeArtifacts). SR 2 will be added later, so that users will be able to get updates without having to configure a new repository URL.

Jankell answered 17/1, 2014 at 16:17 Comment(3)
this is superb solution for the problem. Should all VersionFolder exist from the very beginning? Can compositeContent.jar and compositeArtifacts.jar be together artifacts.jar and content.jar with in the same folder dl.bintray.com/nodeclipse/nodeclipse ? This is questions for my research now. Thank you so much.Equities
Wonderland! This example already works! https://raw.github.com/Enide/eclipse-p2-composite-repository/master/Equities
If you put the compositeContent/Artifacts.jar and the content/artifacts.jar into the same folder, p2/Tycho will only consider either. By default, only the the latter would be used.Jankell

© 2022 - 2024 — McMap. All rights reserved.