Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2014-01-29 08:55:53 +0000
committerMikaël Barbero2014-02-12 13:23:10 +0000
commit13eb57555d59e94cc60295bdbe2d2b0210261f63 (patch)
treee7c23bf4e6da217336d3a45cd5859fdb51557d62 /org.eclipse.emf.compare-parent/releng
parent72743a3da53c23c31ca3b8865e0b519562ae344b (diff)
downloadorg.eclipse.emf.compare-13eb57555d59e94cc60295bdbe2d2b0210261f63.tar.gz
org.eclipse.emf.compare-13eb57555d59e94cc60295bdbe2d2b0210261f63.tar.xz
org.eclipse.emf.compare-13eb57555d59e94cc60295bdbe2d2b0210261f63.zip
fix bug with version comparison
Diffstat (limited to 'org.eclipse.emf.compare-parent/releng')
-rw-r--r--org.eclipse.emf.compare-parent/releng/common.sh90
-rwxr-xr-xorg.eclipse.emf.compare-parent/releng/publish-nightly.sh85
2 files changed, 107 insertions, 68 deletions
diff --git a/org.eclipse.emf.compare-parent/releng/common.sh b/org.eclipse.emf.compare-parent/releng/common.sh
index a68cf989f..8684051c2 100644
--- a/org.eclipse.emf.compare-parent/releng/common.sh
+++ b/org.eclipse.emf.compare-parent/releng/common.sh
@@ -19,6 +19,15 @@ export EMF_COMPARE_UPDATES_ROOT="/home/data/httpd/download.eclipse.org/modeling/
# The base URL for all EMF Compare update sites
export EMF_COMPARE_UPDATES_BASE_URL="http://download.eclipse.org/modeling/emf/compare/updates"
+NIGHTLY="nightly"
+NIGHTLY_PREFIX="N"
+INTEGRATION="integration"
+INTEGRATION_PREFIX="I"
+RELEASE="release"
+RELEASE_PREFIX="R"
+PREFIXES="$NIGHTLY_PREFIX$INTEGRATION_PREFIX$RELEASE_PREFIX"
+VERSION_PATTERN="([0-9]+)\.([0-9]+)\.([0-9]+)-?([$PREFIXES])?([0-9]{8}-[0-9]{6})?"
+
# To avoid error find: paths must precede expression
# It takes apart the argument list to find and concatenates the arguments back into another
# argument list but inserts -regextype posix-awk in front of any -iregex or -regex arguments it finds.
@@ -88,36 +97,54 @@ createRedirect() {
createP2Index $from
}
+strcmp() {
+ local diff
+ for ((i=0; i<=${#1}; ++i)); do
+ if ((diff=$(printf %d \""${1:i:1}") - $(printf %d \""${2:i:1}") ));
+ then echo $diff; return
+ fi
+ done
+ echo 0
+}
+
# 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"
- thisMajor=`echo $this | cut -d . -f1`
- thisMinor=`echo $this | cut -d . -f2`
- thisMicro=`echo $this | cut -d . -f3`
+
+ thisMajor=$(echo "$this" | sed-regex -e 's/'"$VERSION_PATTERN"'/\1/')
+ thisMinor=$(echo "$this" | sed-regex -e 's/'"$VERSION_PATTERN"'/\2/')
+ thisMicro=$(echo "$this" | sed-regex -e 's/'"$VERSION_PATTERN"'/\3/')
+ thisQualifier=$(echo "$this" | sed-regex -e 's/'"$VERSION_PATTERN"'/\4\5/')
- thatMajor=`echo $that | cut -d . -f1`
- thatMinor=`echo $that | cut -d . -f2`
- thatMicro=`echo $that | cut -d . -f3`
+ thatMajor=$(echo "$that" | sed-regex -e 's/'"$VERSION_PATTERN"'/\1/')
+ thatMinor=$(echo "$that" | sed-regex -e 's/'"$VERSION_PATTERN"'/\2/')
+ thatMicro=$(echo "$that" | sed-regex -e 's/'"$VERSION_PATTERN"'/\3/')
+ thatQualifier=$(echo "$that" | sed-regex -e 's/'"$VERSION_PATTERN"'/\4\5/')
- if [ $thisMajor -ne $thatMajor ]; then
- echo $(($thisMajor-$thatMajor))
- elif [ $thisMinor -ne $thatMinor ]; then
- echo $(($thisMinor-$thatMinor))
- elif [ $thisMicro -ne $thatMicro ]; then
- echo $(($thisMicro-$thatMicro))
+ echo "'"$thisMajor"' => '"$thatMajor"'" 1>&2
+ echo "'"$that"'" 1>&2
+ if [ "$thisMajor" -ne "$thatMajor" ]; then
+ echo $(($thisMajor-$thatMajor)) 1>&2
+ elif [ "$thisMinor" -ne "$thatMinor" ]; then
+ echo $(($thisMinor-$thatMinor)) 1>&2
+ elif [ "$thisMicro" -ne "$thatMicro" ]; then
+ echo $(($thisMicro-$thatMicro)) 1>&2
+ elif [[ "$thisQualifier" != "$thatQualifier" ]]; then
+ echo strcmp $thisQualifier $thatQualifier 1>&2
else
- echo 0
+ echo 0 1>&2
fi
+ echo 0
}
# 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"
- 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#' \
+ find-regex "$path" -regex '^'"$path"'/?'"$VERSION_PATTERN"'$' -type d \
+ | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-(['"$PREFIXES"'])([0-9]{8})-([0-9]{6})$#\1#' \
| sort -un
}
@@ -127,8 +154,8 @@ allMajors() {
allMinors() {
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})$#\2#' \
+ find-regex "$path" -regex '^'"$path"'/?'"$major"'\.[0-9]+\.[0-9]+-['"$PREFIXES"'][0-9]{8}-[0-9]{6}$' -type d \
+ | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-(['"$PREFIXES"'])([0-9]{8})-([0-9]{6})$#\2#' \
| sort -un
}
@@ -139,8 +166,8 @@ allMicros() {
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#' \
+ find-regex "$path" -regex '^'"$path"'/?'"$major"'\.'"$minor"'\.[0-9]+-['"$PREFIXES"'][0-9]{8}-[0-9]{6}$' -type d \
+ | sed-regex -e 's#^'"$path"'/?([0-9]+)\.([0-9]+)\.([0-9]+)-(['"$PREFIXES"'])([0-9]{8})-([0-9]{6})$#\3#' \
| sort -un
}
@@ -152,7 +179,7 @@ allBuilds() {
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 \
+ find-regex "$path" -regex '^'"$path"'/?'"$major"'\.'"$minor"'\.'"$micro"'-['"$PREFIXES"'][0-9]{8}-[0-9]{6}$' -type d \
| sed-regex -e 's#'"$path"'/?##' \
| sort -u
}
@@ -161,16 +188,18 @@ allBuilds() {
# $3 should the version of interest for this call. It is not used by this function but
# is given to the $2 callback.
#
-# The callback must accept 9 parameters:
+# The callback must accept 10 parameters:
# 1/ the path (equals to $1)
# 2/ the version of interrest (equals to $3)
-# 3/ the currently visited major version (format x, where x is an integer)
-# 4/ the currently visited minor version (format x.y, where x and y are integer)
-# 5/ the currently visited micro version (format x.y.z, where x, y and z are integer)
-# 6/ the most recent major version in the given $1 path (format x, where x is an integer)
-# 7/ the most recent minor version in the currently visited major version (format x.y, where x and y are integer)
-# 8/ the most recent micro version in the currently visited minor version (format x.y.z, where x, y and z are integer)
-# 9/ the most recent build version in the currently visited micro version (format x.y.z-TYYYYMMDD-HHMM, where x, y and z
+# 3/ the currently visited major version (an integer)
+# 4/ the currently visited minor version (an integer)
+# 5/ the currently visited micro version (an integer)
+# 6/ the currently visited build (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)
+# 7/ the most recent major version in the given $1 path (an integer)
+# 8/ the most recent minor version in the currently visited major version (an integer)
+# 9/ the most recent micro version in the currently visited minor version (an integer)
+# 10/ 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"
@@ -192,7 +221,10 @@ visitVersions() {
allBuilds=$(allBuilds "$path" "$major" "$minor" "$micro")
latestBuild=$(echo "$allBuilds" | tail -1)
- $callback "$path" "$version" "$major" "$minor" "$micro" "$latestMajor" "$latestMinor" "$latestMicro" "$latestBuild"
+ for build in $allBuilds
+ do
+ $callback "$path" "$version" "$major" "$minor" "$micro" "$build" "$latestMajor" "$latestMinor" "$latestMicro" "$latestBuild"
+ done
done
done
done
diff --git a/org.eclipse.emf.compare-parent/releng/publish-nightly.sh b/org.eclipse.emf.compare-parent/releng/publish-nightly.sh
index 864804736..5be17e9c6 100755
--- a/org.eclipse.emf.compare-parent/releng/publish-nightly.sh
+++ b/org.eclipse.emf.compare-parent/releng/publish-nightly.sh
@@ -18,8 +18,6 @@ source common.sh
######################################################################
# The type of build being published
-BUILD_TYPE="nightly"
-BUILD_TYPE_PREFIX="N"
PROG=`basename $0`
REPOSITORY_PATH="packaging/org.eclipse.emf.compare.update/target/repository"
@@ -69,33 +67,39 @@ fi
if [ -z "$WORKSPACE" ]; then
echo "$0: workspace argument is mandatory" >&2
+ usage >&2
exit 1
fi
if [ ! -d "$WORKSPACE" ]; then
echo "$0: workspace does not exist or is not a directory -- $WORKSPACE" >&2
+ usage >&2
exit 1
fi
if [ -z "$BUILD_ID" ]; then
echo "$0: build-id argument is mandatory" >&2
+ usage >&2
exit 1
fi
echo $BUILD_ID | grep -E '^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}$' > /dev/null
-if [ ! $? -eq 0 ]; then
+if [ $? -ne 0 ]; then
echo "$0: bad build-id format -- $BUILD_ID" >&2
+ usage >&2
exit 1
fi
if [ -z "$VERSION" ]; then
echo "$0: version argument is mandatory" >&2
+ usage >&2
exit 1
fi
echo $VERSION | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' > /dev/null
-if [ ! $? -eq 0 ]; then
+if [ $? -ne 0 ]; then
echo "$0: bad version format -- $VERSION" >&2
+ usage >&2
exit 1
fi
@@ -105,14 +109,16 @@ set -e
# update the "latest" repositories to the new build. Should be used as a callback in
# function visitVersions
# 1/ the path
-# 2/ the version of interrest
-# 3/ the currently visited major version (format x, where x is an integer)
-# 4/ the currently visited minor version (format x.y, where x and y are integer)
-# 5/ the currently visited micro version (format x.y.z, where x, y and z are integer)
-# 6/ the most recent major version in the given $1 path (format x, where x is an integer)
-# 7/ the most recent minor version in the currently visited major version (format x.y, where x and y are integer)
-# 8/ the most recent micro version in the currently visited minor version (format x.y.z, where x, y and z are integer)
-# 9/ the most recent build version in the currently visited micro version (format x.y.z-TYYYYMMDD-HHMM, where x, y and z
+# 2/ the version of interrest
+# 3/ the currently visited major version (an integer)
+# 4/ the currently visited minor version (an integer)
+# 5/ the currently visited micro version (an integer)
+# 6/ the currently visited build (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)
+# 7/ the most recent major version in the given $1 path (an integer)
+# 8/ the most recent minor version in the currently visited major version (an integer)
+# 9/ the most recent micro version in the currently visited minor version (an integer)
+# 10/ 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)
updateLatestRedirections() {
local path=$1
@@ -120,12 +126,13 @@ updateLatestRedirections() {
local visitedMajor=$3
local visitedMinor=$4
local visitedMicro=$5
- local latestMajor=$6
- local latestMinor=$7
- local latestMicro=$8
- local latestBuild=$9
+ local visitedBuild=$6
+ local latestMajor=$7
+ local latestMinor=$8
+ local latestMicro=$9
+ local latestBuild=${10}
- local updateSiteURL="$EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$latestBuild"
+ local updateSiteURL="$EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$latestBuild"
local nextMajor="$(($visitedMajor+1)).0.0"
local nextMinor="$visitedMajor.$(($visitedMinor+1)).0"
@@ -134,27 +141,27 @@ updateLatestRedirections() {
if [ $(compareOSGIVersions $versionToPublish "$visitedMajor.$visitedMinor.$visitedMicro") -ge 0 ]; then
if [ $(compareOSGIVersions $versionToPublish $nextMicro) -lt 0 ]; then
local stream="$visitedMajor.$visitedMinor.$visitedMicro"
- echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$stream/latest"
- createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $BUILD_TYPE build"
+ echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$stream/latest"
+ createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $NIGHTLY build"
fi
- if [ $visitedMicro = $latestMicro ]; then
+ if [ "$visitedMicro" -eq "$latestMicro" ]; then
if [ $(compareOSGIVersions $versionToPublish $nextMinor) -lt 0 ]; then
local stream="$visitedMajor.$visitedMinor.x"
- echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$stream/latest"
- createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $BUILD_TYPE build"
+ echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$stream/latest"
+ createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $NIGHTLY build"
fi
- if [ $visitedMinor = $latestMinor ]; then
+ if [ "$visitedMinor" -eq "$latestMinor" ]; then
if [ $(compareOSGIVersions $versionToPublish $nextMajor) -lt 0 ]; then
local stream="$visitedMajor.x"
- echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$stream/latest"
- createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $BUILD_TYPE build"
+ echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$stream/latest"
+ createRedirect "$path/$stream/latest" "$updateSiteURL" "EMF Compare latest $stream $NIGHTLY build"
fi
- if [ $visitedMajor = $latestMajor ]; then
- echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/latest"
- createRedirect "$path/latest" "$updateSiteURL" "EMF Compare latest $BUILD_TYPE build"
+ if [ "$visitedMajor" -eq "$latestMajor" ]; then
+ echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/latest"
+ createRedirect "$path/latest" "$updateSiteURL" "EMF Compare latest $NIGHTLY build"
fi
fi
fi
@@ -178,17 +185,17 @@ export MAJOR_STREAM=$(majorStream "$VERSION")
export BUILD_TIMESTAMP=$(buildTimestamp "$BUILD_ID")
# The full version for this build, e.g. 0.9.0-N20131015-070707
-export FULL_VERSION="${VERSION}-${BUILD_TYPE_PREFIX}${BUILD_TIMESTAMP}"
+export FULL_VERSION="${VERSION}-${NIGHTLY_PREFIX}${BUILD_TIMESTAMP}"
# The root folder where all the builds of the same type as this one
# are published
-export NIGHTLY_PATH="$EMF_COMPARE_UPDATES_ROOT/$BUILD_TYPE"
+export NIGHTLY_PATH="$EMF_COMPARE_UPDATES_ROOT/$NIGHTLY"
# The folder for this particular build
export UPDATE_SITE_PATH=
# The URL on which this particular build will be made available
-export UPDATE_SITE_URL="$EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$FULL_VERSION"
+export UPDATE_SITE_URL="$EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$FULL_VERSION"
######################################################################
# Publish the build
@@ -206,35 +213,35 @@ env | sort > "$NIGHTLY_PATH/$FULL_VERSION/build_env.txt"
echo "Adding $UPDATE_SITE_URL to composites repositories:"
# add a link for the $VERSION (e.g. "1.2.0" => "1.2.0-NYYYYMMDD-HHMM")
-echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$VERSION"
+echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$VERSION"
composite-repository \
-location "$NIGHTLY_PATH/$VERSION" \
-add "$UPDATE_SITE_URL" \
- -repositoryName "EMF Compare $VERSION $BUILD_TYPE builds"
+ -repositoryName "EMF Compare $VERSION $NIGHTLY builds"
createP2Index "$NIGHTLY_PATH/$VERSION"
# add a link for the $MINOR_STREAM (e.g. "1.2.x" => "1.2.0-NYYYYMMDD-HHMM")
-echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$MINOR_STREAM"
+echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$MINOR_STREAM"
composite-repository \
-location "$NIGHTLY_PATH/$MINOR_STREAM" \
-add "$UPDATE_SITE_URL" \
- -repositoryName "EMF Compare $MINOR_STREAM $BUILD_TYPE builds"
+ -repositoryName "EMF Compare $MINOR_STREAM $NIGHTLY builds"
createP2Index "$NIGHTLY_PATH/$MINOR_STREAM"
# add a link for the $MAJOR_STREAM (e.g. "1.x" => "1.2.0-NYYYYMMDD-HHMM")
-echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE/$MAJOR_STREAM"
+echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY/$MAJOR_STREAM"
composite-repository \
-location "$NIGHTLY_PATH/$MAJOR_STREAM" \
-add "$UPDATE_SITE_URL" \
- -repositoryName "EMF Compare $MAJOR_STREAM $BUILD_TYPE builds"
+ -repositoryName "EMF Compare $MAJOR_STREAM $NIGHTLY builds"
createP2Index "$NIGHTLY_PATH/$MAJOR_STREAM"
# add a link for all nightly list
-echo " $EMF_COMPARE_UPDATES_BASE_URL/$BUILD_TYPE"
+echo " $EMF_COMPARE_UPDATES_BASE_URL/$NIGHTLY"
composite-repository \
-location "$NIGHTLY_PATH" \
-add "$UPDATE_SITE_URL" \
- -repositoryName "EMF Compare $BUILD_TYPE builds"
+ -repositoryName "EMF Compare $NIGHTLY builds"
createP2Index "$NIGHTLY_PATH"
# Setup or update the redirects (implemented as composite repos)

Back to the top