From 395c60b1ce1c8bc84746ecfefba21d3234b288fa Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 23 Aug 2017 21:35:06 +0200 Subject: silence a lot shellcheck warnings --- bin/get-assignment | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'bin/get-assignment') diff --git a/bin/get-assignment b/bin/get-assignment index fd76a7f..7185a35 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -17,6 +17,7 @@ # respect build-manually-list ("blocked") +# shellcheck source=conf/default.conf . "${0%/*}/../conf/default.conf" mkdir -p "${work_dir}/package-states" @@ -30,10 +31,9 @@ hand_out_assignment() { # we don't care anymore if an older version of this package was # "locked" or "broken" (we keep only marker for older "done" packages) - ls "${work_dir}/package-states" | \ - grep "^$(str_to_regex "${1}")\(\.[^.]\+\)\{3\}\.\(locked\|broken\)\$" | \ - grep -v "^$(str_to_regex "$1.$2.$3.$4.")[^.]\+\$" | \ - sed "s|^|${work_dir}/package-states/|" | \ + 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 echo "$1 $2 $3 $4" @@ -81,7 +81,7 @@ while read -r package git_revision mod_git_revision repository; do continue fi - generate_package_metadata $package.$git_revision.$mod_git_revision.$repository + generate_package_metadata "${package}.${git_revision}.${mod_git_revision}.${repository}" if [ -f "${work_dir}/package-states/${package}.${git_revision}.${mod_git_revision}.${repository}.blocked" ]; then continue @@ -90,7 +90,7 @@ while read -r package git_revision mod_git_revision repository; do 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 - num_jobs=$((${num_jobs}+1)); + num_jobs=$((num_jobs+1)); fi else pending_packages=true @@ -150,7 +150,8 @@ for hand_out_broken in false true; do hand_out_assignment "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" - done < "${work_dir}/build-list" + done < \ + "${work_dir}/build-list" done @@ -158,7 +159,7 @@ done # which breaks the most unlocked loops locked_packages=$( - ls "${work_dir}/package-states/" | \ + find "${work_dir}/package-states/" -maxdepth 1 -printf '%f\n' | \ grep '\(\.[0-9a-f]\{40\}\)\{2\}\.[^\.\]\+\.locked$' | \ sed 's|\(\.[0-9a-f]\{40\}\)\{2\}\.[^\.\]\+\.locked$||' ) @@ -168,18 +169,19 @@ grep -vxF 'break_loops' "${work_dir}/build-list" | \ "${work_dir}/build-list.sorted-by-package" for package in $( - ls "${work_dir}/build-list.loops/" | \ - grep '^loop_[0-9]\+$' | \ + # shellcheck disable=SC2030 + find "${work_dir}/build-list.loops/" -maxdepth 1 | \ + grep '/loop_[0-9]\+$' | \ while read -r loop; do if [ -z "$( ( - cat "${work_dir}/build-list.loops/${loop}" + cat "${loop}" echo "${locked_packages}" ) | \ sort | \ uniq -d )" ]; then - cat "${work_dir}/build-list.loops/${loop}" + cat "${loop}" fi done | \ sort | \ @@ -207,6 +209,7 @@ for package in $( sort -k1n,1 -k2nr,2 | \ cut -d' ' -f3 ); do + # shellcheck disable=SC2046,SC2031 hand_out_assignment $( echo "${package}" | \ sed 's|\.\([^.]\+\)\.\([^.]\+\)\.\([^.]\+\)$| \1 \2 \3|' -- cgit v1.2.3-70-g09d2