summaryrefslogtreecommitdiff
path: root/bin/build-master-status-from-mysql
blob: a416538ed50e2c858f9c2e5133edec1304142cfd (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
#!/bin/sh

# report about status of build master - according to mysql database

# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
# shellcheck source=bin/mysql-functions
. "${base_dir}/bin/mysql-functions"

# shellcheck disable=SC2016
${mysql_command} -e '
  SELECT `build_slaves`.`name`,`build_slaves`.`operator`,`package_sources`.`pkgbase`,`build_slaves`.`last_connection`
  FROM `build_slaves`
  LEFT JOIN `build_assignments` ON
  `build_slaves`.`currently_building`=`build_assignments`.`id`
  LEFT JOIN `package_sources` ON
  `build_assignments`.`package_source`=`package_sources`.`id`
' --html | \
  sed '
    s,</TR>,\0\n,g
  ' | \
  sed '
    \,</TH></TR>$, {
      s,<TH>pkgbase</TH>,<TH>currently building</TH>,
      y,_, ,
    }
    1 i <html><head><title>list of build slaves</title></head><body>
    $ a </body></html>
  ' | \
  sponge "${webserver_directory}/build-slaves.html"

mysql_sanity_check | \
  sed '
    s,^-.*$,<font color="#FF0000">\0</font>,
    s,^+.*$,<font color="#00FF00">\0</font>,
    s/$/<br>/
    1 i <html><head><title>sanity of the buildmaster'"'"'s mysql database</title></head><body>
    $ a </body></html>
  ' | \
  sponge "${webserver_directory}/mysql-sanity.html"