[526567] Add publishing support
diff --git a/releng/org.eclipse.qvtd.releng.build-site/downloads.sh b/releng/org.eclipse.qvtd.releng.build-site/downloads.sh
new file mode 100644
index 0000000..5713eeb
--- /dev/null
+++ b/releng/org.eclipse.qvtd.releng.build-site/downloads.sh
@@ -0,0 +1,41 @@
+#!/bin/bash -xv
+#
+# Promote the PUBLISH__URL to the downloads 'page'.
+#
+# PUBLISH__URL The zip to be published e.g. https://hudson.eclipse.org/ocl/job/qvtd-photon-master/25/artifact/releng/org.eclipse.qvtd.releng.build-site/target/org.eclipse.qvtd-0.15.0.v20171025-1600.zip
+# PUBLISH__VERSION Unqualified version e.g. 0.15.0
+# PUBLISH__BUILD_T Build type N/I/S, blank suppresses promotion
+# PUBLISH__QUALIFIER Version qualifier e.g. v20171025-1600
+# PUBLISH__ALIAS Non blank to use alias as part of final name
+#
+dropsFolder="/home/data/httpd/download.eclipse.org/mmt/qvtd/downloads/drops/"
+group="modeling.mmt.qvtd"
+zipPrefix="qvtd-incubation-Update-"
+
+if [ -n "${PUBLISH__BUILD_T}" ]
+then
+
+ tQualifier="${PUBLISH__BUILD_T}${PUBLISH__QUALIFIER:1:8}${PUBLISH__QUALIFIER:10:4}"
+ versionFolder="${dropsFolder}${PUBLISH__VERSION}/${tQualifier}"
+ if [ ! -d "${versionFolder}" ]
+ then
+ mkdir -p ${versionFolder}
+ fi
+
+ fileStem="${tQualifier}"
+ if [ -n "${PUBLISH__ALIAS}" ]
+ then
+ fileStem=${PUBLISH__ALIAS}
+ fi
+ zipFile="${zipPrefix}${fileStem}.zip"
+
+ pushd ${versionFolder}
+ curl -s -k ${PUBLISH__URL} > ${zipFile}
+ md5sum -b ${zipFile} > ${zipFile}.md5
+ sha512sum -b ${zipFile} > ${zipFile}.sha1
+ # make sure permissions are for the intended group
+ chgrp -R ${group} ${zipFile} ${zipFile}.md5 ${zipFile}.sha1
+ chmod -R g+w ${zipFile} ${zipFile}.md5 ${zipFile}.sha1
+ popd
+
+fi
\ No newline at end of file
diff --git a/releng/org.eclipse.qvtd.releng.build-site/pom.xml b/releng/org.eclipse.qvtd.releng.build-site/pom.xml
index be979a6..30ebd0f 100644
--- a/releng/org.eclipse.qvtd.releng.build-site/pom.xml
+++ b/releng/org.eclipse.qvtd.releng.build-site/pom.xml
@@ -12,4 +12,45 @@
<artifactId>org.eclipse.qvtd.releng.build-site</artifactId>
<version>0.15.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>downloads.sh</include>
+ <include>index.html</include>
+ <include>publisher.properties</include>
+ <include>updates.sh</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-repository-plugin</artifactId>
+ <configuration>
+ <createArtifactRepository>true</createArtifactRepository>
+ <finalName>${project.groupId}-${unqualifiedVersion}.${buildQualifier}</finalName>
+ <compress>true</compress>
+ <repositoryName>EMF Compare ${unqualifiedVersion}.${buildQualifier}</repositoryName>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
diff --git a/releng/org.eclipse.qvtd.releng.build-site/publisher.properties b/releng/org.eclipse.qvtd.releng.build-site/publisher.properties
new file mode 100644
index 0000000..3a2fad4
--- /dev/null
+++ b/releng/org.eclipse.qvtd.releng.build-site/publisher.properties
@@ -0,0 +1,16 @@
+# QVTd publisher properties for use by the promoter job:
+#
+# rm -f downloads.sh updates.sh
+# curl -s -k ${PUBLISH__DOWNLOADS_SH} > downloads.sh
+# curl -s -k ${PUBLISH__UPDATES_SH} > updates.sh
+# chmod +x downloads.sh updates.sh
+# bash -ex downloads.sh
+# bash -ex updates.sh
+#
+PUBLISH__ALIAS=${BUILD_ALIAS}
+PUBLISH__BUILD_T=${BUILD_T}
+PUBLISH__DOWNLOADS_SH=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.qvtd.releng.build-site/target/downloads.sh
+PUBLISH__QUALIFIER=${buildQualifier}
+PUBLISH__UPDATES_SH=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.qvtd.releng.build-site/target/updates.sh
+PUBLISH__URL=${env.JOB_URL}${env.BUILD_NUMBER}/artifact/releng/org.eclipse.qvtd.releng.build-site/target/${project.groupId}-${unqualifiedVersion}.${buildQualifier}.zip
+PUBLISH__VERSION=${unqualifiedVersion}
diff --git a/releng/org.eclipse.qvtd.releng.build-site/updates.sh b/releng/org.eclipse.qvtd.releng.build-site/updates.sh
new file mode 100644
index 0000000..81422ad
--- /dev/null
+++ b/releng/org.eclipse.qvtd.releng.build-site/updates.sh
@@ -0,0 +1,91 @@
+#!/bin/bash -xv
+#
+# Promote the PUBLISH__URL to an updates repository.
+#
+# PUBLISH__URL The zip to be published e.g. https://hudson.eclipse.org/ocl/job/qvtd-photon-master/25/artifact/releng/org.eclipse.qvtd.releng.build-site/target/org.eclipse.qvtd-0.15.0.v20171025-1600.zip
+# PUBLISH__VERSION Unqualified version e.g. 0.15.0
+# PUBLISH__BUILD_T Build type N/I/S, blank suppresses promotion
+# PUBLISH__QUALIFIER Version qualifier e.g. v20171025-1600
+#
+updatesFolder="/home/data/httpd/download.eclipse.org/mmt/qvtd/updates/"
+group="modeling.mmt.qvtd"
+localZip="qvtd.zip"
+projectRepoName="QVTd"
+manageComposite="/shared/common/apache-ant-latest/bin/ant -f /shared/modeling/tools/promotion/manage-composite.xml"
+
+if [ -n "${PUBLISH__BUILD_T}" ]
+then
+
+ if [ "${PUBLISH__BUILD_T}" = "N" ]
+ then
+ buildFolder="${updatesFolder}nightly"
+ buildRepoName="Nightly"
+ elif [ "${PUBLISH__BUILD_T}" = "I" ]
+ then
+ buildFolder="${updatesFolder}interim"
+ buildRepoName="Interim"
+ elif [ "${PUBLISH__BUILD_T}" = "S" ]
+ then
+ buildFolder="${updatesFolder}milestones"
+ buildRepoName="Milestones"
+ else
+ buildFolder="${updatesFolder}other"
+ buildRepoName="Other"
+ fi
+
+ if [ ! -d "${buildFolder}" ]
+ then
+ mkdir -p ${buildFolder}
+ fi
+
+ pushd ${buildFolder}
+ if [ ! -d "${PUBLISH__VERSION}" ]
+ then
+ mkdir ${PUBLISH__VERSION}
+ versionCompositeName="${projectRepoName} ${buildRepoName} Repository"
+ ${manageComposite} add -Dchild.repository=${PUBLISH__VERSION} -Dcomposite.name="${versionCompositeName}"
+ fi
+
+ if [ "${PUBLISH__BUILD_T}" = "N" ]
+ then
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip -ou ${localZip} -d new${PUBLISH__VERSION}
+ chgrp -R ${group} new${PUBLISH__VERSION}
+ chmod -R g+w new${PUBLISH__VERSION}
+ mv ${PUBLISH__VERSION} old${PUBLISH__VERSION}
+ mv new${PUBLISH__VERSION} ${PUBLISH__VERSION}
+ rm -rf old${PUBLISH__VERSION} ${localZip}
+ elif [ "${PUBLISH__BUILD_T}" = "I" ]
+ then
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip -ou ${localZip} -d new${PUBLISH__VERSION}
+ chgrp -R ${group} new${PUBLISH__VERSION}
+ chmod -R g+w new${PUBLISH__VERSION}
+ mv ${PUBLISH__VERSION} old${PUBLISH__VERSION}
+ mv new${PUBLISH__VERSION} ${PUBLISH__VERSION}
+ rm -rf old${PUBLISH__VERSION} ${localZip}
+ elif [ "${PUBLISH__BUILD_T}" = "S" ]
+ then
+ pushd ${buildFolder}/${PUBLISH__VERSION}
+
+ tQualifier="${PUBLISH__BUILD_T}${PUBLISH__QUALIFIER:1:8}${PUBLISH__QUALIFIER:10:4}"
+ versionFolder="${buildFolder}/${tQualifier}"
+ if [ ! -d "${tQualifier}" ]
+ then
+ mkdir ${tQualifier}
+ fi
+
+ curl -s -k ${PUBLISH__URL} > ${localZip}
+ unzip ${localZip} -d ${tQualifier}
+ rm ${localZip}
+
+ chgrp -R ${group} ${tQualifier}
+ chmod -R g+w ${tQualifier}
+ ${manageComposite} add -Dchild.repository=${tQualifier} -Dcomposite.name="${projectRepoName} ${PUBLISH__VERSION} ${buildRepoName} Repository"
+
+ popd
+ fi
+
+ popd
+
+fi
\ No newline at end of file