summaryrefslogtreecommitdiffstats
path: root/autobuild/broken.php
blob: 68459f812a925704772b6c19f8a16ae20fdd0e4f (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
<?php
header("Content-type: text/plain");

$srpm_dir = '/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/';

$run = readlink("cauldron/x86_64/core/latest");
$packages = Array();
if ($handle = opendir($srpm_dir)) {
	while (false !== ($entry = readdir($handle))) {
		if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $entry, $matches)) {
			$packages[$matches[1]] = $entry;
		}
	}
	closedir($handle);
}

$failure = Array();

$base_dir = "cauldron/x86_64/core/$run";

$status_name = "$base_dir/status.core.log";

$status_file = fopen($status_name, "r");
while (!feof($status_file)) {
	$line = fgets($status_file);
	if (preg_match("/^(.*): (.*)$/", $line, $matches)) {
		$rpm = $matches[1];
		$status = $matches[2];
		if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch"){
			preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches);
			$package = $matches[1];
			$version = $matches[2];
			if($packages[$package]) {
				$build_stat = stat("$base_dir/$rpm");
				$pkg_stat = stat($srpm_dir.$packages[$package]);
				if ($pkg_stat['mtime'] <= $build_stat['mtime']) {
					$failure[$rpm] = $status;
				}
			}
		}
	}
}
fclose($status_file);

ksort($failure);

foreach ($failure as $rpm => $error) {
	echo "$rpm: $error\n";
}
?>