blob: 0567b212e98b349e61231c178312d6aa1ba26311 (
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
|
#!/bin/bash
cd "$(dirname "$(readlink -e "$0")")"
shutdownasap_progress=$(shutdownasap -g || echo 'none')
if [ "${shutdownasap_progress}" != 'none' ]; then
>&2 printf 'shutdownasap in progress: %s\n' "${shutdownasap_state}"
exit 1
fi
if [ $# -eq 1 ] \
&& [ -z "${1##*/PKGBUILD}" ] \
&& [ -f "$1" ]; then
cd "${1%/PKGBUILD}"
../addPkgbuildPatch add
{
printf '%s-build:latest\n' arch artix
printf 'arch32-%s-build\n' i486 i686 pentium4
} \
| shuf \
| xargs -rn1 docker run --rm -d -v .:/build
exit
fi
exec 9> build-all-with-docker.lock
if ! flock -n 9; then
>&2 echo 'another build-all-with-docker still holds the lock'
exit 1
fi
if [ "x$1" = 'x--pull' ]; then
shift
if ! git pull --ff-only; then
if ! git pull --rebase \
&& git push; then
>&2 echo 'cannot push/pull'
exit 1
fi
fi
fi
if [ $# -ne 0 ]; then
>&2 printf 'too many parameters:'
>&2 printf ' "%s"' "$@"
>&2 printf '\n'
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
>&2 echo 'git is not clean'
exit 1
fi
ids=$(
parallel "$0" ::: */PKGBUILD \
| tee /dev/stderr
)
check_and_commit_package_updates() {
[ -z "$(git status --porcelain)" ] && return
for pkg in $(
git status --porcelain \
| sed '
s@^.. @@
s@/[^/]\+$@@
' \
| grep -vxFf <(
docker ps --format '{{.Mounts}}' --no-trunc \
| sed 's@^.*/@@'
)
); do
if ! [ -d "$pkg" ]; then
>&2 echo "$pkg is not a directory"
continue
fi
cd "$pkg"
../addPkgbuildPatch del
[ -n "$(git status --porcelain -- .)" ] \
&& ../commit-package -a \
&& git push
cd ..
done
}
while docker ps --no-trunc | grep -wF "${ids}"; do
sleep 10
check_and_commit_package_updates
date
done
check_and_commit_package_updates
|