Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Williams2015-02-05 22:51:05 +0000
committerDavid Williams2015-02-05 22:51:05 +0000
commita313409fd81307a98ae5ba212d3faf4690fc8d4a (patch)
treef5977a947c019bfd4f0e75a4c950435234f836ff
parent115d147f542bfcfeeba452946993c2f2578e85a8 (diff)
downloadeclipse.platform.releng.aggregator-a313409fd81307a98ae5ba212d3faf4690fc8d4a.tar.gz
eclipse.platform.releng.aggregator-a313409fd81307a98ae5ba212d3faf4690fc8d4a.tar.xz
eclipse.platform.releng.aggregator-a313409fd81307a98ae5ba212d3faf4690fc8d4a.zip
Bug 457767 - "computeUpdateURL.php" is incorrect for maintenance RCs
-rw-r--r--eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLs.php113
-rw-r--r--eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLsTest.php30
2 files changed, 103 insertions, 40 deletions
diff --git a/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLs.php b/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLs.php
index c37b9e5fb..a966bfaa1 100644
--- a/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLs.php
+++ b/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLs.php
@@ -1,64 +1,97 @@
<?php
-// This snippet must some before the "repository URLs" as is it used to
+// This snippet must some before the "repository URLs" as is it used to
// "compute" the proper URLs for the various streams and types of builds.
-// TODO: better to have this as function ... but since there are several
-// "outputs", as-is, would take some rethinking?
- $pos = strpos($BUILD_ID, "RC");
- if ($pos === false) {
- $isRC = false;
- } else {
- $isRC = true;
- }
+// It requires, for following variables to have already been defined in outter script:
+// $BUILD_ID, $STREAM_MAJOR, $STREAM_MINOR, $BUILD_TYPE, $TIMESTAMP
- // We expect $BUILD_ID to be defined in buildproperties.php
- // But it can be defined several times in reference URI, such as once in directory name,
- // and once in filename. We want the directory-like part.
- // And to complicate things, in S and R builds, the segment is no longer BUILD_ID,
- // but a more complicated concatenation.
- if ($BUILD_TYPE === "M" && $isRC ) {
- $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."milestones";
- }
- else {
- if ($BUILD_TYPE === "N" || $BUILD_TYPE === "I" || $BUILD_TYPE === "M" || $BUILD_TYPE === "P" || $BUILD_TYPE === "X" || $BUILD_TYPE === "Y") {
- $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."-".$BUILD_TYPE."-"."builds";
+// It "outputs" two values:
+// $STREAM_REPO_URL
+// $$BUILD_REPO_URL
+
+// "RCs" have complicated rules, but in short:
+// RC's for an initial release (in June) go from 4.x-M-build repos to 4xmilestone repos
+// RC's for SRs "stay" in the 4.x-M-build repo. And, no easy way to tell if service release,
+// from the build id alone. The hard way is to part the first "digit groups" of build id, and,
+// if service field is 0 (or does not exist) then it is not a service release.
+
+
+// checking for existence is especially important for BUILD_REPOs, since they might have been removed.
+// but we do it also for sanity check.
+// relative patch can be either 3 or 4 "up", depending on if on downloads, or build machine.
+// either can be used to "prove existence".
+// We define them here, but used in "main", outter script.
+$relativePath4="../../../..";
+$relativePath3="../../..";
+
+
+function isSRRC ( $buildid ) {
+ $SRPATTERN="/([0-9]+)\\.([0-9]+)\\.([1-9]+)RC[1-4]/";
+ return (preg_match($SRPATTERN, $buildid));
+}
+
+function isRRC ( $buildid ) {
+ $RPATTERN="/([0-9]+)\\.([0-9]+)((\\.0)?)RC[1-4]/";
+ return (preg_match($RPATTERN, $buildid));
+}
+
+function computeSTREAM_REPO_NAME () {
+ global $BUILD_ID, $BUILD_TYPE, $STREAM_MAJOR, $STREAM_MINOR;
+ // We expect $BUILD_ID to be defined in buildproperties.php
+ // But it can be defined several times in reference URI, such as once in directory name,
+ // and once in filename. We want the directory-like part.
+ // And to complicate things, in S and R builds, the segment is no longer BUILD_ID,
+ // but a more complicated concatenation.
+ if ($BUILD_TYPE === "M" && isSRRC($BUILD_ID)) {
+ $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."-"."$BUILD_TYPE"."-builds";
} else {
- if ($BUILD_TYPE === "S") {
+ if ($BUILD_TYPE === "M" && isRRC($BUILD_ID)) {
$STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."milestones";
} else {
- if ($BUILD_TYPE === "R") {
- $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR;
- }
- else {
- echo "Unexpected value of BUILD_TYPE: $BUILD_TYPE. <br />";
- // We will make an assumption that might work.
+ if ($BUILD_TYPE === "N" || $BUILD_TYPE === "I" || $BUILD_TYPE === "M" || $BUILD_TYPE === "P" || $BUILD_TYPE === "X" || $BUILD_TYPE === "Y") {
$STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."-".$BUILD_TYPE."-"."builds";
+ } else {
+ if ($BUILD_TYPE === "S") {
+ $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."milestones";
+ } else {
+ if ($BUILD_TYPE === "R") {
+ $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR;
+ }
+ else {
+ echo "Unexpected value of BUILD_TYPE: $BUILD_TYPE. <br />\n";
+ // We will make an assumption that might work.
+ $STREAM_REPO_NAME=$STREAM_MAJOR.".".$STREAM_MINOR."-".$BUILD_TYPE."-"."builds";
+ }
+ }
}
}
}
- }
- $STREAM_REPO_URL="http://download.eclipse.org/eclipse/updates/".$STREAM_REPO_NAME;
+ return $STREAM_REPO_NAME;
+}
+
+function computeSTREAM_REPO_URL () {
+ $STREAM_REPO_URL="http://download.eclipse.org/eclipse/updates/".computeSTREAM_REPO_NAME ();
+ return $STREAM_REPO_URL;
+}
+function computeBUILD_REPO_URL () {
+ global $BUILD_ID, $BUILD_TYPE, $TIMESTAMP ;
// There are two types of M builds, some RCs, some not.
- if ($BUILD_TYPE === "N" || $BUILD_TYPE === "I" || $BUILD_TYPE === "P" || $BUILD_TYPE === "X" || $BUILD_TYPE === "Y" || ($BUILD_TYPE === "M" && ! $isRC)) {
- $BUILD_REPO_NAME=$STREAM_REPO_NAME."/".$BUILD_ID;
+ if ($BUILD_TYPE === "N" || $BUILD_TYPE === "I" || $BUILD_TYPE === "P" || $BUILD_TYPE === "X" || $BUILD_TYPE === "Y" || $BUILD_TYPE === "M" && ! ((isSRRC($BUILD_ID)) || isRRC($BUILD_ID))) {
+ $BUILD_REPO_NAME=computeSTREAM_REPO_NAME ()."/".$BUILD_ID;
} else {
$timestamp = str_replace('-', '', $TIMESTAMP);
- if ($BUILD_TYPE === "S" || $BUILD_TYPE === "R" || ($BUILD_TYPE === "M" && $isRC)) {
- $BUILD_REPO_NAME=$STREAM_REPO_NAME."/".$BUILD_TYPE."-".$BUILD_ID."-".$timestamp;
+ if ($BUILD_TYPE === "S" || $BUILD_TYPE === "R" || ($BUILD_TYPE === "M" && (isSRRC($BUILD_ID) || isRRC($BUILD_ID)))) {
+ $BUILD_REPO_NAME=computeSTREAM_REPO_NAME ()."/".$BUILD_TYPE."-".$BUILD_ID."-"."$timestamp";
} else {
echo "Unexpected value of BUILD_TYPE: $BUILD_TYPE. <br />\n";
// We will make an assumption that might work.
- $BUILD_REPO_NAME=$STREAM_REPO_NAME."/".$BUILD_ID;
+ $BUILD_REPO_NAME=computeSTREAM_REPO_NAME ()."/".$BUILD_ID;
}
}
$BUILD_REPO_URL="http://download.eclipse.org/eclipse/updates/".$BUILD_REPO_NAME;
- // checking for existence is especially important for BUILD_REPOs, since they might have been removed.
- // but we do it here too for sanity check.
- // relative patch can be either 3 or 4 "up", depending on if on downloads, or build machine.
- // either can be used to "prove existence".
- $relativePath4="../../../..";
- $relativePath3="../../..";
+ return $BUILD_REPO_URL;
+}
diff --git a/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLsTest.php b/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLsTest.php
new file mode 100644
index 000000000..ab1bcecc7
--- /dev/null
+++ b/eclipse.platform.releng.tychoeclipsebuilder/eclipse/publishingFiles/staticDropFiles/computeRepoURLsTest.php
@@ -0,0 +1,30 @@
+<?
+
+include "computeRepoURLs.php";
+
+function displayresults() {
+global $BUILD_ID, $BUILD_TYPE, $STREAM_MAJOR, $STREAM_MINOR, $TIMESTAMP;
+echo "BUILD_ID: $BUILD_ID\n";
+echo "BUILD_TYPE: $BUILD_TYPE\n";
+echo "STREAM_MAJOR: $STREAM_MAJOR\n";
+echo "STREAM_MINOR: $STREAM_MINOR\n";
+
+echo "STREAM_REPO_URL: ".computeSTREAM_REPO_URL() ."\n";
+echo "BUILD_REPO_URL: ".computeBUILD_REPO_URL()."\n";
+}
+
+
+$BUILD_ID="4.4.1RC3";
+$BUILD_TYPE="M";
+$STREAM_MAJOR=4;
+$STREAM_MINOR=4;
+$TIMESTAMP="20150202-1200";
+
+displayResults();
+
+$BUILD_ID="4.4RC3";
+
+displayResults();
+
+$BUILD_ID="M20150202-0800";
+displayResults(); \ No newline at end of file

Back to the top