Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-04-23 03:02:39 +0200
committerErich Eckner <git@eckner.net>2017-04-23 03:02:39 +0200
commitfb2d88eadb604263bb03e3746944efd280edd563 (patch)
treeb1202b59b0a16d6c2fd85f5ed57cf4ac6db2d8e8
parent714d4fca05fab186f35e95a4d05bec9c5d38c646 (diff)
bin/get-assignment new
-rwxr-xr-xbin/get-assignment65
1 files changed, 65 insertions, 0 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
new file mode 100755
index 0000000..138d089
--- /dev/null
+++ b/bin/get-assignment
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# receive one package to be built from the build-list whose dependencies
+# are already satisfied or which breaks a dependency cycle
+
+# TODO:
+# respect build-manually-list
+
+. "${0%/*}/../conf/default.conf"
+
+mkdir -p "${work_dir}/package-states"
+
+hand_out_assignment() {
+
+ if [ -f "${work_dir}/package-states/$1.$2.$3.locked" ]; then
+ return 0
+ fi
+
+ echo "$1 $2 $3"
+ echo "${SSH_CLIENT}" > "${work_dir}/package-states/$1.$2.$3.locked"
+
+ rm -f "${lock_file}"
+ exit 0
+
+}
+
+# Create a lock file.
+
+exec 9> "${lock_file}"
+flock -n 9 || exit
+
+while read -r package git_revision repository; do
+
+ [ -z "$(
+ (
+ cat "${work_dir}/package-infos/${package}."*".needs"
+ awk '{print $1}' "${work_dir}/build-list"
+ ) | \
+ sort | \
+ uniq -d
+ )" ] || continue
+
+ hand_out_assignment "${package}" "${git_revision}" "${repository}"
+
+done < "${work_dir}/build-list"
+
+if [ -s "${work_dir}/tsort.error" ]; then
+
+ grep -A1 '^tsort: -: input contains a loop:$' "${work_dir}/tsort.error" | \
+ cut -d' ' -f2 | \
+ grep -v -- '^-:$' | \
+ while read package; do
+
+ grep "^${package} " "${work_dir}/build-list" | \
+ while read -r package git_revision repository; do
+ hand_out_assignment "${package}" "${git_revision}" "${repository}"
+ done
+
+ done
+
+fi
+
+# Remove the lock file
+
+rm -f "${lock_file}"