summaryrefslogtreecommitdiff
path: root/packages/differences.php
diff options
context:
space:
mode:
Diffstat (limited to 'packages/differences.php')
-rw-r--r--packages/differences.php111
1 files changed, 111 insertions, 0 deletions
diff --git a/packages/differences.php b/packages/differences.php
new file mode 100644
index 0000000..e861a63
--- /dev/null
+++ b/packages/differences.php
@@ -0,0 +1,111 @@
+<?php
+
+require_once "init.php";
+
+require_once BASE . "/lib/style.php";
+require_once BASE . "/lib/mysql.php";
+
+$uri_parts = explode('/', $_SERVER['REQUEST_URI']);
+
+if ($uri_parts[0] != '' || $uri_parts[1] != 'packages' || $uri_parts[2] != 'differences')
+ throw_http_error(422, 'Unprocessable Entity');
+
+$options = '';
+
+$last = array_pop($uri_parts);
+if (substr($last, 0, 1) == '?') {
+ $options = $last;
+ $last = array_pop($uri_parts);
+}
+if ($last != '')
+ array_push($uri_parts, $last);
+
+array_splice(
+ $uri_parts,
+ 0, 3
+);
+
+if (count($uri_parts) != 0)
+ throw_http_error(422, 'Unprocessable Entity');
+
+$sort = '';
+if (array_key_exists('sort', $_GET)) {
+ $criterium = $_GET['sort'];
+ if (
+ array_key_exists($criterium, $difflist_sorts) &&
+ array_key_exists('mysql', $difflist_sorts[$criterium])
+ )
+ $sort = $difflist_sorts[$criterium]['mysql'] . ',';
+ elseif (substr($criterium, 0, 1) == '-') {
+ $criterium = substr($criterium, 1);
+ if (
+ array_key_exists($criterium, $difflist_sorts) &&
+ array_key_exists('mysql', $difflist_sorts[$criterium])
+ )
+ $sort = $difflist_sorts[$criterium]['mysql'] . ' DESC,';
+ }
+}
+
+$result = mysql_run_query(
+ 'SELECT ' .
+ '`bp_i486`.`pkgname`,' .
+ mysql_query_package_version('bp_i486') . ' AS `i486_version`,' .
+ mysql_query_package_version('bp_i686') . ' AS `i686_version`,' .
+ '`r_i486`.`name` AS `repository`,' .
+ 'MAX(`bpir_i486`.`last_moved`) AS `i486_last_moved`,' .
+ 'MAX(`bpir_i686`.`last_moved`) AS `i686_last_moved`,' .
+ 'IF(' .
+ '`v_i486`.`order`<`v_i686`.`order`' .
+ ' OR `v_i486`.`order`=`v_i686`.`order`' .
+ ' AND `bp_i486`.`pkgrel`<`bp_i686`.`pkgrel`' .
+ ',1,0) AS `i486_is_oldest`' .
+ ' FROM `binary_packages` AS `bp_i486`' .
+ mysql_join_binary_packages_binary_packages_in_repositories('bp_i486', 'bpir_i486') .
+ mysql_join_binary_packages_in_repositories_repositories('bpir_i486', 'r_i486') .
+ ' AND `r_i486`.`is_on_master_mirror`' .
+ mysql_join_repositories_architectures('r_i486', 'ra_i486') .
+ ' AND `ra_i486`.`name`="i486"' .
+ ' JOIN `binary_packages` AS `bp_i686`' .
+ ' ON `bp_i486`.`pkgname`=`bp_i686`.`pkgname`' .
+ mysql_join_binary_packages_binary_packages_in_repositories('bp_i686', 'bpir_i686') .
+ mysql_join_binary_packages_in_repositories_repositories('bpir_i686', 'r_i686') .
+ ' AND `r_i686`.`is_on_master_mirror`' .
+ ' AND `r_i486`.`stability`=`r_i686`.`stability`' .
+ mysql_join_repositories_architectures('r_i686', 'ra_i686') .
+ ' AND `ra_i686`.`name`="i686"' .
+ ' JOIN `versions` as `v_i486`' .
+ ' ON `v_i486`.`epoch`=`bp_i486`.`epoch`' .
+ ' AND `v_i486`.`version`=`bp_i486`.`pkgver`' .
+ ' JOIN `versions` as `v_i686`' .
+ ' ON `v_i686`.`epoch`=`bp_i686`.`epoch`' .
+ ' AND `v_i686`.`version`=`bp_i686`.`pkgver`' .
+ ' WHERE `bp_i486`.`epoch`!=`bp_i686`.`epoch`' .
+ ' OR `bp_i486`.`pkgver`!=`bp_i686`.`pkgver`' .
+ ' OR `bp_i486`.`pkgrel`!=`bp_i686`.`pkgrel`' .
+ ' GROUP BY CONCAT(`r_i486`.`stability`, "-", `bp_i486`.`pkgname`)' .
+ ' ORDER BY ' . $sort . '`r_i486`.`stability`,`bp_i486`.`pkgname`'
+);
+$differences = array();
+while ($row = $result -> fetch_assoc()) {
+ $row['i486_move_date'] = substr($row['i486_last_moved'], 0, 10);
+ $row['i686_move_date'] = substr($row['i686_last_moved'], 0, 10);
+ if ($row['i486_is_oldest']) {
+ $row['i486_font_pre'] = '<font color="#ff0000">';
+ $row['i486_font_post'] = '</font>';
+ $row['i686_font_pre'] = '';
+ $row['i686_font_post'] = '';
+ } else {
+ $row['i486_font_pre'] = '';
+ $row['i486_font_post'] = '';
+ $row['i686_font_pre'] = '<font color="#ff0000">';
+ $row['i686_font_post'] = '</font>';
+ }
+ $differences[] = $row;
+}
+
+print_header('Package Differences Reports');
+print " <div class=\"box\">\n";
+print " <h2>Architecture Differences Between Packages</h2>\n";
+print_listing($differences, true, 'diff');
+print " </div>\n";
+print_footer();