diff options
Diffstat (limited to 'org.eclipse.emf.compare-parent/releng/common.sh')
-rw-r--r-- | org.eclipse.emf.compare-parent/releng/common.sh | 86 |
1 files changed, 54 insertions, 32 deletions
diff --git a/org.eclipse.emf.compare-parent/releng/common.sh b/org.eclipse.emf.compare-parent/releng/common.sh index 26461f51b..eabd21ac4 100644 --- a/org.eclipse.emf.compare-parent/releng/common.sh +++ b/org.eclipse.emf.compare-parent/releng/common.sh @@ -10,9 +10,6 @@ # Obeo - initial API and implementation # ==================================================================== -# For testing -#export BUILD_ID=$(date "+%Y-%m-%d_%H-%M-%S") - # The path to the p2-admin executable export P2_ADMIN_PATH="/jobs/genie.modeling.emfcompare/p2-admin/lastStable/archive/org.eclipselabs.equinox.p2.admin.product/target/products/org.eclipse.equinox.p2.admin.rcp.product/linux/gtk/x86_64/p2admin" @@ -46,6 +43,7 @@ chmod u+x $P2_ADMIN_PATH alias p2-admin="$P2_ADMIN_PATH" alias composite-repository="p2-admin -application org.eclipselabs.equinox.p2.composite.repository -compressed" +# Create a p2 index file for composite repositories createP2Index() { cat > "$1/p2.index" <<EOF version = 1 @@ -57,9 +55,9 @@ EOF # Remove any previous file from the $1 path and create a composite repository with a single # child ($2). The composite will be name $3. createRedirect() { - local from=$1 - local to=$2 - local name=$3 + local from="$1" + local to="$2" + local name="$3" mkdir -p "$from" rm -f "$from/compositeArtifacts."* @@ -71,8 +69,8 @@ createRedirect() { # Echo a negative integer, zero, or a positive integer if $1 version is less than, equal to, # or greater than the specified $2 version. compareOSGIVersions() { - local this=$1 - local that=$2 + local this="$1" + local that="$2" thisMajor=`echo $this | cut -d . -f1` thisMinor=`echo $this | cut -d . -f2` thisMicro=`echo $this | cut -d . -f3` @@ -95,43 +93,46 @@ compareOSGIVersions() { # print all major versions (sorted) in the $1 path on the standard output # the output will be a list of integer allMajors() { - local path=$1 + local path="$1" find-regex "$path" -regex '^'"$path"'/?[0-9]+\.[0-9]+\.[0-9]+-[NIR][0-9]{8}-[0-9]{6}$' -type d \ | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\1#' \ - | sort -t . -un -k1,1 -k2,2 -k3,3 + | sort -un } # print all minor versions (sorted) for the given $2 major version in the $1 path on the standard output # $2 must be an integer # the output will be a list of the form X.Y allMinors() { - local path=$1 - local major=$2 + local path="$1" + local major="$2" find-regex "$path" -regex '^'"$path"'/?'"$major"'\.[0-9]+\.[0-9]+-[NIR][0-9]{8}-[0-9]{6}$' -type d \ - | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\1.\2#' \ - | sort -t . -un -k2,2 -k3,3 + | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\2#' \ + | sort -un } # print all micro versions (sorted) for the given $2 minor version in the $1 path on the standard output # $2 must be of the form x.y where x and y are integer # the output will be a list of the form X.Y.Z allMicros() { - local path=$1 - local minor=$2 - find-regex "$path" -regex '^'"$path"'/?'"$minor"'\.[0-9]+-[NIR][0-9]{8}-[0-9]{6}$' -type d \ - | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\1.\2.\3#' \ - | sort -t . -un -k3,3 + local path="$1" + local major="$2" + local minor="$3" + find-regex "$path" -regex '^'"$path"'/?'"$major"'\.'"$minor"'\.[0-9]+-[NIR][0-9]{8}-[0-9]{6}$' -type d \ + | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\3#' \ + | sort -un } # print all builds (sorted) for the given $2 micro version in the $1 path on the standard output # $2 must be of the form x.y.z where x, y and z are integer # the output will be a list of the form X.Y.Z-NYYYYMMDD-HHMMSS allBuilds() { - local path=$1 - local micro=$2 - find-regex "$path" -regex '^'"$path"'/?'"$micro"'+-[NIR][0-9]{8}-[0-9]{6}$' -type d \ - | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-([NIR])([0-9]{8})-([0-9]{6})$#\1.\2.\3-\4\5-\6#' \ - | sort + local path="$1" + local major="$2" + local minor="$3" + local micro="$4" + find-regex "$path" -regex '^'"$path"'/?'"$major"'\.'"$minor"'\.'"$micro"'-[NIR][0-9]{8}-[0-9]{6}$' -type d \ + | sed-regex -e 's#'"$path"'/?##' \ + | sort -u } # visit all the builds in $1 path and call the $2 callback for each. @@ -150,10 +151,10 @@ allBuilds() { # 9/ the most recent build version in the currently visited micro version (format x.y.z-TYYYYMMDD-HHMM, where x, y and z # are integer, T is N for nightly, I for integration or R for release and YYYYMMDD-HHMM is a timestamp) visitVersions() { - local path=$1 - local callback=$2 - local version=$3 - + local path="$1" + local callback="$2" + local version="$3" + allMajors=$(allMajors "$path") latestMajor=$(echo "$allMajors" | tail -1) for major in $allMajors @@ -162,15 +163,36 @@ visitVersions() { latestMinor=$(echo "$allMinors" | tail -1) for minor in $allMinors do - allMicros=$(allMicros "$path" "$minor") + allMicros=$(allMicros "$path" "$major" "$minor") latestMicro=$(echo "$allMicros" | tail -1) for micro in $allMicros do - allBuilds=$(allBuilds "$path" "$micro") + allBuilds=$(allBuilds "$path" "$major" "$minor" "$micro") latestBuild=$(echo "$allBuilds" | tail -1) $callback "$path" "$version" "$major" "$minor" "$micro" "$latestMajor" "$latestMinor" "$latestMicro" "$latestBuild" - done + done done done -}
\ No newline at end of file +} + +# Get the name of the minor stream from the $1 full version X.Y.Z. +# Example: majorStream 2.3.2 => 2.3.x +minorStream() { + local version="$1" + echo "$version" | sed-regex -e 's/^([0-9]+\.[0-9]+\.).*$/\1x/' +} + +# Get the name of the major stream from the $1 full version X.Y.Z. +# Example: majorStream 2.3.2 => 2.x +majorStream() { + local version="$1" + echo "$version" | sed-regex -e 's/^([0-9]+\.).*$/\1x/' +} + +# Converts the Hudson build id $1 (e.g. 2013-10-15_07-07-07) into the +# syntax we want for our update-sites (e.g. 20131015-070707) +buildTimestamp() { + local buildId="$1" + echo "$buildId" | sed -e 's/-//g' -e 's/_/-/' +} |