Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/packages/differences.php
blob: f9b43af13e08b0459ac8bcee7fa3ee61e4c1e376 (plain)
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
<?php

require_once "../init.php";

require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";

$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
if (count($uri_parts) > 1)
  $options = $uri_parts[1];
else
  $options = '';

$uri_parts = explode('/', $uri_parts[0]);

if ($uri_parts[0] != '' || $uri_parts[1] != 'packages' || $uri_parts[2] != 'differences')
  throw_http_error(422, 'Unprocessable Entity');

$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();