Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/get-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-06 09:54:59 +0100
committerErich Eckner <git@eckner.net>2017-11-06 09:54:59 +0100
commita50e9f62a28d334fd7291b80d06cfa1c93a81e4b (patch)
treee37b6cb6fabe0815a75ab267b3d6089d1e2a57d2 /bin/get-assignment
parent3ef05ada8b116d41cd6c328babb9bf0a7ce55baa (diff)
bin/get-assignment, bin/return-assignment: hand out build orders to multiple slaves if requested to
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment48
1 files changed, 24 insertions, 24 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index fb4e257..179487e 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -2,6 +2,7 @@
# receive one package to be built from the build-list whose dependencies
# are already satisfied or which breaks a dependency cycle
+# accepts a comma separated list of prefered packages as the first argument
# exit code shows state of success:
# 0: ok, I gave you an assignment
@@ -14,34 +15,30 @@
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
-# TODO: hand out blocked packages if they are a prefered package
-
mkdir -p "${work_dir}/package-states"
hand_out_assignment() {
- # locked and blocked packages won't be handed out
- if package_locked_or_blocked "$1" "$2" "$3" "$4"; then
- return 0
- fi
-
# we don't care anymore if an older version of this package was
- # "locked" or "broken" (we keep only marker for older "done" packages)
- find "${work_dir}/package-states" -maxdepth 1 | \
- grep "/$(str_to_regex "${1}")\(\.[^.]\+\)\{3\}\.\(locked\|broken\)\$" | \
- grep -v "/$(str_to_regex "$1.$2.$3.$4.")[^.]\+\$" | \
- xargs -rn1 rm -f
-
- {
- grep -vxF "$1 $2 $3 $4" "${work_dir}/build-list" || \
- true
- printf '%s %s %s %s\n' "$1" "$2" "$3" "$4"
- } | \
- sponge "${work_dir}/build-list"
+ # "locked" or "broken"
+ find "${work_dir}/package-states" -maxdepth 1 -regextype grep \
+ -regex ".*/$(str_to_regex "$1")\(\.[^.]\+\)\{3\}\.\(locked\|broken\)" \
+ -not -regex ".*/$(str_to_regex "$1.$2.$3.$4.")[^.]\+" \
+ -delete
+
+ # move that build order to the end of the build-list
+ sed -i '
+ /^'"$(str_to_regex "$1 $2 $3 $4")"'$/ {
+ $ b
+ d
+ }
+ $ a '"$1 $2 $3 $4"'
+ ' "${work_dir}/build-list"
echo "$1 $2 $3 $4"
# shellcheck disable=SC2154
- echo "${slave}" > "${work_dir}/package-states/$1.$2.$3.$4.locked"
+ echo "${slave}" >> \
+ "${work_dir}/package-states/$1.$2.$3.$4.locked"
# lock every loop this package breaks
find "${work_dir}/build-list.loops" -maxdepth 1 -regextype grep \
@@ -90,9 +87,12 @@ while read -r package git_revision mod_git_revision repository; do
generate_package_metadata "${package}.${git_revision}.${mod_git_revision}.${repository}"
if [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked" ]; then
- if [ "${slave}" = "$(head -n1 "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked")" ]; then
- echo "${package} ${git_revision} ${mod_git_revision} ${repository}"
- exit
+ # has this slave already got or does he prefer this assignment?
+ # note, that the dependencies are met, because this package is already locked
+ if grep -qxF "${slave}" "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked" || \
+ printf ',%s,' "$1" | \
+ grep -qF ",${package},"; then
+ hand_out_assignment "${package} ${git_revision} ${mod_git_revision} ${repository}"
fi
elif [ ! -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.blocked" ]; then
pending_packages=true
@@ -171,7 +171,7 @@ for iteration in 'prefered' 'fresh' 'loops' 'broken'; do
while read -r package git_revision mod_git_revision repository; do
- # package locked?
+ # package locked? (we have taken care of those in the previous loop)
if [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.locked" ]; then
continue
fi