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

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

# shellcheck disable=SC2119,SC2120

# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"

# TODO: remove hard-coded package suffixes

{
  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>' \
    '&nbsp;' \
    'package' \
    'type' \
    'message'
  printf '</tr>\n'
  find "${build_log_directory}/success" -maxdepth 1 \
    -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log\.gz' \
    -execdir zcat {} \; | \
    sed '
      /^Checking \(PKGBUILD\|\S\+\(-[^-]\+\)\{3\}\.pkg\.\('"${package_compression_suffix_regex}"'\)\)$/d
      / on your system is a testing release$/d
      s/^PKGBUILD\s\+(\([^) ]\+\))\s\+/\1 /
      s/^./\0 /
    ' | \
    sort -u | \
    sort -k2,2 -k3,3 -k1,1 -k4 | \
    while read -r a b c d; do
      c="${c%:}"
      if [ "${c}" = 'E' ]; then
        color='FF'
      else
        color='80'
      fi
      case "${a}" in
        '+')
          color="${color}0000"
        ;;
        '-')
          color="00${color}00"
        ;;
        *)
          color="0000${color}"
      esac
      printf '<tr>'
      printf '<td><font color="#'"${color}"'">%s</font></td>' \
        "${a}" "${b}" "${c}" "${d}"
      printf '</tr>\n'
    done
  printf '%s\n' \
    '</table>' \
    '</body>' \
    '</html>'
} > \
  "${webserver_directory}/namcap-outputs.html"

{
  printf '%s\n' \
    '<html>' \
    '<head>' \
    '<title>packages with text relocations</title>' \
    '</head>' \
    '<body>'
  find "${webserver_directory}/build-logs/success" -name '*-namcap.log.gz' \
    -exec zgrep -q '^[+*].*\sELF file (.*) has text relocations\.$' '{}' \; \
    -printf '%f\n' | \
    sort | \
    sed '
      s|-namcap\.log\.gz$|<br>|
    '
  printf '%s\n' \
    '</body>' \
    '</html>'
} > \
  "${webserver_directory}/text-relocations-packages.html"