|
Line 0
Link Here
|
|
|
1 |
<?php |
| 2 |
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); |
| 3 |
|
| 4 |
ob_start(); |
| 5 |
|
| 6 |
/* config */ |
| 7 |
$pre = "../"; |
| 8 |
include $pre . "includes/header.php"; |
| 9 |
|
| 10 |
$dls = array( |
| 11 |
"SDK (Runtime, Source)" => "SDK", |
| 12 |
"Runtime" => "runtime", |
| 13 |
"Examples" => "examples", |
| 14 |
"Automated Tests" => "automated-tests" |
| 15 |
); |
| 16 |
|
| 17 |
$trim_projects = getProjectArray(); |
| 18 |
$proj = (preg_match("/^(?:" . join("|", $trim_projects) . ")$/", $_GET["proj"]) ? $_GET["proj"] : $trim_projects[0]); |
| 19 |
|
| 20 |
$filePre = array("emft-$proj", "emft-$proj", "emft-$proj", "emft-$proj"); // file prefixes - also defines the DL image to use, and image alt tag |
| 21 |
|
| 22 |
$rssfeed = ""; |
| 23 |
|
| 24 |
$debug = -1; |
| 25 |
$hadLoadDirSimpleError = 1; //have we echoed the loadDirSimple() error msg yet? if 1, omit error; if 0, echo at most 1 error |
| 26 |
$sortBy = (preg_match("/^(date)$/", $_GET["sortBy"], $regs) ? $regs[1] : ""); |
| 27 |
$showAll = (preg_match("/^(1)$/", $_GET["showAll"], $regs) ? $regs[1] : "0"); |
| 28 |
$showMax = (preg_match("/^(\d+)$/", $_GET["showMax"], $regs) ? $regs[1] : ($sortBy == "date" ? "10" : "5")); |
| 29 |
$doRefreshPage = false; |
| 30 |
$debug_echoPWD = 0; // set 0 to hide (for security purposes!) |
| 31 |
|
| 32 |
$PWD = getPWD("$proj/downloads/drops/"); // see scripts.php |
| 33 |
$buildOptionsFile = "../build.options.txt"; // read only |
| 34 |
|
| 35 |
if (preg_match("/(?:emf|fullmoon)\./", $_SERVER["HTTP_HOST"])) //internal |
| 36 |
{ |
| 37 |
$downloadScript = "../../../technology/emft/scripts/download.php?dropFile="; |
| 38 |
$downloadPre = "../../.."; |
| 39 |
} |
| 40 |
else // all others |
| 41 |
{ |
| 42 |
$downloadScript = "http://www.eclipse.org/downloads/download.php?file="; |
| 43 |
$downloadPre = ""; |
| 44 |
} |
| 45 |
/* end config */ |
| 46 |
|
| 47 |
print "<div id=\"midcolumn\">\n"; |
| 48 |
|
| 49 |
print "<div class=\"homeitem3col\">\n"; |
| 50 |
print "<h3>EMFT subproject selection</h3>\n"; |
| 51 |
print doSelectProject(); |
| 52 |
print "</div>\n"; |
| 53 |
|
| 54 |
if (($options = loadOptionsFromFile($buildOptionsFile)) && is_array($options["Branch"])) |
| 55 |
{ |
| 56 |
$buildTypes = getBuildTypes($options); |
| 57 |
} |
| 58 |
|
| 59 |
$builds = getBuildsFromDirs(); |
| 60 |
if ($sortBy != "date") |
| 61 |
{ |
| 62 |
$builds = reorderArray($builds, $buildTypes); |
| 63 |
} |
| 64 |
else |
| 65 |
{ |
| 66 |
krsort($builds); |
| 67 |
} |
| 68 |
|
| 69 |
if (sizeof($builds) == 0) |
| 70 |
{ |
| 71 |
print "<div class=\"homeitem3col\">\n"; |
| 72 |
print "<h3>${rssfeed}Builds</h3>\n"; |
| 73 |
print "<ul class=\"releases\">\n"; |
| 74 |
print "<li><i><b>Error!</b></i> No builds found on this server!</li>"; |
| 75 |
print "</ul>\n"; |
| 76 |
print "</div>\n"; |
| 77 |
} |
| 78 |
|
| 79 |
if ($sortBy != "date") |
| 80 |
{ |
| 81 |
$c = 0; |
| 82 |
foreach ($builds as $branch => $types) |
| 83 |
{ |
| 84 |
foreach ($types as $type => $IDs) |
| 85 |
{ |
| 86 |
print "<div class=\"homeitem3col\">\n"; |
| 87 |
print "<h3>$rssfeed" . $buildTypes[$branch][$type] . "s</h3>\n"; |
| 88 |
print "<ul class=\"releases\">\n"; |
| 89 |
$i = 0; |
| 90 |
foreach ($IDs as $ID) |
| 91 |
{ |
| 92 |
print outputBuild($branch, $ID, $c++); |
| 93 |
$i++; |
| 94 |
|
| 95 |
if (!$showAll && $i == $showMax && $i < sizeof($IDs)) |
| 96 |
{ |
| 97 |
print showToggle($showAll, $showMax, $sortBy, sizeof($IDs)); |
| 98 |
break; |
| 99 |
} |
| 100 |
else if ($showAll && sizeof($IDs) > $showMax && $i == sizeof($IDs)) |
| 101 |
{ |
| 102 |
print showToggle($showAll, $showMax, $sortBy, sizeof($IDs)); |
| 103 |
} |
| 104 |
} |
| 105 |
print "</ul>\n"; |
| 106 |
print "</div>\n"; |
| 107 |
} |
| 108 |
} |
| 109 |
} |
| 110 |
else if ($sortBy == "date") |
| 111 |
{ |
| 112 |
print "<div class=\"homeitem3col\">\n"; |
| 113 |
print "<a name=\"latest\"></a><h3>${rssfeed}Latest Builds</h3>\n"; |
| 114 |
print "<ul class=\"releases\">\n"; |
| 115 |
$c = 0; |
| 116 |
foreach ($builds as $rID => $rbranch) |
| 117 |
{ |
| 118 |
$ID = preg_replace("/^(\d{12})([IMNRS])$/", "$2$1", $rID); |
| 119 |
$branch = preg_replace("/.$/", "", $rbranch); |
| 120 |
print outputBuild($branch, $ID, $c++); |
| 121 |
|
| 122 |
if (!$showAll && $c == $showMax && $c < sizeof($builds)) |
| 123 |
{ |
| 124 |
print showToggle($showAll, $showMax, $sortBy, sizeof($builds)); |
| 125 |
break; |
| 126 |
} |
| 127 |
else if ($showAll && sizeof($builds) > $showMax && $c == sizeof($builds)) |
| 128 |
{ |
| 129 |
print showToggle($showAll, $showMax, $sortBy, sizeof($builds)); |
| 130 |
} |
| 131 |
} |
| 132 |
print "</ul>\n"; |
| 133 |
print "</div>\n"; |
| 134 |
} |
| 135 |
|
| 136 |
if ($doRefreshPage) |
| 137 |
{ ?> |
| 138 |
<script type="text/javascript"> |
| 139 |
setTimeout('document.location.reload()', 60*1000); // refresh every 60 seconds if there's a build in progress |
| 140 |
</script> |
| 141 |
<?php } |
| 142 |
|
| 143 |
doLanguagePacks($proj); ?> |
| 144 |
<div class="homeitem3col"> |
| 145 |
<h3>Questions?</h3> |
| 146 |
<p>If you have problems downloading the drops, contact the <a href="mailto:webmaster@eclipse.org">webmaster</a>.</p> |
| 147 |
<p>These are the minimum required downloads for using EMFT:</p> |
| 148 |
<ul> |
| 149 |
<li>To use <b class="emft">EMFT</b> alone, you require both the EMFT & <a href="/emf/download/">EMF</a> Runtimes.</li> |
| 150 |
<li>To use <b class="emft">EMFT</b> w/ XSD models, you require three Runtimes: EMFT, <a href="/emf/download/">EMF</a> & <a href="/emf/download/">XSD</a>.</li> |
| 151 |
</ul> |
| 152 |
<p>All downloads are provided under the terms and conditions of the <a href="http://www.eclipse.org/legal/epl/notice.html">Eclipse Foundation Software User Agreement</a> unless otherwise specified.</p> |
| 153 |
</div> |
| 154 |
</div> |
| 155 |
|
| 156 |
<?php |
| 157 |
|
| 158 |
print "<div id=\"rightcolumn\">\n"; |
| 159 |
print "<div class=\"sideitem\">\n"; |
| 160 |
print "<h6>Sort</h6>\n"; |
| 161 |
$newsort = ($sortBy == "date" ? "type" : "date"); |
| 162 |
print "<ul>\n"; |
| 163 |
print "<li><a href=\"?showAll=$showAll&showMax=$showMax&sortBy=$newsort&proj=$proj\">by $newsort</a></li>\n"; |
| 164 |
print "</ul>\n"; |
| 165 |
print "</div>\n"; |
| 166 |
print "</div>\n"; |
| 167 |
|
| 168 |
$html = ob_get_contents(); |
| 169 |
ob_end_clean(); |
| 170 |
|
| 171 |
$pageTitle = "EMFT - Downloads"; |
| 172 |
$pageKeywords = ""; // TODO: add something here |
| 173 |
$pageAuthor = "Neil Skrypuch"; |
| 174 |
|
| 175 |
# Generate the web page |
| 176 |
$App->AddExtraHtmlHeader('<link rel="stylesheet" type="text/css" href="' . $pre . 'includes/downloads.css"/>' . "\n"); |
| 177 |
$App->AddExtraHtmlHeader('<script src="' . $pre . 'includes/downloads.js" type="text/javascript"></script>' . "\n"); //ie doesn't understand self closing script tags, and won't even try to render the page if you use one |
| 178 |
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| 179 |
|
| 180 |
/************************** METHODS *****************************************/ |
| 181 |
|
| 182 |
function reorderArray($arr, $buildTypes) |
| 183 |
{ |
| 184 |
// the first dimension's order is preserved (kept as it is in the config file) |
| 185 |
// sort the second dimension using the IMNRS order in $buildTypes |
| 186 |
// rsort the third dimension |
| 187 |
|
| 188 |
$new = array(); |
| 189 |
foreach ($buildTypes as $br => $types) |
| 190 |
{ |
| 191 |
foreach ($types as $bt => $names) |
| 192 |
{ |
| 193 |
if (array_key_exists($br, $arr) && array_key_exists($bt, $arr[$br]) && is_array($arr[$br][$bt])) |
| 194 |
{ |
| 195 |
$new[$br][$bt] = $arr[$br][$bt]; |
| 196 |
rsort($new[$br][$bt]); |
| 197 |
} |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
return $new; |
| 202 |
} |
| 203 |
|
| 204 |
function getBuildsFromDirs() // massage the builds into more useful structures |
| 205 |
{ |
| 206 |
global $PWD, $sortBy; |
| 207 |
|
| 208 |
$branchDirs = loadDirSimple($PWD, ".*", "d"); |
| 209 |
$buildDirs = array(); |
| 210 |
|
| 211 |
foreach ($branchDirs as $branch) |
| 212 |
{ |
| 213 |
if ($branch != "OLD") |
| 214 |
{ |
| 215 |
$buildDirs[$branch] = loadDirSimple("$PWD/$branch", "[IMNRS]\d{12}", "d"); |
| 216 |
} |
| 217 |
} |
| 218 |
|
| 219 |
$builds_temp = array(); |
| 220 |
foreach ($buildDirs as $br => $dirList) |
| 221 |
{ |
| 222 |
foreach ($dirList as $dir) |
| 223 |
{ |
| 224 |
$ty = substr($dir, 0, 1); //first char |
| 225 |
|
| 226 |
if ($sortBy != "date") |
| 227 |
{ |
| 228 |
$builds_temp[$br][$ty][] = $dir; |
| 229 |
} |
| 230 |
else |
| 231 |
{ |
| 232 |
$dttm = substr($dir, 1); // last 12 digits |
| 233 |
$a = $dttm . $ty; |
| 234 |
$b = $br . $ty; |
| 235 |
|
| 236 |
$builds_temp[$a] = $b; |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
return $builds_temp; |
| 242 |
} |
| 243 |
|
| 244 |
function getBuildTypes($options) |
| 245 |
{ |
| 246 |
$arr = array(); |
| 247 |
foreach ($options["Branch"] as $br => $branch) |
| 248 |
{ |
| 249 |
foreach ($options["BuildType"] as $bt => $buildType) |
| 250 |
{ |
| 251 |
$v = getValueFromOptionsString($branch, "value"); |
| 252 |
if (!array_key_exists($v, $arr)) |
| 253 |
{ |
| 254 |
$arr[$v] = array(); |
| 255 |
} |
| 256 |
if (preg_match("/^(.+)=([^\|]+)(?:\|selected)?$/", $buildType, $regs)) |
| 257 |
{ |
| 258 |
// [2.0][N] |
| 259 |
$arr[$v][$regs[2]] = "$v $regs[1] Build"; |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
|
| 264 |
return $arr; |
| 265 |
} |
| 266 |
|
| 267 |
function getValueFromOptionsString($opt, $nameOrValue) |
| 268 |
{ |
| 269 |
if (preg_match("/^(.+)=([^\|]+)(?:\|selected)?$/", $opt, $regs)) |
| 270 |
{ |
| 271 |
return (preg_match("/^(?:name|0)$/", $nameOrValue) ? $regs[1] : $regs[2]); |
| 272 |
} |
| 273 |
} |
| 274 |
|
| 275 |
function loadOptionsFromFile($file) |
| 276 |
{ |
| 277 |
return (is_readable($file) ? loadOptionsFromArray(file($file)) : array()); |
| 278 |
} |
| 279 |
|
| 280 |
function loadOptionsFromArray($sp) |
| 281 |
{ |
| 282 |
foreach ($sp as $s) |
| 283 |
{ |
| 284 |
if (preg_match("/^[^#].{2,}/", $s)) |
| 285 |
{ |
| 286 |
if (preg_match("/\[([a-zA-Z_]+)(\|reversed)?\]/", $s, $matches)) // section starts |
| 287 |
{ |
| 288 |
$doSection = $matches[1]; |
| 289 |
|
| 290 |
if ($matches[2] == "|reversed") //FIXME: reversed does nothing right now, apparently it's supposed to work |
| 291 |
{ |
| 292 |
$options[$doSection]["reversed"] = true; |
| 293 |
} |
| 294 |
} |
| 295 |
else |
| 296 |
{ |
| 297 |
$options[$doSection][] = trim($s); //TODO: this looks like a bug, $doSection could be "" |
| 298 |
} |
| 299 |
} |
| 300 |
} |
| 301 |
|
| 302 |
return $options; |
| 303 |
} |
| 304 |
|
| 305 |
function IDtoDateStamp($ID, $style) // given N200402121441, return date("D, j M Y -- H:i (O)") |
| 306 |
{ |
| 307 |
$styles = array('Y/m/d H:i', "D, j M Y -- H:i (O)", 'Y/m/d'); |
| 308 |
if (preg_match("/(\d{4})(\d\d)(\d\d)(?:_)?(\d\d)(\d\d)/", $ID, $m)) |
| 309 |
{ |
| 310 |
$ts = mktime($m[4], $m[5], 0, $m[2], $m[3], $m[1]); |
| 311 |
return date($styles[$style], $ts); |
| 312 |
} |
| 313 |
|
| 314 |
return ""; |
| 315 |
} |
| 316 |
|
| 317 |
function createFileLinks($dls, $PWD, $branch, $ID, $pre2, $filePre, $ziplabel = "") // the new way - use a ziplabel pregen'd from a dir list! |
| 318 |
{ |
| 319 |
$uu = 0; |
| 320 |
$echo_out = ""; |
| 321 |
|
| 322 |
if (!$ziplabel) |
| 323 |
{ |
| 324 |
$zips_in_folder = loadDirSimple("$PWD/$branch/$ID/", "(\.zip)", "f"); |
| 325 |
// for testing, you can find a list of files like this: |
| 326 |
// `find /home/www-data/emf-build/tools/emf/downloads/drops/2.0.1 -type f -maxdepth 2 -name *.zip -name *emf-sdo-xsd-SDK*` |
| 327 |
|
| 328 |
$ziplabel = preg_replace("/(.+)\-([^\-]+)(\.zip)/", "$2", $zips_in_folder[0]); // grab first entry |
| 329 |
} |
| 330 |
|
| 331 |
$echo_out .= "<li><img src=\"/emft/images/dl-emft.gif\" alt=\"$filePre[0]\"/> $filePre[0]\n<ul>\n"; |
| 332 |
foreach ($dls as $label => $u) |
| 333 |
{ |
| 334 |
$echo_out .= "<li>"; |
| 335 |
if ($u) |
| 336 |
{ |
| 337 |
$u = "-$u"; |
| 338 |
} |
| 339 |
|
| 340 |
if (is_file("$PWD/$branch/$ID/$pre2$filePre[$uu]$u-$ziplabel.zip")) |
| 341 |
{ |
| 342 |
$echo_out .= fileFound("$PWD/", "$branch/$ID/$pre2$filePre[$uu]$u-$ziplabel.zip", $label); |
| 343 |
} |
| 344 |
else |
| 345 |
{ |
| 346 |
$echo_out .= "..."; |
| 347 |
} |
| 348 |
$echo_out .= "</li>\n"; |
| 349 |
$uu++; |
| 350 |
} |
| 351 |
$echo_out .= "</ul>\n</li>\n"; |
| 352 |
return $echo_out; |
| 353 |
} |
| 354 |
|
| 355 |
function showBuildResults($PWD, $path) // given path to /../downloads/drops/M200402021234/ |
| 356 |
{ |
| 357 |
global $pre, $WWWpre, $proj; |
| 358 |
$mid = "../../../technology/emft/$proj/downloads/drops/"; |
| 359 |
|
| 360 |
$warnings = 0; |
| 361 |
$errors = 0; |
| 362 |
|
| 363 |
$result = ""; |
| 364 |
$icon = ""; |
| 365 |
|
| 366 |
$indexHTML = ""; |
| 367 |
$testResultsPHP = ""; |
| 368 |
|
| 369 |
$link = ""; |
| 370 |
$link2 = ""; |
| 371 |
|
| 372 |
if ($isEMFserver && is_file("$PWD${path}buildlog.txt") && filesize("$PWD${path}buildlog.txt") < (3*1024*1024)) // if the log's too big, don't open it! |
| 373 |
{ |
| 374 |
if (grep("/BUILD FAILED/", "$PWD${path}buildlog.txt")) |
| 375 |
{ |
| 376 |
$icon = "not"; |
| 377 |
$result = "FAILED"; // BUILD |
| 378 |
} |
| 379 |
} |
| 380 |
|
| 381 |
if (is_file("$PWD${path}index.html")) |
| 382 |
{ |
| 383 |
$indexHTML = file_contents("$PWD${path}index.html"); |
| 384 |
$zips = loadDirSimple($PWD . $path, ".zip", "f"); // get files count |
| 385 |
$md5s = loadDirSimple($PWD . $path, ".zip.md5", "f"); // get files count |
| 386 |
|
| 387 |
if ((sizeof($zips) == 4 && sizeof($md5s) == 4)) |
| 388 |
{ |
| 389 |
//check testresults/chkpii/ for results |
| 390 |
//eg: /home/neil/workspace/org.eclipse.emft/releng/common/public_html/technology/emft/jet/downloads/drops/0.7.1/M200609072347/testresults/chkpii/org.eclipse.nls.summary.txt |
| 391 |
if (is_file("$PWD${path}testresults/chkpii/org.eclipse.nls.summary.txt")) |
| 392 |
{ |
| 393 |
$chkpiiResults = file_contents("$PWD${path}testresults/chkpii/org.eclipse.nls.summary.txt"); |
| 394 |
// eg, file contains: |
| 395 |
//htm: 6 E, 0 W |
| 396 |
//xml: 1 E, 1 W |
| 397 |
//properties: 0 E, 2 W |
| 398 |
preg_match_all("/^\S+: (\d+) E, (\d+) W$/m", $chkpiiResults, $regs); |
| 399 |
for ($i = 0; $i < sizeof($regs[0]); $i++) |
| 400 |
{ |
| 401 |
$errors += $regs[1][$i]; |
| 402 |
$warnings += $regs[2][$i]; |
| 403 |
$icon = "not"; |
| 404 |
$link = "$pre$mid${path}testresults/chkpii/org.eclipse.nls.summary.txt"; |
| 405 |
$link2 = "$pre$mid${path}testresults/chkpii/"; |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
if ($icon != "not") |
| 410 |
{ |
| 411 |
//check testResults.php for results |
| 412 |
if (is_file("$PWD${path}testResults.php")) |
| 413 |
{ |
| 414 |
$testResultsPHP = file("$PWD${path}testResults.php"); |
| 415 |
$link2 = "$pre$mid${path}testResults.php"; |
| 416 |
foreach ($testResultsPHP as $tr) |
| 417 |
{ |
| 418 |
if (preg_match("/<td>(\d*)<\/td><td>(\d*)<\/td><\/tr>/", $tr)) |
| 419 |
{ |
| 420 |
$rows = explode("<tr>", $tr); // break into pieces |
| 421 |
foreach ($rows as $r => $row) |
| 422 |
{ |
| 423 |
if (preg_match("/<td>(\d*)<\/td><td>(\d*)<\/td><\/tr>/", $row, $m)) |
| 424 |
{ |
| 425 |
$errors += $m[1]; |
| 426 |
$warnings += $m[2]; |
| 427 |
} |
| 428 |
} |
| 429 |
} |
| 430 |
} |
| 431 |
} |
| 432 |
|
| 433 |
if ($errors) |
| 434 |
{ |
| 435 |
$icon = "not"; |
| 436 |
$result = "COMPILER ERROR"; |
| 437 |
} |
| 438 |
else |
| 439 |
{ |
| 440 |
$icon = ($warnings ? "check-maybe" : "check"); |
| 441 |
$result = ""; |
| 442 |
} |
| 443 |
} |
| 444 |
|
| 445 |
//parse out the check/fail icons in index.html, if we haven't failed already |
| 446 |
if ($icon != "not") |
| 447 |
{ |
| 448 |
if (preg_match("/<font size=\"-1\" color=\"#FF0000\">skipped<\/font>/", $indexHTML)) |
| 449 |
{ |
| 450 |
$result = "Skipped"; |
| 451 |
$icon = "check-maybe"; |
| 452 |
} |
| 453 |
else if (preg_match("/(?:<!-- Examples -->.*FAIL\.gif|FAIL\.gif.*<!-- Automated Tests -->)/s", $indexHTML)) |
| 454 |
{ |
| 455 |
$result = "FAILED"; |
| 456 |
$icon = "not"; |
| 457 |
} |
| 458 |
else if (preg_match("/<!-- Automated Tests -->.*FAIL\.gif.*<!-- Examples -->/s", $indexHTML)) |
| 459 |
{ |
| 460 |
$result = "TESTS FAILED"; |
| 461 |
$icon = "check-tests-failed"; |
| 462 |
} |
| 463 |
} |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
if (!$icon) |
| 468 |
{ |
| 469 |
// display in progress icon & link to log |
| 470 |
$result = "..."; |
| 471 |
$icon = "question"; |
| 472 |
} |
| 473 |
|
| 474 |
global $doRefreshPage; |
| 475 |
if ($isEMFserver && $icon == "question" && is_file("$PWD${path}buildlog.txt") && filesize("$PWD${path}buildlog.txt") < (3*1024*1024)) |
| 476 |
{ |
| 477 |
if ($isEMFserver && grep("/\[start\] start\.sh finished on: /", "$PWD${path}buildlog.txt")) |
| 478 |
{ |
| 479 |
$icon = "not"; //display failed icon - not in progress anymore! |
| 480 |
$result = "FAILED"; // BUILD |
| 481 |
} |
| 482 |
|
| 483 |
if ($result != "FAILED" && strtotime("now") - filemtime("$PWD${path}buildlog.txt") < 7200) |
| 484 |
{ |
| 485 |
$doRefreshPage = true; |
| 486 |
} |
| 487 |
else |
| 488 |
{ |
| 489 |
$mightHavePassed = false; |
| 490 |
if (grep("BUILD SUCCESSFUL", "$PWD${path}buildlog.txt")) |
| 491 |
{ |
| 492 |
$mightHavePassed = true; |
| 493 |
} |
| 494 |
else if (grep("BUILD FAILED", "$PWD${path}buildlog.txt")) |
| 495 |
{ |
| 496 |
$icon = "not"; //display failed icon |
| 497 |
$result = "FAILED"; // BUILD |
| 498 |
} |
| 499 |
|
| 500 |
if ($result != "FAILED" && $mightHavePassed) |
| 501 |
{ |
| 502 |
$result = "Stalled!"; |
| 503 |
$icon = "check-maybe"; |
| 504 |
} |
| 505 |
else if ($result != "FAILED" && !$mightHavePassed) |
| 506 |
{ |
| 507 |
$result = "FAILED"; |
| 508 |
$icon = "not"; |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
|
| 513 |
if (!$link) // return a string with icon, result, and counts (if applic) |
| 514 |
{ |
| 515 |
$link = ($isEMFserver ? "/emft/log-viewer.php?build=$path" : "http://download.eclipse.org/"."$mid${path}buildlog.txt"); |
| 516 |
} |
| 517 |
|
| 518 |
if (!$link2) // link to console log in progress if it exists |
| 519 |
{ |
| 520 |
$ID = substr($path, -14); |
| 521 |
$conlog = "${path}testing/${ID}testing/linux.gtk_consolelog.txt"; |
| 522 |
$testlog = "${path}testResults.php"; |
| 523 |
$link2 = (is_file("$PWD$conlog") ? "$mid$conlog" : (is_file("$PWD$testlog") ? "$mid$testlog" : $link)); |
| 524 |
$result = (is_file("$PWD$conlog") ? "Testing..." : $result); |
| 525 |
} |
| 526 |
$link2 = ($isEMFserver ? "" : "http://download.eclipse.org/").$link2; |
| 527 |
|
| 528 |
$out .= "<a href=\"$link2\">$result"; |
| 529 |
$out .= ($errors == 0 && $warnings == 0) && !$result ? "Success" : ""; |
| 530 |
$out .= ($errors > 0 || $warnings > 0) && $result ? ": " : ""; |
| 531 |
$out .= ($errors > 0 ? "$errors E, $warnings W" : ($warnings > 0 ? "$warnings W" : "")); |
| 532 |
$out .= "</a> <a href=\"$link\"><img src=\"http://www.eclipse.org/emft/images/$icon.gif\" alt=\"$icon\"/></a>"; |
| 533 |
|
| 534 |
return $out; |
| 535 |
} |
| 536 |
|
| 537 |
function fileFound($PWD, $url, $label) //only used once |
| 538 |
{ |
| 539 |
global $pre, $WWWpre, $downloadScript, $downloadPre, $proj; |
| 540 |
|
| 541 |
$mid = "$downloadPre/technology/emft/$proj/downloads/drops/"; // new for www.eclipse.org centralized download.php script |
| 542 |
|
| 543 |
return (is_file("$PWD$url.md5") ? "<div>" . pretty_size(filesize("$PWD$url")) . " (<a href=\"$pre$mid$url.md5\">md5</a>)</div>" : "") . "<a href=\"$downloadScript" . (($downloadPre ? $pre : "") . $mid . $url) . "\">$label</a>"; |
| 544 |
} |
| 545 |
|
| 546 |
function pretty_size($bytes) |
| 547 |
{ |
| 548 |
$sufs = array("B", "K", "M", "G", "T", "P"); //emft shouldn't be larger than 999.9 petabytes any time soon, hopefully |
| 549 |
$suf = 0; |
| 550 |
|
| 551 |
while ($bytes >= 1000) |
| 552 |
{ |
| 553 |
$bytes /= 1024; |
| 554 |
$suf++; |
| 555 |
} |
| 556 |
|
| 557 |
return sprintf("%3.1f%s", $bytes, $sufs[$suf]); |
| 558 |
} |
| 559 |
|
| 560 |
function getProjectArray() //only the projects we have the files for |
| 561 |
{ |
| 562 |
global $pre, $projects; |
| 563 |
$projs = loadDirSimple($pre, ".*", "d"); |
| 564 |
|
| 565 |
return array_merge(array_intersect($projs, $projects)); //array_merge compresses the array indices |
| 566 |
} |
| 567 |
|
| 568 |
function doSelectProject() |
| 569 |
{ |
| 570 |
global $projects, $proj; |
| 571 |
$out = <<<EOHTML |
| 572 |
<form action="index.php" method="get" id="subproject_form"> |
| 573 |
<p> |
| 574 |
<label for="proj">Project: </label> |
| 575 |
<select id="proj" name="proj" onchange="javascript:document.getElementById('subproject_form').submit()"> |
| 576 |
EOHTML; |
| 577 |
|
| 578 |
$p = join("", preg_replace("/^(.+)$/", "<option value=\"$1\">$1</option>\n", getProjectArray())); |
| 579 |
$out .= preg_replace("/<option (value=\"$proj\")>/", "<option selected=\"selected\" $1>", $p); |
| 580 |
|
| 581 |
$out .= <<<EOHTML |
| 582 |
</select> |
| 583 |
<input type="submit" value="Go!"/> |
| 584 |
</p> |
| 585 |
</form> |
| 586 |
EOHTML; |
| 587 |
|
| 588 |
return $out; |
| 589 |
} |
| 590 |
|
| 591 |
function doLanguagePacks($proj) |
| 592 |
{ |
| 593 |
global $downloadScript, $downloadPre; |
| 594 |
|
| 595 |
$zips_in_folder = loadDirSimple("./NLS", "(NLpack.*-$proj.*\.zip)", "f"); |
| 596 |
|
| 597 |
// list all descriptions for subsequent releases, then tie them by index to the release versions and projects below |
| 598 |
$details = array(0 => " |
| 599 |
<p>The language packs contain NL fragments and features for:</p> |
| 600 |
<ul> |
| 601 |
<li>NLpack1 - German, Spanish, French, Italian, Japanese, Korean, Portuguese (Brazil), Traditional Chinese, Simplified Chinese</li> |
| 602 |
<li>NLpack2 - Czech, Hungarian, Polish, Russian</li> |
| 603 |
<li>NLpack2a - Danish, Dutch, Finnish, Greek, Norwegian, Portuguese, Swedish and Turkish</li> |
| 604 |
<li>NLpackBidi - Arabic</li> |
| 605 |
</ul> |
| 606 |
<p>Each language pack zip contains 4 other zips (one for each of the language groups above). Unpack these zips into your Eclipse directory before starting Eclipse.</p>" |
| 607 |
); |
| 608 |
|
| 609 |
// list all projects by version and map to index of the $details array to retrieve the text content |
| 610 |
$detailMappings = array( |
| 611 |
"jet" => array("0.7.0" => 0), |
| 612 |
"ocl" => array("1.0.0" => 0), |
| 613 |
"query" => array("1.0.0" => 0), |
| 614 |
"validation" => array("1.0.0" => 0), |
| 615 |
"transaction" => array("1.0.0" => 0) |
| 616 |
); |
| 617 |
|
| 618 |
if (sizeof($zips_in_folder) > 0) |
| 619 |
{ |
| 620 |
print "<div class=\"homeitem3col\">\n"; |
| 621 |
print "<h3>Language Packs</h3>\n"; |
| 622 |
print "<p>IBM is pleased to contribute translations for this Eclipse Modeling Framework Technology project.</p>\n"; |
| 623 |
|
| 624 |
$versionsDone = array(); |
| 625 |
print "<ul>\n"; |
| 626 |
foreach ($zips_in_folder as $zipfile) |
| 627 |
{ |
| 628 |
$version = explode('-', $zipfile); |
| 629 |
$version = substr($version[3], 0, strpos($version[3], ".zip")); |
| 630 |
$versionX = substr($version, 0, -1) . "x"; |
| 631 |
if (!in_array($version, $versionsDone)) |
| 632 |
{ |
| 633 |
$versionsDone[] = $version; |
| 634 |
$id = "lang" . str_replace(".", "_", $version); |
| 635 |
print "<li>\n"; |
| 636 |
print "<a href=\"javascript:toggle('$id')\" name=\"NLS$versionX\">emft.$proj $versionX Language Packs</a>\n"; |
| 637 |
print "<ul id=\"$id\">\n"; |
| 638 |
print "<li>\n"; |
| 639 |
print $details[$detailMappings[$proj][$version]]; |
| 640 |
print "<p>These translations are based on $proj $version. The NLS translation fragment packs should work with all subsequent $versionX maintenance releases, with any new strings remaining untranslated.</p>"; |
| 641 |
|
| 642 |
$packs = array( |
| 643 |
"$versionX NLS Translation Packs" => "NLpacks-", |
| 644 |
); |
| 645 |
$cols = array( |
| 646 |
"$proj" => "$proj" |
| 647 |
); |
| 648 |
$subcols = array( |
| 649 |
"SDK" => "SDK-", |
| 650 |
"Runtime" => "runtime-" |
| 651 |
); |
| 652 |
$packSuf = "$version.zip"; |
| 653 |
$folder = "NLS/"; |
| 654 |
doNLSLinksList($packs, $cols, $subcols, $packSuf, $folder); |
| 655 |
print "</li>\n"; |
| 656 |
print "</ul>\n"; |
| 657 |
print "</li>\n"; |
| 658 |
} |
| 659 |
} |
| 660 |
print "</ul>\n"; |
| 661 |
print "</div>\n"; |
| 662 |
} |
| 663 |
} |
| 664 |
|
| 665 |
function doNLSLinksList($packs, $cols, $subcols, $packSuf, $folder, $isArchive = false) |
| 666 |
{ |
| 667 |
global $downloadScript, $downloadPre; |
| 668 |
$cnt = 0; |
| 669 |
|
| 670 |
print "<ul class=\"nls\">\n"; |
| 671 |
foreach ($packs as $name => $packPre) |
| 672 |
{ |
| 673 |
print "<li>\n$name\n<ul>\n"; |
| 674 |
foreach ($cols as $alt => $packMid) |
| 675 |
{ |
| 676 |
print "<li>\n<img src=\"http://www.eclipse.org/emft/images/dl-emft.gif\" alt=\"$alt\"/> $alt\n<ul>\n"; |
| 677 |
foreach ($subcols as $alt2 => $packMid2) |
| 678 |
{ |
| 679 |
$dir = "$folder$packPre$packMid-$packMid2$packSuf"; |
| 680 |
$linkpre = ($isArchived && is_file("./$dir") ? "http://archive.eclipse.org" : "http://www.eclipse.org/downloads/download.php?file="); |
| 681 |
print "<li><a href=\"$linkpre/technology/emft/downloads/$dir\">$alt2</a></li>\n"; |
| 682 |
} |
| 683 |
print "</ul>\n</li>\n"; |
| 684 |
} |
| 685 |
print "</ul>\n</li>\n"; |
| 686 |
} |
| 687 |
print "</ul>\n"; |
| 688 |
} |
| 689 |
|
| 690 |
function showToggle($showAll, $showMax, $sortBy, $count) |
| 691 |
{ |
| 692 |
$ret = "<li><a href=\"" . $_SERVER["PHP_SELF"] . "?showAll=" . ($showAll == "1" ? "" : "1") . "&showMax=$showMax&sortBy=$sortBy\">" . ($showAll != "1" ? "show all $count" : "show only $showMax") . "...</a></li>\n"; |
| 693 |
|
| 694 |
return $ret; |
| 695 |
} |
| 696 |
|
| 697 |
function outputBuild($branch, $ID, $c) |
| 698 |
{ |
| 699 |
global $PWD, $isEMFserver, $dls, $filePre, $jdk14testsPWD, $jdk50testsPWD, $testsPWD, $proj; |
| 700 |
$pre2 = (is_dir("$PWD/$branch/$ID/eclipse/$ID/") ? "eclipse/$branch/$ID/" : ""); |
| 701 |
|
| 702 |
$zips_in_folder = loadDirSimple("$PWD/$branch/$ID/", "(\.zip)", "f"); |
| 703 |
// for testing, you can find a list of files like this: |
| 704 |
// `find /home/www-data/emf-build/tools/emf/downloads/drops/2.0.1 -type f -maxdepth 2 -name *.zip -name *emf-sdo-xsd-SDK*` |
| 705 |
$ziplabel = (sizeof($zips_in_folder) < 1) ? $ID : |
| 706 |
preg_replace("/(.+)\-([^\-]+)(\.zip)/", "$2", $zips_in_folder[0]); // grab first entry |
| 707 |
|
| 708 |
// generalize for any relabelled build, thus 2.0.1/M200405061234/*-2.0.2.zip is possible; label = 2.0.2 |
| 709 |
$IDlabel = $ziplabel; |
| 710 |
|
| 711 |
$ret = "<li>\n"; |
| 712 |
$ret .= "<div>" . showBuildResults("$PWD/", "$branch/$ID/") . ($isEMFserver && $summary ? $summary : "") . "</div>"; |
| 713 |
$ret .= "<a href=\"javascript:toggle('r$ID')\"><i>$IDlabel</i> (" . IDtoDateStamp($ID, ($isEMFserver ? 0 : 1)) . ")</a><a name=\"$ID\"> </a> <a href=\"?showAll=1&hlbuild=$ID&proj=$proj#$ID\"><img alt=\"Link to this build\" src=\"../images/link.png\"/></a>"; |
| 714 |
|
| 715 |
$ret .= "<ul id=\"r$ID\"" . (($c == 0 && !isset($_GET["hlbuild"])) || $ID == $_GET["hlbuild"] ? "" : " style=\"display: none\"") . ">\n"; |
| 716 |
$ret .= createFileLinks($dls, $PWD, $branch, $ID, $pre2, $filePre, $ziplabel); |
| 717 |
|
| 718 |
$ret .= $tests; |
| 719 |
$ret .= getBuildArtifacts("$PWD", "$branch/$ID"); |
| 720 |
$ret .= "</ul>\n"; |
| 721 |
$ret .= "</li>\n"; |
| 722 |
|
| 723 |
return $ret; |
| 724 |
} |
| 725 |
|
| 726 |
function getBuildArtifacts($dir, $branchID) |
| 727 |
{ |
| 728 |
global $isEMFserver, $downloadPre; |
| 729 |
|
| 730 |
$deps = array( |
| 731 |
"emf" => "<a href=\"http://www.eclipse.org/emf/\">EMF</a>", |
| 732 |
"eclipse" => "<a href=\"http://www.eclipse.org/eclipse/\">Eclipse</a>" |
| 733 |
); |
| 734 |
$mid = "$downloadPre/technology/emft/downloads/drops/"; |
| 735 |
$file = "$dir/$branchID/build.cfg"; |
| 736 |
$lines = (is_file($file) && is_readable($file) ? file($file) : array()); |
| 737 |
|
| 738 |
foreach ($lines as $z) |
| 739 |
{ |
| 740 |
if (preg_match("/^((?:" . join("|", array_keys($deps)) . ")(?:DownloadURL|File|BuildURL))=(.+)$/", $z, $regs)) |
| 741 |
{ |
| 742 |
$opts[$regs[1]] = $regs[2]; |
| 743 |
} |
| 744 |
} |
| 745 |
|
| 746 |
foreach (array_keys($deps) as $z) |
| 747 |
{ |
| 748 |
$builddir[$z] = $opts["${z}DownloadURL"] . $opts["${z}BuildURL"]; |
| 749 |
$buildID[$z] = (preg_match("/([IMNRS]?\d{8}-?\d{4})$/", $opts["${z}BuildURL"], $regs) ? $regs[1] : ""); |
| 750 |
$buildfile[$z] = $builddir[$z] . "/" . $opts["${z}File"]; |
| 751 |
} |
| 752 |
|
| 753 |
$ret = ""; |
| 754 |
|
| 755 |
if (is_array($builddir) > 0) |
| 756 |
{ |
| 757 |
$details = array( |
| 758 |
"Config File" => "build.cfg", |
| 759 |
"Map File" => "directory.txt", |
| 760 |
"Build Log" => "buildlog.txt" |
| 761 |
); |
| 762 |
|
| 763 |
$ret .= "<li>\n"; |
| 764 |
$ret .= "<img src=\"http://www.eclipse.org/emft/images/dl-deps.gif\" alt=\"Upstream dependencies used to build this driver\"/> Build Dependencies\n"; |
| 765 |
$ret .= "<ul>\n"; |
| 766 |
foreach (array_keys($deps) as $z) |
| 767 |
{ |
| 768 |
$ret .= "<li><div><a href=\"$builddir[$z]\">Build Page</a></div>$deps[$z] <a href=\"$buildfile[$z]\">$buildID[$z]</a></li>\n"; |
| 769 |
} |
| 770 |
$ret .= "</ul>\n"; |
| 771 |
$ret .= "</li>\n"; |
| 772 |
|
| 773 |
$ret .= "<li>\n"; |
| 774 |
$ret .= "<img src=\"http://www.eclipse.org/emft/images/dl-more.gif\" alt=\"More info about this build\"/> Build Details\n"; |
| 775 |
$ret .= "<ul>\n"; |
| 776 |
$ret .= "<li><a href=\"$link$mid${branchID}/testResults.php\">Test Results & Compile Logs</a></li>\n"; |
| 777 |
foreach (array_keys($details) as $label) |
| 778 |
{ |
| 779 |
$details[$label] = preg_replace("/^(.+)$/", "<a href=\"$link$mid$branchID/$1\">$label</a>", $details[$label]); |
| 780 |
} |
| 781 |
$ret .= "<li>" . join(", ", $details) . "</li>\n"; |
| 782 |
$ret .= "</ul>\n"; |
| 783 |
$ret .= "</li>\n"; |
| 784 |
} |
| 785 |
return $ret; |
| 786 |
} |
| 787 |
|
| 788 |
function file_contents($file) //TODO: remove this when we upgrade php to >= 4.3.0 everywhere |
| 789 |
{ |
| 790 |
if (function_exists(file_get_contents)) |
| 791 |
{ |
| 792 |
return file_get_contents($file); |
| 793 |
} |
| 794 |
else |
| 795 |
{ |
| 796 |
return join("", file($file)); |
| 797 |
} |
| 798 |
} |
| 799 |
?> |