diff options
| author | Paul Webster | 2012-11-15 18:29:10 +0000 |
|---|---|---|
| committer | Paul Webster | 2012-11-15 18:29:10 +0000 |
| commit | ab75336db382618cf2388082bfe6d618120fbb06 (patch) | |
| tree | b4ddf5649753559972cd9658157d2e5ecb796a8d | |
| parent | 70e5f26a9561b1273511c7f3681425b5509c9f41 (diff) | |
| download | eclipse.platform.releng.aggregator-ab75336db382618cf2388082bfe6d618120fbb06.tar.gz eclipse.platform.releng.aggregator-ab75336db382618cf2388082bfe6d618120fbb06.tar.xz eclipse.platform.releng.aggregator-ab75336db382618cf2388082bfe6d618120fbb06.zip | |
Bug 393923 - [CBI] clone the aggregator to run the build
Provide a get-aggregator.sh script
| -rw-r--r-- | scripts/build-functions.sh | 149 | ||||
| -rw-r--r-- | scripts/build_eclipse_org.env | 10 | ||||
| -rw-r--r-- | scripts/get-aggregator.sh | 40 | ||||
| -rw-r--r-- | scripts/parse-opts.sh | 30 |
4 files changed, 229 insertions, 0 deletions
diff --git a/scripts/build-functions.sh b/scripts/build-functions.sh new file mode 100644 index 000000000..7c345efb0 --- /dev/null +++ b/scripts/build-functions.sh @@ -0,0 +1,149 @@ +#!/bin/bash +# this is not really to be executed + +# USAGE: fn-git-clone URL [BRANCH [TARGET_DIR] ] +# URL: file:///gitroot/platform/eclipse.platform.releng.aggregator.git +# BRANCH: R4_2_maintenance +# TARGET_DIR: e.p.releng.aggregator +fn-git-clone () { + URL="$1"; shift + if [ $# -gt 0 ]; then + BRANCH="-b $1"; shift + fi + if [ $# -gt 0 ]; then + TARGET_DIR="$1"; shift + fi + echo git clone $BRANCH $URL $TARGET_DIR + git clone $BRANCH $URL $TARGET_DIR +} + +# USAGE: fn-git-checkout BRANCH | TAG +# BRANCH: R4_2_maintenance +fn-git-checkout () { + BRANCH="$1"; shift + echo git checkout "$BRANCH" + git checkout "$BRANCH" +} + +# USAGE: fn-git-pull +fn-git-pull () { + echo git pull + git pull +} + +# USAGE: fn-git-submodule-update +fn-git-submodule-update () { + echo git submodule init + git submodule init + echo git submodule update + git submodule update +} + + +# USAGE: fn-git-clean +fn-git-clean () { + echo git clean -f -d + git clean -f -d +} + +# USAGE: fn-git-reset +fn-git-reset () { + echo git reset --hard HEAD + git reset --hard HEAD +} + +# USAGE: fn-git-clean-submodules +fn-git-clean-submodules () { + echo git submodule foreach git clean -f -d + git submodule foreach git clean -f -d +} + + +# USAGE: fn-git-reset-submodules +fn-git-reset-submodules () { + echo git submodule foreach git reset --hard HEAD + git submodule foreach git reset --hard HEAD +} + +# USAGE: fn-build-id BUILD_TYPE +# BUILD_TYPE: I, M, N +fn-build-id () { + BUILD_TYPE="$1"; shift + echo $BUILD_TYPE$(date +%Y%m%d)-$(date +%H%M) +} + +# USAGE: fn-local-repo URL [TO_REPLACE] +# URL: git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git +# TO_REPLACE: git://git.eclipse.org +fn-local-repo () { + TO_REPLACE='git://git.eclipse.org' + URL="$1"; shift + if [ $# -gt 0 ]; then + TO_REPLACE="$1"; shift + fi + echo $URL | sed "s!$TO_REPLACE!file://!g" +} + +# USAGE: cat repositories.txt | fn-local-repos [TO_REPLACE] +# TO_REPLACE: git://git.eclipse.org +fn-local-repos () { + TO_REPLACE='git://git.eclipse.org' + if [ $# -gt 0 ]; then + TO_REPLACE="$1"; shift + fi + sed "s!$TO_REPLACE!file://!g" +} + +# USAGE: fn-git-clone-aggregator GIT_CACHE URL BRANCH +# GIT_CACHE: /shared/eclipse/builds/R4_2_maintenance/gitCache +# URL: file:///gitroot/platform/eclipse.platform.releng.aggregator.git +# BRANCH: R4_2_maintenance +fn-git-clone-aggregator () { + GIT_CACHE="$1"; shift + URL="$1"; shift + BRANCH="$1"; shift + if [ ! -e "$GIT_CACHE" ]; then + mkdir -p "$GIT_CACHE" + fi + pushd "$GIT_CACHE" + fn-git-clone "$URL" "$BRANCH" + popd + pushd $(fn-git-dir "$GIT_CACHE" "$URL" ) + fn-git-submodule-update + popd +} + +# USAGE: fn-git-clean-aggregator AGGREGATOR_DIR BRANCH +# AGGREGATOR_DIR: /shared/eclipse/builds/R4_2_maintenance/gitCache/eclipse.platform.releng.aggregator +# BRANCH: R4_2_maintenance +fn-git-clean-aggregator () { + AGGREGATOR_DIR="$1"; shift + BRANCH="$1"; shift + pushd "$AGGREGATOR_DIR" + fn-git-clean + fn-git-reset + fn-git-clean-submodules + fn-git-reset-submodules + fn-git-checkout "$BRANCH" + popd +} + +# USAGE: fn-git-cache ROOT BRANCH +# ROOT: /shared/eclipse/builds +# BRANCH: R4_2_maintenance +fn-git-cache () { + ROOT="$1"; shift + BRANCH="$1"; shift + echo $ROOT/$BRANCH/gitCache +} + +# USAGE: fn-git-dir GIT_CACHE URL +# GIT_CACHE: /shared/eclipse/builds/R4_2_maintenance/gitCache +# URL: file:///gitroot/platform/eclipse.platform.releng.aggregator.git +fn-git-dir () { + GIT_CACHE="$1"; shift + URL="$1"; shift + echo $GIT_CACHE/$( basename "$URL" .git ) +} + + diff --git a/scripts/build_eclipse_org.env b/scripts/build_eclipse_org.env new file mode 100644 index 000000000..1252b8fff --- /dev/null +++ b/scripts/build_eclipse_org.env @@ -0,0 +1,10 @@ +BUILD_ROOT=/shared/eclipse/builds +AGGREGATOR_REPO=git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git +B_GIT_EMAIL=e4Build@eclipse.org +B_GIT_NAME="E4 Build" +COMMITTER_ID=e4Build + +BRANCH=R4_2_maintenance +STREAM=4.2.2 + + diff --git a/scripts/get-aggregator.sh b/scripts/get-aggregator.sh new file mode 100644 index 000000000..c4fbb58f4 --- /dev/null +++ b/scripts/get-aggregator.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# + +if [ $# -ne 1 ]; then + echo USAGE: $0 env_file + exit 1 +fi + +if [ ! -r "$1" ]; then + echo "$1" cannot be read + echo USAGE: $0 env_file + exit 1 +fi + +pushd $( dirname $0 ) >/dev/null +SCRIPT_PATH=$(pwd) +popd >/dev/null + +. $SCRIPT_PATH/build-functions.sh + +. "$1" + + +cd $BUILD_ROOT + +# derived values +gitCache=$( fn-git-cache "$BUILD_ROOT" "$BRANCH" ) +aggDir=$( fn-git-dir "$gitCache" "$AGGREGATOR_REPO" ) + +if [ -r "$aggDir" ]; then + fn-git-clean-aggregator "$aggDir" "$BRANCH" + pushd "$aggDir" + fn-git-pull + fn-git-submodule-update + popd +else + fn-git-clone-aggregator "$gitCache" \ + $(fn-local-repo "$AGGREGATOR_REPO") "$BRANCH" +fi + diff --git a/scripts/parse-opts.sh b/scripts/parse-opts.sh new file mode 100644 index 000000000..2d6469f47 --- /dev/null +++ b/scripts/parse-opts.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# + +pushd $( dirname $0 ) >/dev/null +SCRIPT_PATH=$(pwd) +popd >/dev/null + +set -- $( getopt -l buildArea:,stream:,branch: -o "" -- "$@" ) + + +while [ $# -gt 0 ]; do + case "$1" in + "--buildArea") + buildArea="$2"; shift;; + "--stream") + stream="$2"; shift;; + "--branch") + branch="$2"; shift;; + esac + shift +done + +buildArea_branch=$buildArea/$branch +gitCache=$buildArea_branch/gitCache + + +if [ -r $gitCache/eclipse.platform.releng.aggregator ]; then + pushd $gitCache/eclipse.platform.releng.aggregator +else +fi |
