tazwok annotate web/index.php @ rev 369

web/index.php: enhance summary
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 26 13:06:36 2011 +0100 (2011-02-26)
parents 3eb1f4e6ba37
children e9a7c6b82fe6
rev   line source
gokhlayeh@186 1 <?php
gokhlayeh@235 2 $version=$_GET["version"];
gokhlayeh@235 3 if (file_exists("conf-$version.php")) {
gokhlayeh@235 4 include("conf-$version.php");
gokhlayeh@186 5 }
gokhlayeh@235 6 else {
gokhlayeh@235 7 if (file_exists("conf.php")) {
gokhlayeh@235 8 include("conf.php");
gokhlayeh@235 9 }
gokhlayeh@235 10 }
gokhlayeh@267 11
gokhlayeh@267 12 function include_and_link($file)
gokhlayeh@267 13 {
gokhlayeh@267 14 global $log_dir, $version;
gokhlayeh@267 15 if (($fp = fopen($file,"r")) === false) return;
gokhlayeh@267 16 while (($pkg = fgets($fp)) !== false) {
gokhlayeh@267 17 $pkg = chop($pkg);
gokhlayeh@267 18 if (file_exists("$log_dir/$pkg.html"))
gokhlayeh@267 19 echo "<a href=\"log.php?version=$version&package=$pkg\">$pkg</a>\n";
gokhlayeh@267 20 else echo "$pkg\n";
gokhlayeh@267 21 }
gokhlayeh@267 22 fclose($fp);
gokhlayeh@267 23 }
gokhlayeh@267 24
gokhlayeh@267 25 function list_last_cooked($dir, $suffix)
gokhlayeh@267 26 {
gokhlayeh@267 27 global $version;
gokhlayeh@267 28 $path=basename($dir);
gokhlayeh@267 29 system("cd $dir && ls -1t *.$suffix | head -20 | \
gokhlayeh@267 30 while read file; do echo -n \$(stat -c '%y' $dir/\$file | \
gokhlayeh@267 31 cut -d. -f1); echo ' <a href=\"download.php?version=$version&package=$path/'\$file'\">'\$file'</a>'; done");
gokhlayeh@267 32 }
gokhlayeh@267 33
gokhlayeh@186 34 ?>
gokhlayeh@186 35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
gokhlayeh@186 36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
gokhlayeh@186 37 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
gokhlayeh@186 38 <head>
gokhlayeh@186 39 <title>SliTaz Build Bot</title>
gokhlayeh@186 40 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
gokhlayeh@186 41 <meta name="description" content="Tazbb web interface" />
pascal@363 42 <?php
pascal@363 43 if (isset($_GET["refresh"]))
pascal@363 44 echo " <meta http-equiv=\"refresh\" content=\""
pascal@363 45 .$_GET["refresh"]."; URL=\""
pascal@363 46 .$_SERVER["REQUEST_URI"].">\n";
pascal@363 47 ?> <meta name="robots" content="index nofollow" />
gokhlayeh@235 48 <link rel="shortcut icon" href="web/favicon.ico" />
gokhlayeh@235 49 <link rel="stylesheet" type="text/css" href="web/slitaz.css" />
gokhlayeh@186 50 </head>
gokhlayeh@235 51 <body>
gokhlayeh@186 52
gokhlayeh@186 53 <!-- Header -->
gokhlayeh@186 54 <div id="header">
gokhlayeh@235 55 <!-- Access -->
gokhlayeh@235 56 <div id="access">
gokhlayeh@235 57 <?php
gokhlayeh@235 58 $versions_list = fopen('repositories.list', 'r');
gokhlayeh@235 59 if($versions_list)
gokhlayeh@235 60 {
gokhlayeh@235 61 $otherversion = '';
gokhlayeh@235 62 while(!feof($versions_list))
gokhlayeh@235 63 {
gokhlayeh@235 64 $otherversion = fgets($versions_list);
gokhlayeh@235 65 echo "<a href=\"?version=$otherversion\">$otherversion</a>";
gokhlayeh@235 66 }
gokhlayeh@235 67 fclose($versions_list);
gokhlayeh@235 68 }
gokhlayeh@235 69 ?>
gokhlayeh@235 70 </div>
gokhlayeh@186 71 <a href="http://bb.slitaz.org/"><img id="logo"
gokhlayeh@235 72 src="web/logo.png"
gokhlayeh@235 73 title="bb.slitaz.org" alt="bb.slitaz.org" /></a>
gokhlayeh@235 74 <p id="titre">#!/Build/Bot/<?php echo $version; ?></p>
gokhlayeh@186 75 </div>
gokhlayeh@186 76
gokhlayeh@186 77 <!-- Content -->
gokhlayeh@235 78 <div id="content-full">
gokhlayeh@186 79
gokhlayeh@235 80 <!-- Block begin -->
gokhlayeh@235 81 <div class="block">
gokhlayeh@235 82 <!-- Nav block begin -->
gokhlayeh@235 83 <div id="block_nav">
gokhlayeh@235 84 <h3><img src="pics/website/development.png" alt="" />Developers</h3>
gokhlayeh@235 85 <ul>
gokhlayeh@235 86 <li><a href="http://www.slitaz.org/en/devel/">Website/devel</a></li>
gokhlayeh@235 87 <li><a href="http://labs.slitaz.org/">Laboratories</a></li>
gokhlayeh@235 88 <li><a href="http://hg.slitaz.org/">Mercurial Repos</a></li>
gokhlayeh@235 89 <li><a href="http://people.slitaz.org/">People Stuff</a></li>
gokhlayeh@235 90 <li><a href="http://scn.slitaz.org/">Community Network</a></li>
gokhlayeh@235 91 </ul>
gokhlayeh@235 92 <!-- Nav block end -->
gokhlayeh@235 93 </div>
gokhlayeh@235 94 <!-- Top block begin -->
gokhlayeh@235 95 <div id="block_top">
gokhlayeh@235 96 <h1>Build Bot</h1>
gokhlayeh@235 97 <p>
gokhlayeh@334 98 Tazwok is a <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
pankso@348 99 Build Bot, it automatically cooks and tests packages. SliTaz
pankso@348 100 <a href="http://pkgs.slitaz.org/">packages</a> are cooked on
pankso@348 101 <a href="http://tank.slitaz.org">Tank</a>, the project main
pankso@348 102 server. This web interface gives the current status of the
pankso@348 103 build bot and the last report about any packages modified by
pankso@348 104 contributors in the Mercurial repositories, aka
gokhlayeh@235 105 <a href="http://hg.slitaz.org/">Hg repos</a>.
gokhlayeh@235 106 </p>
pankso@348 107 <p>
pankso@348 108 Note: Flavors/Iso build logs are named "iso-?flavor",
pankso@348 109 Temporary toolchain logs are named "tmp-toolchain-?package"
pankso@348 110 and check-incoming log is named "incoming".
pankso@348 111 </p>
gokhlayeh@235 112 <!-- Top block end -->
gokhlayeh@235 113 </div>
gokhlayeh@235 114 <!-- Block end -->
gokhlayeh@235 115 </div>
gokhlayeh@235 116
pascal@369 117 <a name="Cooklog"></a>
gokhlayeh@235 118 <h2>Cooklog</h2>
gokhlayeh@186 119
gokhlayeh@186 120 <p>
gokhlayeh@235 121 <form action="log.php" method="get">
gokhlayeh@235 122 <input type="hidden" name="version" value="<?php
gokhlayeh@235 123 echo "$version";
gokhlayeh@235 124 ?>
gokhlayeh@235 125 " />
gokhlayeh@235 126 Show pkg log:<br />
pankso@341 127 <input type="text" name="package" style="width: 320px;" />
gokhlayeh@235 128 <!-- <input type="submit" value="Show" /> -->
pankso@348 129 </form>
gokhlayeh@186 130 </p>
gokhlayeh@186 131
pascal@369 132 <a name="Summary"></a>
gokhlayeh@247 133 <h2>Summary</h2>
pascal@369 134 <img src="http://tank.slitaz.org/pics/rrd/cpu-day.png" title="cpu daily" alt="cpu daily" />
pankso@342 135 <ul>
gokhlayeh@186 136 <?php
pankso@342 137 // Check curent status (update in real time) and display summary.
pascal@349 138 $status = "Chroot is not mounted";
pankso@342 139 if (file_exists($lockfile)) {
pascal@350 140 $status = "Chroot is mounted";
pankso@342 141 }
pascal@349 142 if (file_exists("$log_dir/step")) {
pascal@369 143 $duration = time() - filemtime("$log_dir/step");
pascal@369 144 if ($duration < 60)
pascal@369 145 $duration .= "s";
pascal@369 146 else if ($duration < 3600)
pascal@369 147 $duration = floor($duration / 60). " min";
pascal@369 148 else $duration = sprintf("%dH%02d",floor($duration / 3600),
pascal@369 149 ($duration / 60) % 60);
pascal@369 150 $status .= ", ".file_get_contents("$log_dir/step")." ($duration ago)";
pascal@349 151 if (file_exists("$log_dir/package")) {
pascal@349 152 $pkg = file_get_contents("$log_dir/package");
pascal@351 153 $pkg = chop($pkg);
pascal@349 154 if (file_exists("$log_dir/$pkg.html"))
pascal@349 155 $status .= " <a href=\"log.php?version=$version&package=$pkg\">$pkg</a>";
pascal@351 156 else $status .= " $pkg";
pascal@349 157 }
pankso@342 158 }
pascal@363 159 echo "<li>".date(DATE_RFC822).": $status</li>\n";
pankso@344 160 //include("$db_dir/summary");
gokhlayeh@186 161 ?>
pankso@342 162 <li>Packages in the wok: <?php
pankso@342 163 system("cd $wok && ls -1 | wc -l"); ?></li>
pankso@342 164 <li>Packages in the main repository: <?php
pankso@344 165 system("cd $packages && ls -1t *.tazpkg | wc -l"); ?></li>
pankso@342 166 <li>Packages in the incoming repository: <?php
pankso@344 167 system("cd $incoming && ls -1t *.tazpkg | wc -l"); ?></li>
pankso@342 168 <li>Commited packages: <?php
pascal@347 169 system("wc -l < $db_dir/commit"); ?></li>
pankso@342 170 <li>Packages to cook: <?php
pascal@347 171 system("wc -l < $db_dir/cooklist"); ?></li>
pankso@342 172 <li>Broken packages: <?php
pascal@347 173 system("wc -l < $db_dir/broken"); ?></li>
pankso@342 174 <li>Blocked packages: <?php
pascal@347 175 system("wc -l < $db_dir/blocked"); ?></li>
gokhlayeh@265 176 </ul>
gokhlayeh@186 177
pascal@363 178 <?php
pascal@363 179 if (!isset($_GET["summary"])) {
pascal@363 180 ?>
pascal@369 181 <a name="Commit"></a>
gokhlayeh@186 182 <h3>Commit</h3>
gokhlayeh@186 183 <pre class="package">
gokhlayeh@186 184 <?php
gokhlayeh@186 185 include("$db_dir/commit");
gokhlayeh@186 186 ?>
gokhlayeh@186 187 </pre>
gokhlayeh@186 188
pascal@369 189 <a name="Cooklist"></a>
gokhlayeh@186 190 <h3>Cooklist</h3>
gokhlayeh@186 191 <pre class="package">
gokhlayeh@186 192 <?php
gokhlayeh@186 193 include("$db_dir/cooklist");
gokhlayeh@186 194 ?>
gokhlayeh@186 195 </pre>
gokhlayeh@186 196
pascal@369 197 <a name="Broken"></a>
gokhlayeh@186 198 <h3>Broken</h3>
gokhlayeh@186 199 <pre class="package">
gokhlayeh@186 200 <?php
gokhlayeh@267 201 include_and_link("$db_dir/broken");
gokhlayeh@186 202 ?>
gokhlayeh@186 203 </pre>
gokhlayeh@186 204
pascal@369 205 <a name="Blocked"></a>
gokhlayeh@186 206 <h3>Blocked</h3>
gokhlayeh@186 207 <pre class="package">
gokhlayeh@186 208 <?php
gokhlayeh@267 209 include_and_link("$db_dir/blocked");
gokhlayeh@186 210 ?>
gokhlayeh@186 211 </pre>
gokhlayeh@186 212
pascal@369 213 <a name="cooked"></a>
gokhlayeh@186 214 <h3>Last cooked packages</h3>
gokhlayeh@186 215 <pre class="package">
gokhlayeh@186 216 <?php
gokhlayeh@267 217 list_last_cooked($incoming, "tazpkg");
gokhlayeh@267 218 ?>
gokhlayeh@186 219 </pre>
gokhlayeh@186 220
pascal@369 221 <a name="removed"></a>
gokhlayeh@186 222 <h3>Last removed packages</h3>
gokhlayeh@186 223 <pre class="package">
gokhlayeh@186 224 <?php
gokhlayeh@186 225 include("$db_dir/removed");
gokhlayeh@186 226 ?>
gokhlayeh@186 227 </pre>
gokhlayeh@186 228
pascal@369 229 <a name="flavors"></a>
gokhlayeh@186 230 <h3>Last cooked flavors</h3>
gokhlayeh@186 231 <pre class="package">
gokhlayeh@186 232 <?php
gokhlayeh@267 233 list_last_cooked($packages, "flavor");
gokhlayeh@267 234 ?>
gokhlayeh@186 235 </pre>
gokhlayeh@186 236
pascal@363 237 <?php
pascal@363 238 } // isset summary
pascal@363 239 ?>
gokhlayeh@235 240 <!-- End of content -->
gokhlayeh@186 241 </div>
gokhlayeh@186 242
gokhlayeh@235 243 <!-- Footer -->
gokhlayeh@235 244 <div id="footer">
gokhlayeh@235 245 <div class="right_box">
gokhlayeh@235 246 <h4>SliTaz Network</h4>
gokhlayeh@235 247 <ul>
gokhlayeh@235 248 <li><a href="http://www.slitaz.org/">Main Website</a></li>
gokhlayeh@235 249 <li><a href="http://doc.slitaz.org/">Documentation</a></li>
gokhlayeh@235 250 <li><a href="http://forum.slitaz.org/">Support Forum</a></li>
gokhlayeh@235 251 <li><a href="http://scn.slitaz.org/">Community Network</a></li>
gokhlayeh@235 252 <li><a href="http://labs.slitaz.org/">Laboratories</a></li>
gokhlayeh@235 253 <li><a href="http://twitter.com/slitaz">SliTaz on Twitter</a></li>
pankso@344 254 <li><a href="http://www.facebook.com/slitaz">SliTaz on Facebook</a></li>
gokhlayeh@235 255 </ul>
gokhlayeh@235 256 </div>
gokhlayeh@235 257 <h4>SliTaz Website</h4>
gokhlayeh@235 258 <ul>
gokhlayeh@235 259 <li><a href="#header">Top of the page</a></li>
gokhlayeh@235 260 <li>Copyright &copy; <span class="year"></span>
gokhlayeh@235 261 <a href="http://www.slitaz.org/">SliTaz</a></li>
gokhlayeh@235 262 <li><a href="http://www.slitaz.org/en/about/">About the project</a></li>
gokhlayeh@235 263 <li><a href="http://www.slitaz.org/netmap.php">Network Map</a></li>
gokhlayeh@235 264 <li>Page modified the <?php echo (date( "d M Y", getlastmod())); ?></li>
gokhlayeh@235 265 <li><a href="http://validator.w3.org/check?uri=referer"><img
gokhlayeh@235 266 src="pics/website/xhtml10.png" alt="Valid XHTML 1.0"
gokhlayeh@235 267 title="Code validé XHTML 1.0"
gokhlayeh@235 268 style="width: 80px; height: 15px; vertical-align: middle;" /></a></li>
gokhlayeh@235 269 </ul>
gokhlayeh@186 270 </div>
gokhlayeh@186 271
gokhlayeh@186 272 </body>
gokhlayeh@186 273 </html>