index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-11-06 09:54:59 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-11-06 09:54:59 +0100 |
commit | a50e9f62a28d334fd7291b80d06cfa1c93a81e4b (patch) | |
tree | e37b6cb6fabe0815a75ab267b3d6089d1e2a57d2 /bin/return-assignment | |
parent | 3ef05ada8b116d41cd6c328babb9bf0a7ce55baa (diff) |
-rwxr-xr-x | bin/return-assignment | 63 |
diff --git a/bin/return-assignment b/bin/return-assignment index 7fb6005..36875bc 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -54,8 +54,8 @@ if [ "$5" = 'ERROR' ]; then fi # shellcheck disable=SC2154 - if [ "${slave}" != "$(head -n1 "${work_dir}/package-states/$1.$2.$3.$4.locked")" ]; then - # whoops, this package is built by someone else + if ! grep -qxF "${slave}" "${work_dir}/package-states/$1.$2.$3.$4.locked"; then + # whoops, this package is not built by this slave exit 0 fi @@ -67,31 +67,38 @@ if [ "$5" = 'ERROR' ]; then --transform="s|^|$1.$2.$3.$4.|" \ '*.build-log.gz' - head -n1 \ - "${work_dir}/package-states/$1.$2.$3.$4.locked" >> \ + # shellcheck disable=SC2154 + echo "${slave}" >> \ "${work_dir}/package-states/$1.$2.$3.$4.broken" - rm "${work_dir}/package-states/$1.$2.$3.$4.locked" - - # unlock every loop this package would have broken and which is not - # broken by another locked package - locked_packages=$( - find "${work_dir}/package-states/" -maxdepth 1 -name '*.locked' -printf '%f\n' | \ - sed 's@^\(.\+\)\.\([0-9a-f]\{40\}\.\)\{2\}[^.]\+\.locked$@\1@' - ) - find "${work_dir}/build-list.loops" -maxdepth 1 -regextype grep \ - -regex '.*/loop_[0-9]\+' \ - -exec grep -qxF "$1" '{}' \; \ - -not -exec grep -qxF "${locked_packages}" '{}' \; \ - -exec rm '{}.locked' \; - - # move build order to end of build list - - sed -i \ - "/^$(str_to_regex "$1 $2 $3 $4")\$/d" \ - "${work_dir}/build-list" - echo "$1 $2 $3 $4" >> \ - "${work_dir}/build-list" + # shellcheck disable=SC2154 + sed -i ' + /^'"$(str_to_regex "${slave}")"'$/d + ' "${work_dir}/package-states/$1.$2.$3.$4.locked" + if [ ! -s "${work_dir}/package-states/$1.$2.$3.$4.locked" ]; then + rm "${work_dir}/package-states/$1.$2.$3.$4.locked" + + # unlock every loop this package would have broken and which is not + # broken by another locked package + locked_packages=$( + find "${work_dir}/package-states/" -maxdepth 1 -name '*.locked' -printf '%f\n' | \ + sed 's@^\(.\+\)\.\([0-9a-f]\{40\}\.\)\{2\}[^.]\+\.locked$@\1@' + ) + find "${work_dir}/build-list.loops" -maxdepth 1 -regextype grep \ + -regex '.*/loop_[0-9]\+' \ + -exec grep -qxF "$1" '{}' \; \ + -not -exec grep -qxF "${locked_packages}" '{}' \; \ + -exec rm '{}.locked' \; + + # 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" + fi exit 0 @@ -118,6 +125,12 @@ if ! grep -qxF "$1 $2 $3 $4" "${work_dir}/build-list" || exit 2 fi +# shellcheck disable=SC2154 +if ! grep -qxF "${slave}" "${work_dir}/package-states/$1.$2.$3.$4.locked"; then + >&2 echo 'Whoops, this package is not built by this slave.' + exit 2 +fi + clean_up_tmp_dir() { cd "${base_dir}" rm -rf --one-file-system "${tmp_dir}" |