summaryrefslogtreecommitdiff
path: root/bin/cleanup
blob: e31dbb3121e090188c44c509bdef24cdaa665747 (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
#!/bin/bash

# clean up unnecessary data

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

if ! "${base_dir}/bin/sanity-check" -r; then
  >&2 echo 'Build master is not sane.'
  exit 1
fi

(
  ls '/srv/http/build-logs' | \
    sed 's|\.[^.]\+\.build-log\.gz$||' | \
    sort -u
  ls "${work_dir}/package-states" | \
    grep '\.broken$\|\.locked$' | \
    sed '
      s|\.[^.]\+$||
      p
    '
) | \
  sort | \
  uniq -u | \
  while read -r s t; do
    rm -f "/srv/http/build-logs/${s}."*
  done