diff options
author | Erich Eckner <git@eckner.net> | 2017-12-18 10:22:18 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-12-18 10:22:18 +0100 |
commit | 438a1a8cbc06740b16fb55db1030692148142586 (patch) | |
tree | 4623db890832b399c32c1305630aa15fe4fd9e9c | |
parent | 52a6a5cbed2b5622e90473d01971eafaf12ec150 (diff) | |
download | builder-438a1a8cbc06740b16fb55db1030692148142586.tar.xz |
bin/*: satisfy shellcheck
-rwxr-xr-x | bin/build-master-status | 2 | ||||
-rwxr-xr-x | bin/common-functions | 14 | ||||
-rwxr-xr-x | bin/db-update | 2 | ||||
-rwxr-xr-x | bin/get-assignment | 4 | ||||
-rwxr-xr-x | bin/get-package-updates | 18 | ||||
-rwxr-xr-x | bin/return-assignment | 4 | ||||
-rwxr-xr-x | bin/show-dependencies | 24 | ||||
-rwxr-xr-x | bin/strict-bashism-check | 12 | ||||
-rwxr-xr-x | bin/why-dont-you | 8 |
9 files changed, 38 insertions, 50 deletions
diff --git a/bin/build-master-status b/bin/build-master-status index b456adc..03e878e 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -375,7 +375,7 @@ if ${web}; then "$( # shellcheck disable=SC2010 ls -t "${webserver_directory}/build-logs/error" | \ - grep -m1 "^$(str_to_regex "${sf}.")[^.]\+\.build-log\.gz\$" + grep -m1 '^'"$(str_to_regex "${sf}.")"'[^.]\+\.build-log\.gz$' )" \ "$( { diff --git a/bin/common-functions b/bin/common-functions index 0cd03e1..8e269a7 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -831,10 +831,10 @@ find_dependencies_on_build_list() { cat "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.${repository}.build-depends" awk '{print $1 "." $2 "." $3 "." $4}' < \ "${work_dir}/build-list" | \ - sed " - s|^|${work_dir}/package-infos/| - s|\$|\.builds| - " | \ + sed ' + s|^|'"${work_dir}"'/package-infos/| + s|$|\.builds| + ' | \ xargs -r cat | \ sort -u } | \ @@ -875,11 +875,11 @@ download_sources_by_hash() { for arch_suffix in '' '_i686'; do for sum_type in 'sha256sum' 'sha512sum'; do - grep "^\s*${sum_type}s${arch_suffix} = " "${tmp_dir}/.SRCINFO" | \ + grep '^\s*'"${sum_type}s${arch_suffix}"' = ' "${tmp_dir}/.SRCINFO" | \ sed 's|^.* = ||' | \ cat -n > \ "${tmp_dir}/sums" - grep "^\s*source${arch_suffix} = " "${tmp_dir}/.SRCINFO" | \ + grep '^\s*source'"${arch_suffix}"' = ' "${tmp_dir}/.SRCINFO" | \ sed ' s|^.* = || s|::.*$|| @@ -1135,7 +1135,7 @@ smoothen_namcap_log() { s|i[34567]86|$ARCH|g s|x86\([-_]64\)\?|$ARCH|g # remove haskell hashes - '"s|\('[^']*-[0-9.]\+\)-[a-zA-Z0-9]\{1,22\}\(-ghc[^']*'\)|\1\2|g"' + s|\('"'"'[^'"'"']*-[0-9.]\+\)-[a-zA-Z0-9]\{1,22\}\(-ghc[^'"'"']*'"'"'\)|\1\2|g ' | \ sort | \ sponge "${file}" diff --git a/bin/db-update b/bin/db-update index 44be174..84cb2e0 100755 --- a/bin/db-update +++ b/bin/db-update @@ -313,7 +313,7 @@ move_packages() { else # remove old state files of $package with ending $rm_ending find "${work_dir}/package-states" -maxdepth 1 -regextype grep \ - -regex ".*/$(str_to_regex "${package%.*.*.*}")\(\.[^.]\+\)\{3\}\.${rm_ending}" \ + -regex '.*/'"$(str_to_regex "${package%.*.*.*}")"'\(\.[^.]\+\)\{3\}\.'"${rm_ending}" \ -execdir ${dummynator} rm {} \; ${dummynator} mv \ "${work_dir}/package-states/${package}.${from_ending}" \ diff --git a/bin/get-assignment b/bin/get-assignment index 82463a8..00d32fd 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -27,8 +27,8 @@ hand_out_assignment() { # we don't care anymore if an older version of this package was # "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.")[^.]\+" \ + -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 diff --git a/bin/get-package-updates b/bin/get-package-updates index 51d4651..e49d37c 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -200,7 +200,7 @@ for repo in ${repo_names}; do # shellcheck disable=SC2016 sed 's|^\(.\t\)\([^/]\+\)/\([^/]\+\)/\(.\+\)$|\2 \1\3/repos/\2-x86_64/\4|' | \ while read -r pkg_repo rest; do - eval "printf '%s %s\n'" \ + eval 'printf '"'"'%s %s\n'"'" \ "$(printf '"${new_repo_revisions__%s}"' "$(find_git_repository_to_package_repository "${pkg_repo}")")" \ "'${rest}'" done @@ -371,19 +371,19 @@ find "${work_dir}/package-infos/" -maxdepth 1 -name '*.builds' -printf '%f\n' | sort -k1,1 > \ "${tmp_dir}/newest-revisions" -sed " - s|^\S\+ |${work_dir}/package-infos/| - s|\$|.builds| -" "${tmp_dir}/newest-revisions" | \ +sed ' + s|^\S\+ |'"${work_dir}"'/package-infos/| + s|$|.builds| +' "${tmp_dir}/newest-revisions" | \ xargs -r cat | \ sort | \ uniq -c > \ "${work_dir}/built-packages" -sed " - s|^\S\+ |${work_dir}/package-infos/| +sed ' + s|^\S\+ |'"${work_dir}"'/package-infos/| s|\$|.build-depends| -" "${tmp_dir}/newest-revisions" | \ +' "${tmp_dir}/newest-revisions" | \ xargs -r grep -HF '' | \ sed ' s|\(\.[^.]\+\)\{4\}:\([^:]\+\)$| \2| @@ -453,7 +453,7 @@ while read -r package git_revision mod_git_revision repository; do # add "$dependency -> $pkgname" to build-order list sed "s|\$| ${package}|" "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.${repository}.build-depends" # add "base/base-devel -> $pkgname" to build-order list - printf "%s ${package}\n" 'base' 'base-devel' + printf '%s '"${package}"'\n' 'base' 'base-devel' done \ < "${work_dir}/build-list.new" \ > "${work_dir}/build-order" diff --git a/bin/return-assignment b/bin/return-assignment index 64d16d0..0b5f63d 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -278,8 +278,8 @@ done find "${work_dir}/package-states" -maxdepth 1 -regextype grep \ -not -name '*.testing' \ -not -name '*.tested' \ - -regex ".*/$(str_to_regex "$1")\(\.[^.]\+\)\{4\}" \ - -not -regex ".*/$(str_to_regex "$1.$2.$3.$4")\.[^.]\+" \ + -regex '.*/'"$(str_to_regex "$1")"'\(\.[^.]\+\)\{4\}' \ + -not -regex '.*/'"$(str_to_regex "$1.$2.$3.$4")"'\.[^.]\+' \ -exec rm '{}' \; # remove all loops which are broken by this package diff --git a/bin/show-dependencies b/bin/show-dependencies index 8677f99..9593593 100755 --- a/bin/show-dependencies +++ b/bin/show-dependencies @@ -96,7 +96,7 @@ if [ $# -eq 0 ]; then exit fi -if pgrep -f "^\S+ $0." | \ +if pgrep -f '^\S+ '"$0"'.' | \ grep -vxF "$$" >&2; then >&2 echo $$ @@ -143,7 +143,7 @@ find "${work_dir}/package-infos" -maxdepth 1 -printf '%f\n' | \ find "${work_dir}/package-infos" -maxdepth 1 -name '*.groups' -printf '%f %p\n' | \ while read -r name pf; do - xargs -r printf "${name%.*.*.*.*} %s\n" < \ + xargs -r printf "${name%.*.*.*.*}"' %s\n' < \ "${pf}" done > \ "${tmp_dir}/known-groups" @@ -151,13 +151,13 @@ find "${work_dir}/package-infos" -maxdepth 1 -name '*.groups' -printf '%f %p\n' find "${work_dir}/package-infos" -maxdepth 1 -name '*.packages' -printf '%f %p\n' | \ while read -r name pf; do grep -vxF "${name%.*.*.*.*}" "${pf}" | \ - xargs -r printf "${name%.*.*.*.*} %s\n" + xargs -r printf "${name%.*.*.*.*}"' %s\n' done > \ "${tmp_dir}/known-split-packages" find "${work_dir}/package-infos" -maxdepth 1 -name '*.run-depends' -printf '%f %p\n' | \ while read -r name pf; do - xargs -r printf "%s ${name%.*.*.*.*}\n" < \ + xargs -r printf '%s '"${name%.*.*.*.*}"'\n' < \ "${pf}" done > \ "${tmp_dir}/known-run-depends" @@ -398,10 +398,10 @@ for target_package in "$@"; do find "${tmp_dir}/neighbours" -maxdepth 1 -type f | \ while read -r file; do - sed " - s@\(^\| \)$(str_to_regex "${file##*/}")\( \|\$\)@\1<knot>\2@ - s@\(^\| \)$(str_to_regex "${file##*/}")\( \|\$\)@\1<knot>\2@ - " "${file}" | \ + sed ' + s@\(^\| \)'"$(str_to_regex "${file##*/}")"'\( \|$\)@\1<knot>\2@ + s@\(^\| \)'"$(str_to_regex "${file##*/}")"'\( \|$\)@\1<knot>\2@ + ' "${file}" | \ sort -u | \ sponge "${file}" done @@ -426,10 +426,10 @@ for target_package in "$@"; do ' "${tmp_dir}/sums" | \ join -1 1 -2 1 -o 2.2,1.2 - "${tmp_dir}/sums" | \ while read -r original replacement; do - sed -i " - s@\( \|^\)$(str_to_regex "${original}")\( \|\$\)@\1${replacement}\2@ - s@\( \|^\)$(str_to_regex "${original}")\( \|\$\)@\1${replacement}\2@ - " "${tmp_dir}/build-order" "${tmp_dir}/knots" + sed -i ' + s@\( \|^\)'"$(str_to_regex "${original}")"'\( \|$\)@\1'"${replacement}"'\2@ + s@\( \|^\)'"$(str_to_regex "${original}")"'\( \|$\)@\1'"${replacement}"'\2@ + ' "${tmp_dir}/build-order" "${tmp_dir}/knots" done grep -v '^\(\S\+\) \1$' "${tmp_dir}/build-order" | \ diff --git a/bin/strict-bashism-check b/bin/strict-bashism-check index e477213..15fff71 100755 --- a/bin/strict-bashism-check +++ b/bin/strict-bashism-check @@ -75,18 +75,6 @@ fi errors=$( cd "${tmp_dir}" || \ echo 'Cannot cd.' - checkbashisms bin/* conf/* 2>&1 -) - -if [ -n "${errors}" ]; then - >&2 echo 'possible bashisms found:' - >&2 echo "${errors}" - exit 1 -fi - -errors=$( - cd "${tmp_dir}" || \ - echo 'Cannot cd.' shellcheck -x bin/* conf/* 2>&1 ) diff --git a/bin/why-dont-you b/bin/why-dont-you index cc9bddf..c6a6138 100755 --- a/bin/why-dont-you +++ b/bin/why-dont-you @@ -140,7 +140,7 @@ case "${action}" in for pkg in "$@"; do if ! state_file=$( - grep "^$(str_to_regex "${pkg}")\(\.[^.]\+\)\{3\}\$" "${tmp_dir}/moveable-list" + grep '^'"$(str_to_regex "${pkg}")"'\(\.[^.]\+\)\{3\}$' "${tmp_dir}/moveable-list" ) || \ [ ! -f "${work_dir}/package-states/${state_file}.${suffix}" ]; then printf '"%s" is not %s yet!\n' "${pkg}" "${suffix}" @@ -225,7 +225,7 @@ case "${action}" in if builds_file=$( find "${work_dir}/package-infos" -maxdepth 1 -printf '%f\n' | \ - grep -m1 "^$(str_to_regex "${pkg}")\(\.[^.]\+\)\{3\}\.builds\$" + grep -m1 '^'"$(str_to_regex "${pkg}")"'\(\.[^.]\+\)\{3\}\.builds$' ); then builds_file="${builds_file%.*}" @@ -244,10 +244,10 @@ case "${action}" in rev=$(cat "${work_dir}/${repo}.revision") if [ "${repo}" = 'archlinux32' ]; then if git -C "${repo_path}" archive "${mod_rev}" | \ - grep -q "^[^/]\+/$(str_to_regex "${pkg}")/PKGBUILD\$"; then + grep -q '^[^/]\+/'"$(str_to_regex "${pkg}")"'/PKGBUILD$'; then prepo=$( git -C "${repo_path}" archive "${mod_rev}" | \ - grep "^[^/]\+/$(str_to_regex "${pkg}")/PKGBUILD\$" | \ + grep '^[^/]\+/'"$(str_to_regex "${pkg}")"'/PKGBUILD$' | \ cut -d/ -f1 ) found_PKGBUILD=true |