summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2024-06-22 09:22:18 +0200
committerErich Eckner <git@eckner.net>2024-06-22 09:22:18 +0200
commitdeb94180c670aa90043dc6e32c509acabd33ad77 (patch)
tree06e14b403f225dbc4f992f8f432502f29a20fbb9
parent2a97960d0c4217025c15fc03efd1ce7d3748c4c1 (diff)
downloadarchlinuxewe-deb94180c670aa90043dc6e32c509acabd33ad77.tar.xz
improve build-all-with-docker:
* locking * pull git * commit package updates from makepkg * only run on clean git
-rw-r--r--.gitignore1
-rwxr-xr-xbuild-all-with-docker34
2 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e334bd4c2..78694ac61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,4 @@ src
trunk
*.deb
.idea
+build-all-with-docker.lock
diff --git a/build-all-with-docker b/build-all-with-docker
index f7dc4f9d5..f3089b4fe 100755
--- a/build-all-with-docker
+++ b/build-all-with-docker
@@ -2,6 +2,28 @@
cd "$(dirname "$(readlink -e "$0")")"
+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 [ -n "$(git status --porcelain)" ]; then
+ >&2 echo 'git is not clean'
+ exit 1
+fi
+
ids=$(
for pkg in */PKGBUILD; do
cd "${pkg%/PKGBUILD}"
@@ -12,7 +34,19 @@ ids=$(
| tee /dev/stderr
)
+check_and_commit_package_updates() {
+ [ -z "$(git status --porcelain)" ] && return
+ for pkg in $(git status --porcelain | sed 's@/.*$//'); do
+ cd "$pkg"
+ ../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