From 25fb200ccb01a8564ad6f3a62fad02e3abe3c45e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 24 Oct 2017 15:42:44 +0200 Subject: bin/get-assignment: repair in case of only-broken-packages-available (but remove nice logic to hand out the package which breaks the most unlocked loops) --- bin/get-assignment | 73 +++++++----------------------------------------------- 1 file changed, 9 insertions(+), 64 deletions(-) (limited to 'bin/get-assignment') diff --git a/bin/get-assignment b/bin/get-assignment index fc56398..1013265 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -112,6 +112,7 @@ fi # 1st: prefered packages on the build list which have all dependencies met # 2nd: unbroken packages on the build list which have all dependencies met # 3rd: unbroken packages breaking a loop +# 4th: broken packages which have all dependencies met or break a loop for iteration in 'prefered' 'fresh' 'loops' 'broken'; do @@ -150,6 +151,14 @@ for iteration in 'prefered' 'fresh' 'loops' 'broken'; do sort -u > \ "${tmp_dir}/hand-out-only-these-packages" ;; + 'broken') + hand_out_broken=true + hand_out_loop=true + grep -vxF 'break_loops' "${work_dir}/build-list" | \ + cut -d' ' -f1 | \ + sort -u > \ + "${tmp_dir}/hand-out-only-these-packages" + ;; esac grep -vxF 'break_loops' "${work_dir}/build-list" | \ @@ -194,70 +203,6 @@ for iteration in 'prefered' 'fresh' 'loops' 'broken'; do done -# Find package (of all packages which are not locked and have been broken the least times) -# which breaks the most unlocked loops - -locked_packages=$( - find "${work_dir}/package-states/" -maxdepth 1 -printf '%f\n' | \ - sed ' - s|\(\.[0-9a-f]\{40\}\)\{2\}\.[^\.\]\+\.locked$|| - t - d - ' -) - -grep -vxF 'break_loops' "${work_dir}/build-list" | \ - sort -k1,1 > \ - "${tmp_dir}/build-list.sorted-by-package" - -for package in $( - # shellcheck disable=SC2030 - find "${work_dir}/build-list.loops/" -maxdepth 1 | \ - grep '/loop_[0-9]\+$' | \ - while read -r loop; do - if [ -z "$( - ( - cat "${loop}" - echo "${locked_packages}" - ) | \ - sort | \ - uniq -d - )" ]; then - cat "${loop}" - fi - done | \ - sort | \ - uniq -c | \ - join -1 2 -2 1 -o 1.1,2.1,2.2,2.3,2.4 \ - - \ - "${tmp_dir}/build-list.sorted-by-package" | \ - while read -r count package git_revision git_mod_revision repository; do - if [ -f "${work_dir}/package-states/${package}.${git_revision}.${git_mod_revision}.${repository}.broken" ]; then - trials=$( - wc -l < \ - "${work_dir}/package-states/${package}.${git_revision}.${git_mod_revision}.${repository}.broken" - ) - else - trials='0' - fi - printf '%s %s %s.%s.%s.%s\n' \ - "${trials}" \ - "${count}" \ - "${package}" \ - "${git_revision}" \ - "${git_mod_revision}" \ - "${repository}" - done | \ - sort -k1n,1 -k2nr,2 | \ - cut -d' ' -f3 -); do - # shellcheck disable=SC2046,SC2031 - hand_out_assignment $( - echo "${package}" | \ - sed 's|\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)$| \1 \2 \3|' - ) -done - # Remove the lock file >&2 echo 'come back later - there are still packages to be built, but currently none has all its dependencies ready' -- cgit v1.2.3-54-g00ecf