1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
|
<?php
# Copyright (C) 2008,2009 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# A few notes:
# 1. There is one file / data source per suite - the reprepro logs.
# 2. Configuration is internal
##### config #####
$buildlog_path = "/var/www/grip/logs/";
$template_file = "/var/www/toolchains/emdebian.php";
$default_days = 7;
$supported_arches = array ("i386", "amd64", "arm", "armel",
"powerpc", "mips", "mipsel" );
$components = array ("main", "dev", "doc", "debug");
#### end config ##
$SELF = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
$now = date("D, d M Y H:i:s T");
$num_days = $default_days;
if (($_GET['days'] != ''))
{
$num_days = htmlspecialchars ($_GET['days']);
$num_days = preg_replace ('/\.+\/+/', "", $num_days);
}
$suite="sid";
if (($_GET['suite'] != ''))
{
$suite = htmlspecialchars ($_GET['suite']);
$suite = preg_replace ('/\.+\/+/', "", $suite);
}
$feed = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html lang=\"en\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>Emdebian Grip - $suite</title>
<link href=\"../debian.css\" rel=\"stylesheet\" type=\"text/css\"></head>
<body text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000FF\"
vlink=\"#800080\" alink=\"#FF0000\">
<table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"3\"
cellspacing=\"0\" summary=\"\">
<tr>
<td align=\"left\" valign=\"middle\">
<a href=\"../\"><img src=\"../Pics/emdebian_swirl.jpg\" border=\"0\"
hspace=\"0\" vspace=\"0\" alt=\"emdebian logo\" width=\"310\" height=\"61\"></a>
</td>
</tr>
</table>
<!--UdmComment-->
<div id=\"navbar\">
<p class=\"hidecss\"><a href=\"#inner\">Skip Quicknav</a></p>
<ul>
<li><a href=\"../about/\">About Emdebian</a></li>
<li><a href=\"../News/index.html\">News</a></li>
<li><a href=\"../grip/\">Grip</a></li>
<li><a href=\"../crush/\">Crush</a></li>
<li><a href=\"../docs.html\">Documentation</a></li>
<li><a href=\"../support.html\">Support</a></li>
<li><a href=\"../search.html\">Search</a></li>
</ul>
</div> <!-- end navbar -->
<!--/UdmComment-->
<h1 id=\"top\">Emdebian Grip repository - $suite activity logs</h1>\n";
$loglist = array ();
if (!is_dir ("$buildlog_path"))
{
$feed .= "<p>Cannot find $buildlog_path!</p>";
echo $feed;
exit;
}
$logfile = "$buildlog_path"."$suite"."-log";
$files = array ();
$cut_off = date ("U") - (60*60*24*$num_days);
$total = array ();
$feed .= "<hr><h2>Suite selection</h2>\n";
if ($suite == "sid")
{
$feed .= "<p>[ <a href=\"$SELF?suite=squeeze\">Squeeze</a> ] ";
$feed .= "[ <b>Sid</b> ]</p>\n";
}
if ($suite == "squeeze")
{
$feed .= "<p>[ <b>Squeeze</b> ] ";
$feed .= "[ <a href=\"$SELF?suite=sid\">Sid</a> ]</p>\n";
}
$feed .= "<h2>Time Filter</h2>\n";
if ($num_days > 0)
{
$feed .= "<p>Only logs from the last $num_days days are shown.\n";
$feed .="<a href=\"$SELF?days=0&suite=$suite\">Show all logs</a>, or \n";
if ($num_days == $default_days)
{
$feed .= "<a href=\"$SELF?days=28&suite=$suite\">show logs for 28 days</a>.</p>\n";
}
else
{
$feed .= "<a href=\"$SELF?days=$default_days&suite=$suite\">show logs for $default_days days</a>.</p>\n";
}
}
else
{
$feed .= "<p>Showing all logs. \n";
$feed .= "<a href=\"$SELF?days=$default_days&suite=$suite\">Show the last $default_days days</a>.</p>\n";
}
$contents = file ("$logfile");
rsort ($contents);
$arches = array();
$oldpkg = "";
$c = 0;
$output = array ();
$dates=array();
$l = 0;
$pubdate=0;
$addcss = "<span style=\"color:green;font-weight:700\">";
$replacecss = "<span style=\"color:navy;font-weight:700\">";
$removecss = "<span style=\"color:red;font-weight:700\">";
foreach ($contents as $line)
{
$last_log=0;
$matches = split (" ", $line);
$time = $matches[1];
$day = $matches[0];
$thisdate = strtotime ("$day $time");
if ($pubdate < $thisdate)
{
$pubdate = $thisdate;
}
$action = $matches[2];
$cmpnt = $matches[5];
$oldversion = rtrim($matches[9]);
if ($action == "add")
{
$action = "${addcss}has been added</span> to <b>$cmpnt</b>";
}
if ($action == "remove")
{
$action = "${removecss}has been removed</span> from $suite (<b>$cmpnt</b>)";
}
if ($action == "replace")
{
$action = "${replacecss}replaces $oldversion</span> in <b>$cmpnt</b>";
}
$package = $matches[7];
$newversion = rtrim($matches[8]);
array_push ($arches, $matches[6]);
$arch = $matches[6];
# catch the first package
if ($c == 0)
{
$oldpkg = $package;
$c++;
}
if ($oldpkg == $package)
{
array_push ($arches, $arch);
$id = preg_replace ("/\++/", "", $package);
$str = "<li><b>$package</b> ($newversion) ";
$end = "$action.</li>";
continue;
}
$list = join (", ", $arches);
if (count($arches) > 0)
{
$list = "{<i>".$list."</i>}";
}
$str = "$str $end";
$arches = array();
$oldpkg = $package;
if ($last_log > $thisdate) { continue; }
# add a 7 day cut-off
$last_log = $thisdate;
$total[$check] = $logfile;
if (($num_days > 0) and ($cut_off > $thisdate)) { continue; }
$dates["$day"][$l] = $str;
$str = $end = "";
$l++;
}
krsort ($dates);
$feed .= "<p>";
foreach ($dates as $key => $line)
{
$feed .= "[ <a href=\"#d$key\">$key</a> ]\n";
}
$feed .= "</p>\n<hr>\n";
foreach ($dates as $key => $line)
{
preg_match ("/([0-9]{4})-([0-9]{2})-([0-9]{2})/", "$key", $match);
$year = $match[1];
$month = $match[2];
$day = $match[3];
$thisdate = mktime (0,0,0,$month,$day,$year);
$datestr = date("D, d F Y.", $thisdate);
$feed .= "<h2 id=\"d$key\">Updates in $suite for $datestr</h2>\n";
$feed .= "<p><a href=\"#top\">Top</a></p>\n";
asort ($line);
$feed .= "<ol>";
foreach ($line as $l => $str)
{
if ($str !== " ")
{
$feed .= "$str\n";
}
}
$feed .= "</ol>";
}
$feed .= "</body></html>";
echo $feed;
?>
|