summaryrefslogtreecommitdiff
path: root/bin/build-master-status
blob: a3fcb5e8330d7f4a44483fd5c6ca9e8f6f2e3231 (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
#!/bin/bash

# report about status of build master

. "${0%/*}/../conf/default.conf"

stable="$(
  find "${master_mirror_directory}/i686/" \( -name '*testing' -o -name '*staging' \) -prune -o -name '*.pkg.tar.xz' -print | \
    wc -l
  )"
tasks="$(
  wc -l < \
    "${work_dir}/build-list"
  )"
staging="$(
  find "${master_mirror_directory}/i686/staging" -name '*.pkg.tar.xz' | \
    wc -l
  )"
testing="$(
  find "${master_mirror_directory}/i686/"*testing -name '*.pkg.tar.xz' | \
    wc -l
  )"
broken="$(
  ls "${work_dir}/package-states/" | \
    grep -c '\.broken$'
  )" || true
loops="$(
  ls "${work_dir}/build-list.loops" | \
    grep -c '^loop_[0-9]\+$'
  )" || true
looped_packages="$(
  ls "${work_dir}/build-list.loops" | \
    grep '^loop_[0-9]\+$' | \
    sed "s|^|${work_dir}/build-list.loops/|" | \
    xargs -r cat | \
    sort -u | \
    wc -l
  )"

printf 'The mirror master contains %d stable packages (vs. ca. %d planned).\n' \
  "${stable}" \
  "$[${staging}+${testing}+${tasks}]"
printf 'The build list contains %d tasks (incl. broken: %d).\n' \
  "$[${tasks}-${broken}]" \
  "${tasks}"
printf 'There are %d testing and %d staging packages.\n' \
  "${testing}" \
  "${staging}"
printf 'There are %d broken packages.\n' \
  "${broken}"
if [ "${loops}" -ne 0 ]; then
  printf 'There are %d loops containing %d packages.\n' \
    "${loops}" \
    "${looped_packages}"
fi
if [ $[${broken}+${testing}+${staging}] -ne 0 ]; then
  printf '%.1f%% of all packages are broken.\n' \
    "$(bc <<< "scale=10; 100*${broken}/(${broken}+${testing}+${staging})")"
fi
if [ $[${testing}+${staging}+${tasks}-${broken}] -ne 0 ]; then
  printf '%.1f%% of the planned work has been done.\n' \
    "$(bc <<< "scale=10; 100*(${testing}+${staging})/(${testing}+${staging}+${tasks}-${broken})")"
fi