diff options
author | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2024-07-22 18:39:26 +0200 |
---|---|---|
committer | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2024-07-22 18:39:26 +0200 |
commit | 5d41d6926f43911b5a03c68b4e79b526537d3b00 (patch) | |
tree | b3ad804dcc9251c487084fc42a7a71568b7c24f2 /build-all-with-docker | |
parent | 82ea2c895f16ef66b7c90664c83bd8fc9f1d1f3d (diff) | |
download | archlinuxewe-5d41d6926f43911b5a03c68b4e79b526537d3b00.tar.xz |
build-all-with-docker: build all in parallel
* locking is within the docker containers
Diffstat (limited to 'build-all-with-docker')
-rwxr-xr-x | build-all-with-docker | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/build-all-with-docker b/build-all-with-docker index 5c9d76adf..f3a9dee7c 100755 --- a/build-all-with-docker +++ b/build-all-with-docker @@ -24,32 +24,50 @@ if [ -n "$(git status --porcelain)" ]; then exit 1 fi -ids=() - -for pkg in */PKGBUILD; do - cd "${pkg%/PKGBUILD}" - ( +ids=$( + for pkg in */PKGBUILD; do + cd "${pkg%/PKGBUILD}" ../addPkgbuildPatch add - docker run --rm -v .:/build arch-build:latest - docker run --rm -v .:/build arch32-i486-build - docker run --rm -v .:/build arch32-i686-build - docker run --rm -v .:/build arch32-pentium4-build - docker run --rm -v .:/build artix-build:latest + docker run --rm -d -v .:/build arch-build:latest + docker run --rm -d -v .:/build arch32-i486-build + docker run --rm -d -v .:/build arch32-i686-build + docker run --rm -d -v .:/build arch32-pentium4-build + docker run --rm -d -v .:/build artix-build:latest + cd .. + done \ + | 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 "$pwd is not a directory" + continue + fi + cd "$pkg" ../addPkgbuildPatch del - [ -n "$(git status --porcelain -- PKGBUILD)" ] && ../commit-package -a && git push - ) & - ids[${#ids[@]}]=$! - cd .. -done + [ -n "$(git status --porcelain -- .)" ] \ + && ../commit-package -a \ + && git push + cd .. + done +} -while [ "${#ids[@]}" -gt 0 ]; do +while docker ps --no-trunc | grep -wF "${ids}"; do sleep 10 - ids=( - $( - ls /proc \ - | grep -xFf <(printf '%s\n' "${ids[@]}") \ - | tee /dev/stderr - ) - ) + check_and_commit_package_updates date done + +check_and_commit_package_updates |