Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/filter-build-logs
blob: 54e13d8ed4d839fd3f22dbd015153fbf313fd091 (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
#!/bin/sh

# filter content of build-logs for display on the webserver

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

{
  printf '%s\n' \
    '<html>' \
    '<head>' \
    '<title>Output of namcap of successful builds</title>' \
    '<link rel="stylesheet" type="text/css" href="/static/style.css">' \
    '</head>' \
    '<body>' \
    '<table>'
  printf '<tr>'
  printf '<th>%s</th>' \
    'package' \
    'type' \
    'message'
  printf '</tr>\n'
  find "${build_log_directory}/success" -maxdepth 1 -name '*.build-log.gz' -printf '%p\n' | \
    while read -r log; do
      zcat "${log}" | \
        sed -n '
          /^Checking PKGBUILD$/{
            :a
              $!{
                N
                ba
              }
              p
          }
        '
    done | \
    sed '
      /^Checking \(PKGBUILD\|\S\+\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\)$/d
      / on your system is a testing release$/d
      s/^PKGBUILD\s\+(\([^) ]\+\))\s\+/\1 /
    ' | \
    sort -u | \
    while read -r a b c; do
      b="${b%:}"
      if [ "${b}" = 'E' ]; then
        left='<font color="red">'
        right='</font>'
      else
        unset left
        unset right
      fi
      printf '<tr>'
      printf '<td>%s</td>' \
        "${left}${a}${right}" "${left}${b}${right}" "${left}${c}${right}"
      printf '</tr>\n'
    done
  printf '%s\n' \
    '</table>' \
    '</body>' \
    '</html>'
} > \
  "${webserver_directory}/namcap-outputs.html"