blob: 7893c14daf19f33bd7e21a34069984d95911a4c6 (
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
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/bin/bash
# report back on a build assignment
# either on success via:
# "$0 $package $revision $mod_revision $repository" and tar'ed packages (= a tar of
# package(s) and signature(s)) on stdin
# or on failure via:
# "$0 $package $revision $mod_revision $repository ERROR"
# TODO:
# use lock file(s)
# remove old version(s) of newly compiled packages
# check that received archive contains the expected packages
. "${0%/*}/../conf/default.conf"
if [ "$5" == 'ERROR' ]; then
# the build failed on the build slave
mv "${work_dir}/package-states/$1.$2.$3.$4."{locked,broken}
# unlock every loop this package would have broken and which is not
# broken by another locked package
(
# loops broken by another locked package
ls "${work_dir}/package-states/"{*.*.*.*,$1.$2.$3.$4}.locked | \
sort | \
uniq -u | \
sed 's|\.locked$||' | \
xargs -n1 sed '1d' | \
sort -u | \
sed 'p'
# loops broken by this package
sed '1d' "${work_dir}/package-states/$1.$2.$3.$4"
) | \
sort | \
uniq -u | \
sed 's|$|.locked|' | \
xargs -rn1 rm -f
exit 0
fi
# the build was successful on the build slave
if ! grep -q "^${1//./\\.} $2 $3 $4\$" "${work_dir}/build-list"; then
>&2 echo 'Sorry, the sent package is outdated.'
exit 1
fi
function clean_up {
popd > /dev/null
rm -rf --one-file-system "${tmp_dir}"
}
tmp_dir="$(mktemp -d)"
pushd "${tmp_dir}" > /dev/null
trap clean_up EXIT
# extract package(s)
tar -x
signature_errors="$(
ls -1 *.pkg.tar.xz{,.sig} | \
sed 's|\.sig$||' | \
sort | \
uniq -c | \
grep '^\s*2\s' | \
awk '{print $2}'
)"
if [ -n "${signature_errors}" ]; then
>&2 echo 'The following packages lack a signature or vice versa:'
>&2 echo "${signature_errors}"
exit 1
fi
# move packages
packages=(*.pkg.tar.xz)
mkdir -p "${master_mirror_directory}/i486/$4-staging/"
mv "*.pkg.tar.xz{,.sig}" "${master_mirror_directory}/i486/$4-staging/"
pushd "${master_mirror_directory}/i486" > /dev/null
repo-add -v -s -k "${repo_key}" "$4-staging.db.tar.gz" "${packages[@]}"
popd > /dev/null
# remove all loops which are broken by this package
sed '1d' "${work_dir}/package-states/$1.$2.$3.$4.locked" | \
sort -u | \
sed 'p;s|$|.locked|' | \
xargs -rn1 rm -f
# remove package from build list
sed -i "/^${1//./\\.} $2 $3 $4\$/d" "${work_dir}/build-list"
# remove package lock file
rm "${work_dir}/package-states/$1.$2.$3.$4.locked"
|