From 62f871fb25b70860364b0023745c0f31516e69d0 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 22 May 2023 16:22:29 +0200 Subject: make shellcheck happy --- bin/get-package-updates | 62 ++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 26 deletions(-) (limited to 'bin/get-package-updates') diff --git a/bin/get-package-updates b/bin/get-package-updates index d67d45a..d791453 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -108,6 +108,8 @@ fi # delete_package arch package repository # mark $arch/$package for deletion + +# shellcheck disable=SC3043 delete_package() { local architecture="$1" local pkgbase="$2" @@ -190,14 +192,18 @@ delete_package() { } # check_if_package_should_be_deleted $pkgbase $repository + +# shellcheck disable=SC3043 check_if_package_should_be_deleted() { local pkgbase="$1" local repository="$2" >&2 printf 'check_if_package_should_be_deleted %s %s\n' "${pkgbase}" "${repository}" + # shellcheck disable=SC2154 if git -C "${repo_paths__archlinux32}" archive "${new_repo_revisions__archlinux32}" -- "${repository}/${pkgbase}" >/dev/null 2>&1; then return 1 fi for considered_architecture in 'any' 'x86_64'; do + # shellcheck disable=SC2154 if git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- "${repository}-${considered_architecture}/${pkgbase}" >/dev/null 2>&1; then return 1 fi @@ -309,28 +315,29 @@ echo 'Check modified packages from the last update, and put them to the build li | grep -vF -- '-staging-' \ | sort -u ) - diff <( - { - printf 'SELECT `package_sources`.`pkgbase`,' - printf '`package_sources`.`git_revision`,' - printf '`upstream_repositories`.`name`' - printf ' FROM `package_sources`' - mysql_join_package_sources_upstream_repositories - } \ - | mysql_run_query \ - | tr '\t' ' ' \ - | sort -u - ) <( - for directory in ${directories}; do - git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- "${directory}" \ - | tar -Ox \ - | cut -d' ' -f1,4 \ - | sed ' - s@$@ '"${directory%-*}"'@ - ' - done \ - | sort -u - ) \ + # shellcheck disable=SC2016 + { + printf 'SELECT `package_sources`.`pkgbase`,' + printf '`package_sources`.`git_revision`,' + printf '`upstream_repositories`.`name`' + printf ' FROM `package_sources`' + mysql_join_package_sources_upstream_repositories + } \ + | mysql_run_query \ + | tr '\t' ' ' \ + | sort -u \ + > "${tmp_dir}/mysql-packages" + for directory in ${directories}; do + git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- "${directory}" \ + | tar -Ox \ + | cut -d' ' -f1,4 \ + | sed ' + s@$@ '"${directory%-*}"'@ + ' + done \ + | sort -u \ + > "${tmp_dir}/upstream-packages" + diff "${tmp_dir}/mysql-packages" "${tmp_dir}/upstream-packages" \ | grep '^[<>]' \ | awk '{print $1 " " $3 " " $2 " " $4}' \ | sort -k3,3 -k1r,1 \ @@ -349,8 +356,8 @@ echo 'Check modified packages from the last update, and put them to the build li fi printf '%s %s %s %s\n' "${pkgbase}" "${repository}" "${git_revision}" "${mod_git_revision}" done - exit 1 - git -C "${repo_paths__archlinux32}" diff "${old_repo_revisions__archlinux32}^^" "${new_repo_revisions__archlinux32}" --name-status \ + # shellcheck disable=SC2154 + git -C "${repo_paths__archlinux32}" diff "${old_repo_revisions__archlinux32}" "${new_repo_revisions__archlinux32}" --name-status \ | tr '\t/' ' ' \ | cut -d' ' -f1,2,3 \ | sed ' @@ -368,13 +375,16 @@ echo 'Check modified packages from the last update, and put them to the build li mode='>' fi git_revision=$( + # shellcheck disable=SC2046 git -C "${repo_paths__state}" archive "${new_repo_revisions__state}" -- $( printf '%s\n' "${directories}" \ | grep '^'"${repository}"'-' ) \ | tar -Ox \ | sort -k1,1 \ - | join -1 1 -2 1 -o 1.4 - <(echo "${pkgbase}") + > "${tmp_dir}/git-revisions" + echo "${pkgbase}" \ + | join -1 1 -2 1 -o 1.4 "${tmp_dir}/git-revisions" - ) if [ -z "${git_revision}" ]; then git_revision='0000000000000000000000000000000000000000' @@ -382,7 +392,7 @@ echo 'Check modified packages from the last update, and put them to the build li if [ ${#git_revision} != 40 ] \ || printf '%s\n' "${git_revision}" \ | grep -vq '[0-9]'; then - >&2 printf 'invalid git revision "%s"\n' + >&2 printf 'invalid git revision "%s"\n' "${git_revision}" exit 1 fi printf '%s %s %s %s\n' "${pkgbase}" "${repository}" "${git_revision}" "${new_repo_revisions__archlinux32}" -- cgit v1.2.3-54-g00ecf