Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/check-bugtracker
blob: 72ab133fe607d241f1eadc982cbaa8711919718d (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
#!/bin/sh

# check the bug tracker for packages in testing and community-testing
# with issues and mark these packages as "has_issues" if they are faulty
# and vice versa

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

bug_list=$(
  curl -LSs 'https://bugs.archlinux32.org/index.php?export_list=Export%20Tasklist' | \
    sed -n '
      1d
      s/^[^,]\+,"//
      T
      s/^\([^"]\+\)"\(,[^,]\+\)\{2\},"\([^"]\+\)".*$/"\1" "\3"/
      T
      p
    '
)

# shellcheck disable=SC2016
{
  printf 'SELECT `repository_stabilities`.`id`,`repository_stabilities`.`bugtracker_category`'
  printf ' FROM `repository_stabilities`'
  printf ' WHERE NOT `repository_stabilities`.`bugtracker_category` IS NULL'
} | \
  ${mysql_command} --raw --batch | \
  sed '1d' | \
  while read -r stability_id category; do
    for has_issues in '1:' '0:NOT '; do
      printf 'UPDATE `binary_packages`'
      printf ' JOIN `repositories` ON `repositories`.`id`=`binary_packages`.`repository`'
      printf ' SET `has_issues`=%s' \
        "${has_issues%:*}"
      printf ' WHERE `repositories`.`stability`=%s' \
        "${stability_id}"
      printf ' AND `binary_packages`.`pkgname` %sIN (' \
        "${has_issues#*:}"
      printf '%s\n' "${bug_list}" | \
        sed -n '
          s/^"'"$(str_to_regex "${category}")"'" //
          T
          :a
            /\[.*]/ {
              s/^[^[]*\[//
              T
              h
              s/].*$//
              p
              x
              ba
            }
        ' | \
        base64_encode_each | \
        sed '
          s/^/from_base64("/
          s/$/")/
        ' | \
        tr '\n' ','
      printf '"");\n'
    done
  done | tee /dev/stderr | \
  ${mysql_command}