Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/buildmaster/status.php
blob: 05a4455b5268027042574910d800d11c317610e1 (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
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
<?php
require_once "../init.php";
include BASE . "/lib/mysql.php";
include BASE . "/lib/style.php";
include BASE . "/lib/helper.php";

$result = mysql_run_query(
  "SELECT MAX(`package_sources`.`commit_time`) AS `last_commit`" .
  " FROM `package_sources`"
);

if ($result -> num_rows > 0) {
  $result = $result->fetch_assoc();
  $last_commit = $result["last_commit"];
}

$result = mysql_run_query(
  "SELECT MAX(`build_assignments`.`return_date`) AS `last_return`" .
  " FROM `build_assignments`"
);

if ($result -> num_rows > 0) {
  $result = $result->fetch_assoc();
  $last_return = $result["last_return"];
}

$result = mysql_run_query(
  "SELECT MAX(`binary_packages_in_repositories`.`last_moved`) AS `last_moved`" .
  " FROM `binary_packages`" .
  mysql_join_binary_packages_binary_packages_in_repositories() .
  mysql_join_binary_packages_build_assignments() .
  " WHERE `binary_packages_in_repositories`.`last_moved`>`build_assignments`.`return_date`"
);

if ($result -> num_rows > 0) {
  $result = $result->fetch_assoc();
  $last_moved = $result["last_moved"];
}

$age_queries = array(
  array(
    "label" => "age of build-list-packages",
    "column" => "`package_sources`.`commit_time`",
    "table" =>
      "`package_sources`" .
      " JOIN (" .
        "SELECT " .
        "`build_assignments`.`package_source`" .
        " FROM `build_assignments`" .
        mysql_join_build_assignments_binary_packages() .
        mysql_join_binary_packages_binary_packages_in_repositories() .
        mysql_join_binary_packages_in_repositories_repositories() .
        " WHERE `repositories`.`name`=\"build-list\"" .
        " AND `build_assignments`.`is_blocked` IS NULL" .
        " GROUP BY `build_assignments`.`package_source`" .
      ") AS `build_assignments_grouped`" .
      " ON `build_assignments_grouped`.`package_source`=`package_sources`.`id`"
  ),
  array(
    "label" => "age of staging-packages",
    "column" => "`binary_packages_in_repositories`.`first_last_moved`",
    "table" =>
      "`binary_packages`" .
      " JOIN (" .
        "SELECT " .
        "`binary_packages_in_repositories`.`package`," .
        "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" .
        " FROM `binary_packages_in_repositories`" .
        mysql_join_binary_packages_in_repositories_repositories() .
        mysql_join_repositories_repository_stabilities() .
        " WHERE `repository_stabilities`.`name`=\"staging\"" .
        " GROUP BY `binary_packages_in_repositories`.`package`" .
      ") AS `binary_packages_in_repositories`" .
      " ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`"
  ),
  array(
    "label" => "age of testing-packages",
    "column" => "`binary_packages_in_repositories`.`first_last_moved`",
    "table" =>
      "`binary_packages`" .
      " JOIN (" .
        "SELECT " .
        "`binary_packages_in_repositories`.`package`," .
        "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" .
        " FROM `binary_packages_in_repositories`" .
        mysql_join_binary_packages_in_repositories_repositories() .
        mysql_join_repositories_repository_stabilities() .
        " WHERE `repository_stabilities`.`name`=\"testing\"" .
        " GROUP BY `binary_packages_in_repositories`.`package`" .
      ") AS `binary_packages_in_repositories`" .
      " ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`" .
      " WHERE NOT `binary_packages`.`has_issues`" .
      " AND NOT `binary_packages`.`is_tested`"
  ),
  array(
    "label" => "age of tested-packages",
    "column" => "`binary_packages_in_repositories`.`first_last_moved`",
    "table" =>
      "`binary_packages`" .
      " JOIN (" .
        "SELECT " .
        "`binary_packages_in_repositories`.`package`," .
        "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" .
        " FROM `binary_packages_in_repositories`" .
        mysql_join_binary_packages_in_repositories_repositories() .
        mysql_join_repositories_repository_stabilities() .
        " WHERE `repository_stabilities`.`name`=\"testing\"" .
        " GROUP BY `binary_packages_in_repositories`.`package`" .
      ") AS `binary_packages_in_repositories`" .
      " ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`"
  )
);

foreach ($age_queries as $age_query) {
  $result = mysql_run_query(
    "SELECT " .
    "AVG(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(" . $age_query["column"] . ")) AS `avg`," .
    "STDDEV(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(" . $age_query["column"] . ")) AS `stddev`" .
    " FROM " . $age_query["table"]
  );
  if ($result -> num_rows > 0) {
    $result = $result->fetch_assoc();
    foreach ($result as $key => $val)
      $ages[$age_query["label"]][$key] = format_time_duration($val);
  };
};

print_header("Build Master Status");

if (isset($last_commit))
  print "      latest package source is from " . $last_commit . ".<br>\n";

if (isset($last_return))
  print "      latest built package is from " . $last_return . ".<br>\n";

if (isset($last_moved))
  print "      latest package move was on " . $last_moved . ".<br>\n";

foreach ($ages as $label => $value)
  print "      " . $label . ": " .
    $value["avg"] . " &pm; " .
    $value["stddev"] . ".<br>\n";

print_footer();