Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <erich.eckner.ext@bestsecret.com>2023-05-22 16:22:29 +0200
committerErich Eckner <erich.eckner.ext@bestsecret.com>2023-05-22 16:22:29 +0200
commit62f871fb25b70860364b0023745c0f31516e69d0 (patch)
tree8efdaff49293547ee945ff0d10612187a3b06594
parentd14686b0bdc0b2418300c5d34d5f13c19988f020 (diff)
make shellcheck happy
-rwxr-xr-xbin/build-packages4
-rwxr-xr-xbin/check-opcodes10
-rwxr-xr-xbin/get-assignment1
-rwxr-xr-xbin/get-package-updates62
-rwxr-xr-xbin/ii-watch2
-rwxr-xr-xbin/manual-fix2
-rwxr-xr-xbin/prioritize-build-list2
-rwxr-xr-xbin/return-assignment1
-rwxr-xr-xlib/common-functions4
9 files changed, 51 insertions, 37 deletions
diff --git a/bin/build-packages b/bin/build-packages
index 9e41951..20cdb29 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -277,7 +277,7 @@ while [ "${count}" -ne 0 ] && \
# 0: ok, I gave you an assignment
0)
- [ ${count} -gt 0 ] && \
+ [ "${count}" -gt 0 ] && \
count=$((count-1))
arch="${package##* }"
package="${package% *}"
@@ -1164,7 +1164,7 @@ while [ "${count}" -ne 0 ] && \
done
-# remove the slave switch file if it exists (and if we are runnig on a slave)
+# remove the slave switch file if it exists (and if we are running on a slave)
if ! ${i_am_the_master}; then
SLAVE=$(whoami)
[ -f "/tmp/do-not-run-build-slave.$SLAVE" ] && rm "/tmp/do-not-run-build-slave.$SLAVE"
diff --git a/bin/check-opcodes b/bin/check-opcodes
index 2949819..48a1d45 100755
--- a/bin/check-opcodes
+++ b/bin/check-opcodes
@@ -93,7 +93,6 @@ PACKAGE=$1
if test "$PACKAGE" = ""; then
echo "ERROR: Filename of a package required as argument" >&2
usage
- exit 1
fi
OPCODE_ARGS=""
@@ -111,7 +110,6 @@ case $ARCH in
*)
echo "ERROR: architecture must currently be one of i486, i686 and pentium3" >&2
usage
- exit 1
esac
debug "Unpacking $PACKAGE to $tmp_dir.."
@@ -133,7 +131,7 @@ for absfile in $(find $tmp_dir \( -regextype grep -regex '.*\.so\(\.[0-9.]\+\)\?
continue
fi
file $absfile > $tmp_dir/$file.file
-
+
arch=$(grep ^architecture $tmp_dir/$file.objdump | sed 's/^architecture: //g' | cut -f 1 -d ,)
case $arch in
i386:x86-64)
@@ -147,7 +145,7 @@ for absfile in $(find $tmp_dir \( -regextype grep -regex '.*\.so\(\.[0-9.]\+\)\?
;;
esac
debug " Objdump architecture: $arch"
-
+
archelf=$(grep '^ \+Class' $tmp_dir/$file.elf | cut -f 2 -d : | tr -d ' ')
case $archelf in
ELF64)
@@ -165,7 +163,7 @@ for absfile in $(find $tmp_dir \( -regextype grep -regex '.*\.so\(\.[0-9.]\+\)\?
if test $arch != $archelf; then
err "ERROR: $file ambigous architecture information (objdump: $arch, ELF: $archelf)"
fi
-
+
if test $arch = "x86_64"; then
err "ERROR: $file is a 64-bit library!"
continue
@@ -193,7 +191,7 @@ for absfile in $(find $tmp_dir \( -regextype grep -regex '.*\.so\(\.[0-9.]\+\)\?
verbose "OK: $relfile fullfills architecture constraint for $ARCH"
fi
fi
-
+
done
exit $EXIT_CODE
diff --git a/bin/get-assignment b/bin/get-assignment
index 6abfaef..25281e6 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -96,6 +96,7 @@ if ! verbose_flock -s -n 8; then
fi
clean_up() {
+ # shellcheck disable=SC2317
rm -rf --one-file-system "${tmp_dir}"
}
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}"
diff --git a/bin/ii-watch b/bin/ii-watch
index ae008c4..6ae30c0 100755
--- a/bin/ii-watch
+++ b/bin/ii-watch
@@ -18,7 +18,7 @@ while pgrep -x 'ii' >/dev/null && \
# this avoids missing modifications during our last execution
if [ "$(date +%s)" -ge ${next_connection_check} ]; then
# request this more often on startup
- if [ ${last_seen} -ne 0 ]; then
+ if [ "${last_seen}" -ne 0 ]; then
next_connection_check=$((
$(date +%s) + 60*5
))
diff --git a/bin/manual-fix b/bin/manual-fix
index c5e0d92..f9cc7b9 100755
--- a/bin/manual-fix
+++ b/bin/manual-fix
@@ -15,6 +15,7 @@ eval "$(
)"
_fix_package_on_build_and_deletion_list() {
+ # shellcheck disable=SC2016
{
printf 'DELETE `bin_del`'
printf ' FROM `binary_packages` AS `bin_del`'
@@ -34,6 +35,7 @@ _fix_package_on_build_and_deletion_list() {
}
usage() {
+ # shellcheck disable=SC2016
>&2 printf 'usage: %s $issue\n\n' "${0##*/}"
>&2 printf 'Manually fix an issue.\n\n'
>&2 printf 'fixable issues:\n'
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list
index 04a9d4f..2391c1f 100755
--- a/bin/prioritize-build-list
+++ b/bin/prioritize-build-list
@@ -109,7 +109,7 @@ updated_rows=$(
if ${dependencies}; then
new_updated_rows=1
updated_rows=$((updated_rows-1))
- while [ ${new_updated_rows} -ne 0 ]; do
+ while [ "${new_updated_rows}" -ne 0 ]; do
updated_rows=$((updated_rows+new_updated_rows))
new_updated_rows=$(
# shellcheck disable=SC2016
diff --git a/bin/return-assignment b/bin/return-assignment
index 892aac8..ec32b9b 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -961,6 +961,7 @@ if [ -n "${errors}" ]; then
fi
some_architecture=$(
+ # shellcheck disable=SC2012
ls \
| sed '
s/^.*-\([^-]\+\)\.pkg\.\('"${package_compression_suffix_regex}"'\)$/\1/
diff --git a/lib/common-functions b/lib/common-functions
index e9437e1..ba03fc1 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -407,6 +407,7 @@ find_package_repository_to_package() {
>&2 printf 'trying to filter based on git\n'
if ! repo=$(
+ # shellcheck disable=SC2016
{
printf 'SELECT `upstream_repositories`.`name`'
printf ' FROM `upstream_repositories`'
@@ -457,7 +458,8 @@ extract_source_directory() {
local output="$5"
local sub_pkgrel="$6"
- local pkgbase_translated=$(
+ local pkgbase_translated
+ pkgbase_translated=$(
printf '%s\n' "${pkgbase}" \
| sed '
s@+@plus@g