Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/build-master-status-from-mysql
blob: 2ed9a240a34e0a4674ccf0d2a44b094cf2f7a1e5 (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
#!/bin/sh

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

# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"

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

{
  mysql_sanity_check || true
  {
    # shellcheck disable=SC2016
    {
      printf 'SELECT `package_sources`.`pkgbase`,`package_sources`.`git_revision`,`package_sources`.`mod_git_revision`,`upstream_repositories`.`name`'
      printf ' FROM `package_sources`'
      printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
        'upstream_repositories' 'package_sources' 'upstream_package_repository' 'upstream_repositories' \
        'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
        'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
        'repositories' 'binary_packages' 'repository' 'repositories'
      printf ' WHERE `repositories`.`name`="build-list"'
    } | \
      ${mysql_command} --batch | \
      sed '
        1d
        y/\t/ /
        s/^/+ /
      '
    sed 's/^/- /' "${work_dir}/build-list"
  } | \
    sort -k2 -k1,1 | \
    uniq -uf1
} | \
  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"