2 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3 ##############################################################################
4 # Copyright (c) 2016 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 EPOCH_DATE=`date +%s%3N`
13 MVN_METADATA=`echo $P2ZIP_URL | sed 's,/*[^/]\+/*$,,' | sed 's,/*[^/]\+/*$,,'`/maven-metadata.xml
14 P2_COMPOSITE_ARTIFACTS=compositeArtifacts.xml
15 P2_COMPOSITE_CONTENT=compositeContent.xml
17 wget $MVN_METADATA -O maven-metadata.xml
19 VERSIONS=`xmlstarlet sel -t -m "/metadata/versioning/versions" -v "version" maven-metadata.xml`
20 NUM_VERSIONS=`echo $VERSIONS | wc -w`
24 ## Create compositeArtifacts.xml and compositeContent.xml files
27 cat > $P2_COMPOSITE_ARTIFACTS <<EOF
28 <?xml version='1.0' encoding='UTF-8'?>
29 <?compositeArtifactRepository version='1.0.0'?>
30 <repository name='OpenDaylight $PROJECT'
31 type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
33 <property name='p2.timestamp' value='$EPOCH_DATE'/>
35 <children size='$NUM_VERSIONS'>
38 cat > $P2_COMPOSITE_CONTENT <<EOF
39 <?xml version='1.0' encoding='UTF-8'?>
40 <?compositeMetadataRepository version='1.0.0'?>
41 <repository name='OpenDaylight $PROJECT'
42 type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
44 <property name='p2.timestamp' value='$EPOCH_DATE'/>
46 <children size='$NUM_VERSIONS'>
55 echo " <child location='$ver'/>" >> $P2_COMPOSITE_ARTIFACTS
56 echo " <child location='$ver'/>" >> $P2_COMPOSITE_CONTENT
63 cat >> $P2_COMPOSITE_ARTIFACTS <<EOF
68 cat >> $P2_COMPOSITE_CONTENT <<EOF
74 ## Create poms for uploading
77 zip composite-repo.zip $P2_COMPOSITE_ARTIFACTS $P2_COMPOSITE_CONTENT
79 cat > deploy-composite-repo.xml <<EOF
80 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
81 <modelVersion>4.0.0</modelVersion>
82 <groupId>org.opendaylight.$PROJECT</groupId>
83 <artifactId>p2repo</artifactId>
84 <version>1.0.0-SNAPSHOT</version>
85 <packaging>pom</packaging>
90 <groupId>org.apache.maven.plugins</groupId>
91 <artifactId>maven-deploy-plugin</artifactId>
92 <version>2.8.2</version>
98 <groupId>org.sonatype.plugins</groupId>
99 <artifactId>maven-upload-plugin</artifactId>
100 <version>0.0.1</version>
103 <id>publish-site</id>
104 <phase>deploy</phase>
106 <goal>upload-file</goal>
109 <serverId>opendaylight-p2</serverId>
110 <repositoryUrl>https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed</repositoryUrl>
111 <file>composite-repo.zip</file>
112 <repositoryPath>org.opendaylight.$PROJECT</repositoryPath>