diff options
-rwxr-xr-x | bin/get-assignment | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/bin/get-assignment b/bin/get-assignment index e46dd39..2ef8556 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -108,41 +108,54 @@ fi # Find first package of build-list whose dependencies are all met -while read -r package git_revision mod_git_revision repository; do +for hand_out_broken in false true; do + + while read -r package git_revision mod_git_revision repository; do + + if [ -z "${git_revision}${mod_git_revision}${repository}" ] && \ + [ "${package}" = 'break_loops' ]; then + if ${hand_out_broken}; then + sed -i \ + '/^break_loops$/d' \ + "${work_dir}/build-list" + echo 'break_loops' >> \ + "${work_dir}/build-list" + break + else + continue + fi + fi - if [ -z "${git_revision}${mod_git_revision}${repository}" ] && \ - [ "${package}" = 'break_loops' ]; then - sed -i \ - '/^break_loops$/d' \ - "${work_dir}/build-list" - echo 'break_loops' >> \ - "${work_dir}/build-list" - break - fi + if package_locked_or_blocked "${package}" "${git_revision}" "${mod_git_revision}" "${repository}"; then + continue + fi - if package_locked_or_blocked "${package}" "${git_revision}" "${mod_git_revision}" "${repository}"; then - continue - fi + if ! ${hand_out_broken} && \ + [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.broken" ]; then + continue + fi - [ -z "$( - ( - cat "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.needs" - grep -vxF 'break_loops' "${work_dir}/build-list" | \ - awk '{print $1 "." $2 "." $3}' | \ - sed " - s|^|${work_dir}/package-infos/| - s|\$|\.builds| - " | \ - xargs -r cat | \ - sort -u - ) | \ - sort | \ - uniq -d - )" ] || continue - - hand_out_assignment "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" + [ -z "$( + ( + cat "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.needs" + grep -vxF 'break_loops' "${work_dir}/build-list" | \ + awk '{print $1 "." $2 "." $3}' | \ + sed " + s|^|${work_dir}/package-infos/| + s|\$|\.builds| + " | \ + xargs -r cat | \ + sort -u + ) | \ + sort | \ + uniq -d + )" ] || continue + + hand_out_assignment "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" + + done < "${work_dir}/build-list" -done < "${work_dir}/build-list" +done # Find package (of all packages which are not locked and have been broken the least times) # which breaks the most unlocked loops |