#!/bin/bash # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2016 The Linux Foundation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## # If we detect a snapshot build then there is no need to run this script. # YangIDE has indicated that the only want the latest snapshot released to # the snapshot directory. if echo "$P2ZIP_URL" | grep opendaylight.snapshot; then exit 0 fi if [[ "$P2ZIP_URL" == "" ]]; then exit 0 fi EPOCH_DATE=$(date +%s%3N) MVN_METADATA=$(echo "$P2ZIP_URL" | sed 's,/*[^/]\+/*$,,' | sed 's,/*[^/]\+/*$,,')/maven-metadata.xml P2_COMPOSITE_ARTIFACTS=compositeArtifacts.xml P2_COMPOSITE_CONTENT=compositeContent.xml wget "$MVN_METADATA" -O maven-metadata.xml VERSIONS=$(xmlstarlet sel -t -m "/metadata/versioning/versions" -v "version" maven-metadata.xml) NUM_VERSIONS=$(echo "$VERSIONS" | wc -w) ## ## Create compositeArtifacts.xml and compositeContent.xml files ## cat > $P2_COMPOSITE_ARTIFACTS < EOF cat > $P2_COMPOSITE_CONTENT < EOF ## ## Loop versions ## for ver in $VERSIONS do echo " " >> $P2_COMPOSITE_ARTIFACTS echo " " >> $P2_COMPOSITE_CONTENT done ## ## Close files ## cat >> $P2_COMPOSITE_ARTIFACTS < EOF cat >> $P2_COMPOSITE_CONTENT < EOF ## ## Create poms for uploading ## zip composite-repo.zip $P2_COMPOSITE_ARTIFACTS $P2_COMPOSITE_CONTENT cat > deploy-composite-repo.xml < 4.0.0 org.opendaylight.$PROJECT p2repo 1.0.0-SNAPSHOT pom org.apache.maven.plugins maven-deploy-plugin 2.8.2 true org.sonatype.plugins maven-upload-plugin 0.0.1 publish-site deploy upload-file opendaylight-p2 https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed composite-repo.zip org.opendaylight.$PROJECT/release EOF