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