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
|
<?php
require_once "../init.php";
require_once BASE . "/lib/helper.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,';
}
}
function check_a_older_than_b($a_v, $a_bp, $b_v, $b_bp) {
return
'`' . $a_v . '`.`order`<`' . $b_v . '`.`order`' .
' OR (' .
'`' . $a_v . '`.`order`=`' . $b_v . '`.`order`' .
' AND `' . $a_bp . '`.`pkgrel`<`' . $b_bp . '`.`pkgrel`' .
')';
}
$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`,' .
str_replace(
array(
'`upstream_packages`.`sub_pkgrel_omitted`',
'`upstream_packages`.`sub_pkgrel`'
),
array(1, 0),
mysql_query_package_version('upstream_packages')
) . ' AS `x86_64_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(' .
check_a_older_than_b('v_i486','bp_i486','v_i686','bp_i686') .
' OR ' . check_a_older_than_b('v_i486','bp_i486','v_x86_64','upstream_packages') .
',1,0) AS `i486_is_old`,' .
'IF(' .
'`newer_i486`.`id` IS NULL,' .
'0,1' .
') AS `i486_exists_newer`,' .
'IF(' .
check_a_older_than_b('v_i686','bp_i686','v_i486','bp_i486') .
' OR ' . check_a_older_than_b('v_i686','bp_i686','v_x86_64','upstream_packages') .
',1,0) AS `i686_is_old`,' .
'IF(' .
'`newer_i686`.`id` IS NULL,' .
'0,1' .
') AS `i686_exists_newer`' .
' 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"' .
' LEFT JOIN (' .
'`binary_packages` AS `newer_i486`' .
mysql_join_binary_packages_binary_packages_in_repositories('newer_i486','newer_i486_bpir') .
mysql_join_binary_packages_in_repositories_repositories('newer_i486_bpir','newer_i486_r') .
' AND `newer_i486_r`.`is_on_master_mirror`' .
mysql_join_repositories_architectures('newer_i486_r','newer_i486_ra') .
' AND `newer_i486_ra`.`name`="i486"' .
' JOIN `repository_stability_relations` AS `i486_rsr`' .
' ON `i486_rsr`.`less_stable`=`newer_i486_r`.`stability`' .
') ON `newer_i486`.`pkgname`=`bp_i486`.`pkgname`' .
' AND `i486_rsr`.`more_stable`=`r_i486`.`stability`' .
' AND `r_i486`.`id`!=`newer_i486_r`.`id`' .
' 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"' .
' LEFT JOIN (' .
'`binary_packages` AS `newer_i686`' .
mysql_join_binary_packages_binary_packages_in_repositories('newer_i686','newer_i686_bpir') .
mysql_join_binary_packages_in_repositories_repositories('newer_i686_bpir','newer_i686_r') .
' AND `newer_i686_r`.`is_on_master_mirror`' .
mysql_join_repositories_architectures('newer_i686_r','newer_i686_ra') .
' AND `newer_i686_ra`.`name`="i686"' .
' JOIN `repository_stability_relations` AS `i686_rsr`' .
' ON `i686_rsr`.`less_stable`=`newer_i686_r`.`stability`' .
') ON `newer_i686`.`pkgname`=`bp_i686`.`pkgname`' .
' AND `i686_rsr`.`more_stable`=`r_i686`.`stability`' .
' AND `r_i686`.`id`!=`newer_i686_r`.`id`' .
' 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`' .
' LEFT JOIN (' .
'`upstream_packages`' .
' JOIN `versions` AS `v_x86_64`' .
' ON `v_x86_64`.`epoch`=`upstream_packages`.`epoch`' .
' AND `v_x86_64`.`version`=`upstream_packages`.`pkgver`' .
') ON `upstream_packages`.`pkgname`=`bp_i486`.`pkgname`' .
' WHERE `bp_i486`.`epoch`!=`bp_i686`.`epoch`' .
' OR `bp_i486`.`pkgver`!=`bp_i686`.`pkgver`' .
' OR `bp_i486`.`pkgrel`!=`bp_i686`.`pkgrel`' .
' OR `bp_i486`.`epoch`!=`upstream_packages`.`epoch`' .
' OR `bp_i486`.`pkgver`!=`upstream_packages`.`pkgver`' .
' OR `bp_i486`.`pkgrel`!=`upstream_packages`.`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_old']) {
if ($row['i486_exists_newer'])
$row['i486_font_pre'] = '<font color="#800000">';
else
$row['i486_font_pre'] = '<font color="#ff0000">';
$row['i486_font_post'] = '</font>';
} else {
$row['i486_font_pre'] = '';
$row['i486_font_post'] = '';
}
if ($row['i686_is_old']) {
if ($row['i686_exists_newer'])
$row['i686_font_pre'] = '<font color="#800000">';
else
$row['i686_font_pre'] = '<font color="#ff0000">';
$row['i686_font_post'] = '</font>';
} else {
$row['i686_font_pre'] = '';
$row['i686_font_post'] = '';
}
$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();
|