diff options
author | Mélanie Bats | 2015-12-09 08:43:19 +0000 |
---|---|---|
committer | Mélanie Bats | 2015-12-09 08:43:19 +0000 |
commit | ff9921b79a47dc83dd13cb1c97b28dd543885727 (patch) | |
tree | 84446ea5c95ad89c4d8a6b94472f0c0cd1a062bc | |
parent | 36f6389bc38c5e3046ecc1475d74992c40fd0c51 (diff) | |
download | org.eclipse.eef-ff9921b79a47dc83dd13cb1c97b28dd543885727.tar.gz org.eclipse.eef-ff9921b79a47dc83dd13cb1c97b28dd543885727.tar.xz org.eclipse.eef-ff9921b79a47dc83dd13cb1c97b28dd543885727.zip |
[build] Fix publish nightly script
Change-Id: Id90fa14eb265f1fbe5717a9a2004b99b9ff03961
-rwxr-xr-x | releng/org.eclipse.eef.releng/publish-nightly.sh | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/releng/org.eclipse.eef.releng/publish-nightly.sh b/releng/org.eclipse.eef.releng/publish-nightly.sh index 38ad861cb..f5e3ae2b3 100755 --- a/releng/org.eclipse.eef.releng/publish-nightly.sh +++ b/releng/org.eclipse.eef.releng/publish-nightly.sh @@ -10,6 +10,18 @@ # Obeo - initial API and implementation # ==================================================================== +[ -z "$WORKSPACE" -o -z "$GIT_BRANCH" ] && { + echo "Execution aborted. + +One or more of the required variables is not set. They are normally +provided by the Hudson build. + +- WORKSPACE : the build workspace root. +- GIT_BRANCH : the name fo the Git branch being build/published. +" + exit 1 +} + ###################################################################### # Setup ###################################################################### @@ -28,10 +40,16 @@ export BUILD_TYPE_PREFIX="N" # The root folder for all EEF update sites export EEF_UPDATES_ROOT="/home/data/httpd/download.eclipse.org/modeling/emft/eef/updates" +# Streams are of the form 1.0.x: only keep major and minor version number parts +export STREAM=$(echo "$VERSION" | sed -r -e 's/^([0-9]+\.[0-9]+\.).*$/\1x/') + # Converts the Hudson BUILD_ID (e.g. 2013-10-15_07-07-07) into the # syntax we want for our update-sites (e.g. 20131015-070707) export BUILD_TIMESTAMP=$(echo "$BUILD_ID" | sed -e 's/-//g' -e 's/_/-/') +# The timestamp in the p2 composite repos used to implement redirects +export P2_TIMESTAMP=$(date +"%s000") + # The full version for this build, e.g. 0.9.0-N20131015-070707 export FULL_VERSION="${VERSION}-${BUILD_TYPE_PREFIX}${BUILD_TIMESTAMP}" @@ -50,7 +68,7 @@ export WKS="." # Ensure the target folder exists mkdir -p "$TARGET_DIR" # The actual publication of the p2 repo produced by the build -cp -a "$WKS"/packaging/org.eclipse.eef.update/target/repository/* "$TARGET_DIR" +cp -a "$WKS"/releng/org.eclipse.eef.update/target/repository/* "$TARGET_DIR" # Publish the target platform definitions used, so that downstream projects can reference them mkdir -p "$TARGET_DIR/targets" cp -a "$WKS"/releng/org.eclipse.eef.releng/targetplatforms/* "$TARGET_DIR/targets" @@ -59,4 +77,54 @@ cp -a "$WKS"/releng/org.eclipse.eef.releng/targetplatforms/* "$TARGET_ROOT/targe # Publish a dump of the build environment, may be useful to debug env | sort > "$TARGET_DIR/build_env.txt" + ###################################################################### +# Setup or update the redirects (implemented as composite repos) +###################################################################### + +# Create a p2 composite repo to setup a redirect +create_redirect() { + FROM="$1" + TO="$2" + + mkdir -p "$FROM" + cat > "$FROM/compositeArtifacts.xml" <<EOF +<?xml version='1.0' encoding='UTF-8'?> +<?compositeArtifactRepository version='1.0.0'?> +<repository name='Eclipse EEF' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'> + <properties size='1'> + <property name='p2.timestamp' value='$P2_TIMESTAMP'/> + </properties> + <children size='1'> + <child location='http://download.eclipse.org/modeling/emft/eef/updates/$TO'/> + </children> +</repository> +EOF + + cat > "$FROM/compositeContent.xml" <<EOF +<?xml version='1.0' encoding='UTF-8'?> +<?compositeMetadataRepository version='1.0.0'?> +<repository name='Eclipse EEF' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'> + <properties size='1'> + <property name='p2.timestamp' value='$P2_TIMESTAMP'/> + </properties> + <children size='1'> + <child location='http://download.eclipse.org/modeling/emft/eef/updates/$TO'/> + </children> +</repository> +EOF + +} + +# First, a link for the $VERSION (e.g. "1.2.0/luna" => "1.2.0-NYYYYMMDD-HHMM/luna") +create_redirect "$TARGET_ROOT/$VERSION/$PLATFORM" "$BUILD_TYPE/$FULL_VERSION/$PLATFORM" +create_redirect "$TARGET_ROOT/$VERSION/$PLATFORM/tests" "$BUILD_TYPE/$FULL_VERSION/$PLATFORM/tests" +# Also create a link for the $STREAM (e.g. "1.2.x/luna" => "1.2.0-NYYYYMMDD-HHMM/luna") +# and publish the zipped versions there, at stable URLs +create_redirect "$TARGET_ROOT/$STREAM/$PLATFORM" "$BUILD_TYPE/$FULL_VERSION/$PLATFORM" +cp -a "$WKS"/releng/org.eclipse.eef.update/target/org.eclipse.eef.update-*.zip "$TARGET_ROOT/$STREAM/org.eclipse.eef-$VERSION-$PLATFORM.zip" +# Also update the global "latest" links if we are building master +if [ "master" = "$GIT_BRANCH" ]; then + create_redirect "$TARGET_ROOT/latest/$PLATFORM" "$BUILD_TYPE/$FULL_VERSION/$PLATFORM" + cp -a "$WKS"/releng/org.eclipse.eef.update/target/org.eclipse.eef.update-*.zip "$TARGET_ROOT/$STREAM/org.eclipse.eef-$VERSION-$PLATFORM.zip" +fi
\ No newline at end of file |