Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/manual-fix
blob: f9cc7b9dfc2a2fa22ac9542d2016b9db48d31f59 (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
#!/bin/bash

# shellcheck disable=SC2119,SC2120

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

eval "$(
  declare -F \
  | sed '
    s@^declare -f _fix_@unset _fix_@
    t
    d
  '
)"

_fix_package_on_build_and_deletion_list() {
  # shellcheck disable=SC2016
  {
    printf 'DELETE `bin_del`'
    printf ' FROM `binary_packages` AS `bin_del`'
    mysql_join_binary_packages_binary_packages_in_repositories 'bin_del' 'bir_del'
    mysql_join_binary_packages_in_repositories_repositories 'bir_del' 'r_del'
    printf ' AND `r_del`.`name`="deletion-list"'
    printf ' JOIN `binary_packages` AS `bin_keep`'
    printf ' ON `bin_keep`.`pkgname`=`bin_del`.`pkgname`'
    printf ' AND `bin_del`.`architecture`=`bin_keep`.`architecture`'
    printf ' AND `bin_del`.`id`!=`bin_keep`.`id`'
    printf ' AND `bin_keep`.`sha512sum` IS NULL'
    mysql_join_binary_packages_binary_packages_in_repositories 'bin_keep' 'bir_keep'
    mysql_join_binary_packages_in_repositories_repositories 'bir_keep' 'r_keep'
    printf ' AND `r_keep`.`name`="build-list"'
  } \
  | mysql_run_query
}

usage() {
  # shellcheck disable=SC2016
  >&2 printf 'usage: %s $issue\n\n' "${0##*/}"
  >&2 printf 'Manually fix an issue.\n\n'
  >&2 printf 'fixable issues:\n'
  declare -F \
  | sed '
    s@^declare -f _fix_@  @
    t
    d
  ' >&2
  exit 1
}

if [ $# -ne 1 ] || ! declare -f "_fix_$1" >/dev/null; then
  usage
fi

eval "_fix_$1"