query($sql);
echo "
Category | Ebuilds | New versions |
";
while ($row = $results->fetchArray()) {
$new = $row['versions'] - $row['ebuilds'];
$color = $new == 0 ? 'green' : 'red';
echo "";
echo "{$row['category']} | ";
echo "{$row['ebuilds']} | ";
echo "$new | ";
echo "
";
}
echo "
";
} else if ($act == "herds") {
$sql = "SELECT herd, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM herds";
$sql.= " JOIN package_herds ON herds.id = herd_id";
$sql.= " JOIN packages ON package_herds.package_id = packages.id";
$sql.= " JOIN versions ON versions.package_id = packages.id";
$sql.= " GROUP BY herd";
$results = $db->query($sql);
echo "
Herd | Ebuilds | New versions |
";
while ($row = $results->fetchArray()) {
$new = $row['versions'] - $row['ebuilds'];
$color = $new == 0 ? 'green' : 'red';
echo "";
echo "{$row['herd']} | ";
echo "{$row['ebuilds']} | ";
echo "$new | ";
echo "
";
}
echo "
";
} else if ($act == "maintainers") {
$sql = "SELECT maintainer, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM maintainers";
$sql.= " JOIN package_maintainers ON maintainers.id = maintainer_id";
$sql.= " JOIN packages ON package_maintainers.package_id = packages.id";
$sql.= " JOIN versions ON versions.package_id = packages.id";
$sql.= " GROUP BY maintainer";
$results = $db->query($sql);
echo "
Maintainer | Ebuilds | New versions |
";
while ($row = $results->fetchArray()) {
$new = $row['versions'] - $row['ebuilds'];
$color = $new == 0 ? 'green' : 'red';
echo "";
echo "{$row['maintainer']} | ";
echo "{$row['ebuilds']} | ";
echo "$new | ";
echo "
";
}
echo "
";
} else if ($act == "categories") {
$sql = "SELECT category, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM packages JOIN versions ON package_id = packages.id";
$sql.= " GROUP BY category";
$results = $db->query($sql);
echo "
Category | Ebuilds | New versions |
";
while ($row = $results->fetchArray()) {
$new = $row['versions'] - $row['ebuilds'];
$color = $new == 0 ? 'green' : 'red';
echo "";
echo "{$row['category']} | ";
echo "{$row['ebuilds']} | ";
echo "$new | ";
echo "
";
}
echo "
";
} else if ($act == 'packages') {
$db_cat = $db->escapeString($cat);
$db_herd = $db->escapeString($herd);
$db_mtnr = $db->escapeString($mtnr);
if ($db_cat) {
$sql = "SELECT category, package, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM packages JOIN versions ON package_id = packages.id";
$sql.= " WHERE category = '$db_cat'";
$sql.= " GROUP BY category, package";
} else if ($db_herd) {
$sql = "SELECT category, package, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM herds";
$sql.= " JOIN package_herds ON herds.id = herd_id";
$sql.= " JOIN packages ON package_herds.package_id = packages.id";
$sql.= " JOIN versions ON versions.package_id = packages.id";
$sql.= " WHERE herd LIKE '$db_herd'";
$sql.= " GROUP BY category, package";
} else if ($db_mtnr) {
$sql = "SELECT category, package, COUNT(version) as versions, SUM(packaged) as ebuilds";
$sql.= " FROM maintainers";
$sql.= " JOIN package_maintainers ON maintainers.id = maintainer_id";
$sql.= " JOIN packages ON package_maintainers.package_id = packages.id";
$sql.= " JOIN versions ON versions.package_id = packages.id";
$sql.= " WHERE maintainer LIKE '%$db_mtnr%'";
$sql.= " GROUP BY category, package";
}
if ($sql) {
$results = $db->query($sql);
echo "
Category | Ebuilds | New versions |
";
while ($row = $results->fetchArray()) {
$new = $row['versions'] - $row['ebuilds'];
$catpkg = "{$row['category']}/{$row['package']}";
$color = $new == 0 ? 'green' : 'red';
echo "";
echo "$catpkg | ";
echo "{$row['ebuilds']} | ";
echo "$new | ";
echo "
";
}
echo "
";
}
} else if ($act == 'package') {
$pkg = explode("/", $pkg);
if (count($pkg) == 2) {
$cat = $db->escapeString($pkg[0]);
$pkg = $db->escapeString($pkg[1]);
} else {
$cat = $pkg = "";
}
$sql = "SELECT * FROM packages WHERE category = '$cat' AND package = '$pkg'";
$infos = $db->query($sql);
$infos = $infos->fetchArray();
if ($infos) {
echo "
{$infos['category']}/${infos['package']}
";
$sql = "SELECT * FROM versions WHERE package_id = ${infos['id']} AND packaged = 1";
$results = $db->query($sql);
echo '
Packaged versions:
';
while ($version = $results->fetchArray()) {
echo "- ${version['version']}-${version['revision']}:${version['slot']}
";
}
$sql = "SELECT * FROM versions ";
$sql.= "JOIN upstream_urls ON versions.id = version_id ";
$sql.= "WHERE package_id = ${infos['id']} AND packaged = 0";
$results = $db->query($sql);
echo '
';
echo '
Upstream versions:
';
while ($version = $results->fetchArray()) {
echo "- ${version['version']} - ${version['url']}
";
}
echo '
';
} else {
echo '
Invalid package
';
}
}
?>