mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 14:06:58 +02:00
pkg-auto: Disable shellcheck reference warnings
Two warnings, SC2034 and SC2178, pop up very often with the references - shellcheck handles them poorly and produces a ton of bogus warnings about them. Silence the warnings and drop most of the "shellcheck disable" clauses.
This commit is contained in:
parent
296efcdb22
commit
0d06b737ac
@ -1,4 +1,12 @@
|
|||||||
|
# ignoring SC2034 (VARIABLE_NAME appears unused), too many false
|
||||||
|
# positives
|
||||||
|
#
|
||||||
|
# ignoring SC2178 (Variable was used as an array but is now assigned a
|
||||||
|
# string.) - buggy for local variables, happens very often for
|
||||||
|
# references
|
||||||
|
SHELLCHECK_OPTS := -e SC2034 -e SC2178
|
||||||
|
|
||||||
all: shellcheck
|
all: shellcheck
|
||||||
|
|
||||||
shellcheck:
|
shellcheck:
|
||||||
docker run --rm -v "$$PWD:/mnt" koalaman/shellcheck:latest --norc --shell=bash --source-path=SCRIPTDIR --source-path=SCRIPTDIR/impl --source-path=SCRIPTDIR/impl/for-shellcheck --external-sources --check-sourced *.sh impl/*.sh
|
docker run --rm -v "$$PWD:/mnt" koalaman/shellcheck:latest --norc --shell=bash --source-path=SCRIPTDIR --source-path=SCRIPTDIR/impl --source-path=SCRIPTDIR/impl/for-shellcheck --external-sources --check-sourced $(SHELLCHECK_OPTS) *.sh impl/*.sh
|
||||||
|
@ -159,19 +159,16 @@ ver_dash="${VERSION_ID}${BUILD_ID:+-}${BUILD_ID}"
|
|||||||
|
|
||||||
exts=(zst bz2 gz)
|
exts=(zst bz2 gz)
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used indirectly as cmds_name and cmds
|
|
||||||
zst_cmds=(
|
zst_cmds=(
|
||||||
zstd
|
zstd
|
||||||
)
|
)
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used indirectly as cmds_name and cmds
|
|
||||||
bz2_cmds=(
|
bz2_cmds=(
|
||||||
lbunzip2
|
lbunzip2
|
||||||
pbunzip2
|
pbunzip2
|
||||||
bunzip2
|
bunzip2
|
||||||
)
|
)
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used indirectly as cmds_name and cmds
|
|
||||||
gz_cmds=(
|
gz_cmds=(
|
||||||
unpigz
|
unpigz
|
||||||
gunzip
|
gunzip
|
||||||
|
@ -26,19 +26,12 @@ set -euo pipefail
|
|||||||
source "$(dirname "${BASH_SOURCE[0]}")/impl/util.sh"
|
source "$(dirname "${BASH_SOURCE[0]}")/impl/util.sh"
|
||||||
source "${PKG_AUTO_IMPL_DIR}/cleanups.sh"
|
source "${PKG_AUTO_IMPL_DIR}/cleanups.sh"
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_aux_directory=''
|
gc_aux_directory=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_new_base=''
|
gc_new_base=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_old_base=''
|
gc_old_base=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_reports_directory=''
|
gc_reports_directory=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_scripts_directory=''
|
gc_scripts_directory=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_cleanup_opts=''
|
gc_cleanup_opts=''
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
gc_image_override=''
|
gc_image_override=''
|
||||||
gc_debug_packages=()
|
gc_debug_packages=()
|
||||||
|
|
||||||
@ -81,9 +74,7 @@ while [[ ${#} -gt 0 ]]; do
|
|||||||
if [[ -z ${2:-} ]]; then
|
if [[ -z ${2:-} ]]; then
|
||||||
fail 'missing value for -w'
|
fail 'missing value for -w'
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok refs
|
|
||||||
declare -n ref="${var_name}"
|
declare -n ref="${var_name}"
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok refs
|
|
||||||
ref=${2}
|
ref=${2}
|
||||||
unset -n ref
|
unset -n ref
|
||||||
unset var_name
|
unset var_name
|
||||||
@ -123,7 +114,6 @@ config=${1}; shift
|
|||||||
name=${pairs["${name_idx}"]}
|
name=${pairs["${name_idx}"]}
|
||||||
opt_idx=$((opt_idx + 2))
|
opt_idx=$((opt_idx + 2))
|
||||||
name_idx=$((name_idx + 2))
|
name_idx=$((name_idx + 2))
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok refs
|
|
||||||
declare -n ref="${name}"
|
declare -n ref="${name}"
|
||||||
if [[ -n ${ref:-} ]]; then
|
if [[ -n ${ref:-} ]]; then
|
||||||
printf '%s: %s\n' "${opt}" "${ref}"
|
printf '%s: %s\n' "${opt}" "${ref}"
|
||||||
|
@ -99,7 +99,6 @@ function set_eo() {
|
|||||||
local dir=${1}; shift
|
local dir=${1}; shift
|
||||||
# rest are architectures
|
# rest are architectures
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used externally
|
|
||||||
declare -g EGENCACHE_W="${dir}/egencache-warnings"
|
declare -g EGENCACHE_W="${dir}/egencache-warnings"
|
||||||
declare -g SDK_EO="${dir}/sdk-emerge-output"
|
declare -g SDK_EO="${dir}/sdk-emerge-output"
|
||||||
declare -g SDK_EO_F="${SDK_EO}-filtered"
|
declare -g SDK_EO_F="${SDK_EO}-filtered"
|
||||||
@ -348,7 +347,6 @@ function get_provided_file() {
|
|||||||
path_var_name=${1}; shift
|
path_var_name=${1}; shift
|
||||||
local -n path_ref="${path_var_name}"
|
local -n path_ref="${path_var_name}"
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # reference to external variable
|
|
||||||
path_ref="${root}/etc/portage/profile/package.provided/ignore_cross_packages"
|
path_ref="${root}/etc/portage/profile/package.provided/ignore_cross_packages"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ function mvm_declare() {
|
|||||||
storage_map_ref=()
|
storage_map_ref=()
|
||||||
|
|
||||||
local -n mvm_ref=${mvm_var_name}
|
local -n mvm_ref=${mvm_var_name}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
mvm_ref=(
|
mvm_ref=(
|
||||||
['name']="${mvm_var_name}"
|
['name']="${mvm_var_name}"
|
||||||
['constructor']="${constructor}"
|
['constructor']="${constructor}"
|
||||||
@ -193,7 +192,6 @@ function __mvm_mvc_name() {
|
|||||||
mvc_name_var_name=${1}; shift
|
mvc_name_var_name=${1}; shift
|
||||||
local -n mvc_name_ref=${mvc_name_var_name}
|
local -n mvc_name_ref=${mvc_name_var_name}
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
mvc_name_ref="mvm_${name}_mvc_${counter}"
|
mvc_name_ref="mvm_${name}_mvc_${counter}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,10 +244,8 @@ function mvm_c_get_extra() {
|
|||||||
|
|
||||||
local extras_map_var_name
|
local extras_map_var_name
|
||||||
extras_map_var_name=${mvm['extras']}
|
extras_map_var_name=${mvm['extras']}
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n extras_map_ref=${extras_map_var_name}
|
local -n extras_map_ref=${extras_map_var_name}
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
extra_ref=${extras_map_ref["${extra}"]:-}
|
extra_ref=${extras_map_ref["${extra}"]:-}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,10 +269,8 @@ function mvm_c_get() {
|
|||||||
|
|
||||||
local storage_map_var_name
|
local storage_map_var_name
|
||||||
storage_map_var_name=${mvm['storage']}
|
storage_map_var_name=${mvm['storage']}
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n storage_map_ref=${storage_map_var_name}
|
local -n storage_map_ref=${storage_map_var_name}
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
value_ref=${storage_map_ref["${key}"]:-}
|
value_ref=${storage_map_ref["${key}"]:-}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +284,6 @@ function __mvm_c_make_new_mvc() {
|
|||||||
name=${mvm['name']}
|
name=${mvm['name']}
|
||||||
counter=${mvm['counter']}
|
counter=${mvm['counter']}
|
||||||
storage_map_var_name=${mvm['storage']}
|
storage_map_var_name=${mvm['storage']}
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n storage_map_ref=${storage_map_var_name}
|
local -n storage_map_ref=${storage_map_var_name}
|
||||||
|
|
||||||
__mvm_mvc_name "${name}" "${counter}" "${mvc_name_var_name}"
|
__mvm_mvc_name "${name}" "${counter}" "${mvc_name_var_name}"
|
||||||
@ -348,7 +341,6 @@ function mvm_c_remove() {
|
|||||||
|
|
||||||
local storage_map_var_name
|
local storage_map_var_name
|
||||||
storage_map_var_name=${mvm['storage']}
|
storage_map_var_name=${mvm['storage']}
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n storage_map_ref=${storage_map_var_name}
|
local -n storage_map_ref=${storage_map_var_name}
|
||||||
|
|
||||||
if [[ -z ${storage_map_ref["${key}"]:-} ]]; then
|
if [[ -z ${storage_map_ref["${key}"]:-} ]]; then
|
||||||
@ -387,7 +379,6 @@ function mvm_c_iterate() {
|
|||||||
|
|
||||||
local storage_map_var_name helper
|
local storage_map_var_name helper
|
||||||
storage_map_var_name=${mvm['storage']}
|
storage_map_var_name=${mvm['storage']}
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n storage_map_ref=${storage_map_var_name}
|
local -n storage_map_ref=${storage_map_var_name}
|
||||||
helper=${mvm['iteration_helper']}
|
helper=${mvm['iteration_helper']}
|
||||||
|
|
||||||
@ -467,7 +458,6 @@ function mvm_mvc_array_destructor() {
|
|||||||
function mvm_mvc_array_adder() {
|
function mvm_mvc_array_adder() {
|
||||||
local array_var_name
|
local array_var_name
|
||||||
array_var_name=${1}; shift
|
array_var_name=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n array_ref=${array_var_name}
|
local -n array_ref=${array_var_name}
|
||||||
|
|
||||||
array_ref+=( "${@}" )
|
array_ref+=( "${@}" )
|
||||||
@ -481,7 +471,6 @@ function mvm_mvc_array_iteration_helper() {
|
|||||||
callback=${1}; shift
|
callback=${1}; shift
|
||||||
# rest are extra args passed to cb
|
# rest are extra args passed to cb
|
||||||
|
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n array_ref=${array_var_name}
|
local -n array_ref=${array_var_name}
|
||||||
"${callback}" "${@}" "${key}" "${array_var_name}" "${array_ref[@]}"
|
"${callback}" "${@}" "${key}" "${array_var_name}" "${array_ref[@]}"
|
||||||
}
|
}
|
||||||
@ -512,11 +501,9 @@ function mvm_mvc_map_destructor() {
|
|||||||
function mvm_mvc_map_adder() {
|
function mvm_mvc_map_adder() {
|
||||||
local map_var_name
|
local map_var_name
|
||||||
map_var_name=${1}; shift
|
map_var_name=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n map_ref=${map_var_name}
|
local -n map_ref=${map_var_name}
|
||||||
|
|
||||||
while [[ ${#} -gt 1 ]]; do
|
while [[ ${#} -gt 1 ]]; do
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
map_ref["${1}"]=${2}
|
map_ref["${1}"]=${2}
|
||||||
shift 2
|
shift 2
|
||||||
done
|
done
|
||||||
@ -532,7 +519,6 @@ function mvm_mvc_set_constructor() {
|
|||||||
|
|
||||||
declare -g -A "${set_var_name}"
|
declare -g -A "${set_var_name}"
|
||||||
|
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok refs
|
|
||||||
local -n set_ref=${set_var_name}
|
local -n set_ref=${set_var_name}
|
||||||
set_ref=()
|
set_ref=()
|
||||||
}
|
}
|
||||||
@ -548,7 +534,6 @@ function mvm_mvc_set_adder() {
|
|||||||
local set_var_name
|
local set_var_name
|
||||||
set_var_name=${1}; shift
|
set_var_name=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n set_ref=${set_var_name}
|
local -n set_ref=${set_var_name}
|
||||||
while [[ ${#} -gt 0 ]]; do
|
while [[ ${#} -gt 0 ]]; do
|
||||||
set_ref["${1}"]=x
|
set_ref["${1}"]=x
|
||||||
@ -565,7 +550,6 @@ function mvm_mvc_set_iteration_helper() {
|
|||||||
callback=${1}; shift
|
callback=${1}; shift
|
||||||
# rest are extra args passed to cb
|
# rest are extra args passed to cb
|
||||||
|
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n set_ref=${set_var_name}
|
local -n set_ref=${set_var_name}
|
||||||
"${callback}" "${@}" "${key}" "${set_var_name}" "${!set_ref[@]}"
|
"${callback}" "${@}" "${key}" "${set_var_name}" "${!set_ref[@]}"
|
||||||
}
|
}
|
||||||
|
@ -606,15 +606,12 @@ EOF
|
|||||||
function setup_git_env() {
|
function setup_git_env() {
|
||||||
local bot_name bot_email role what
|
local bot_name bot_email role what
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # used indirectly
|
|
||||||
bot_name='Flatcar Buildbot'
|
bot_name='Flatcar Buildbot'
|
||||||
# shellcheck disable=SC2034 # used indirectly
|
|
||||||
bot_email='buildbot@flatcar-linux.org'
|
bot_email='buildbot@flatcar-linux.org'
|
||||||
for role in AUTHOR COMMITTER; do
|
for role in AUTHOR COMMITTER; do
|
||||||
for what in name email; do
|
for what in name email; do
|
||||||
local -n var_ref="GIT_${role}_${what^^}"
|
local -n var_ref="GIT_${role}_${what^^}"
|
||||||
local -n value_ref="bot_${what}"
|
local -n value_ref="bot_${what}"
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
var_ref=${value_ref}
|
var_ref=${value_ref}
|
||||||
unset -n value_ref
|
unset -n value_ref
|
||||||
unset -n var_ref
|
unset -n var_ref
|
||||||
@ -1181,7 +1178,6 @@ function pkginfo_name() {
|
|||||||
report=${1}; shift
|
report=${1}; shift
|
||||||
local -n pi_name_ref=${1}; shift
|
local -n pi_name_ref=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
pi_name_ref="pkginfo_${which}_${arch}_${report//-/_}_pimap_mvm"
|
pi_name_ref="pkginfo_${which}_${arch}_${report//-/_}_pimap_mvm"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,7 +1193,6 @@ function pkginfo_destructor() {
|
|||||||
|
|
||||||
# Adder callback used by mvm_declare for pkginfo mvms.
|
# Adder callback used by mvm_declare for pkginfo mvms.
|
||||||
function pkginfo_adder() {
|
function pkginfo_adder() {
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n map_ref=${1}; shift
|
local -n map_ref=${1}; shift
|
||||||
|
|
||||||
local mark
|
local mark
|
||||||
@ -1306,14 +1301,12 @@ function pkginfo_c_process_file() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
local pkg version_slot throw_away v s
|
local pkg version_slot throw_away v s
|
||||||
# shellcheck disable=SC2034 # throw_away is unused, it's here for read to store the rest of the line if there is something else
|
|
||||||
while read -r pkg version_slot throw_away; do
|
while read -r pkg version_slot throw_away; do
|
||||||
pkg_debug_enable "${pkg}"
|
pkg_debug_enable "${pkg}"
|
||||||
pkg_debug "${which} ${arch} ${report}: ${version_slot}"
|
pkg_debug "${which} ${arch} ${report}: ${version_slot}"
|
||||||
v=${version_slot%%:*}
|
v=${version_slot%%:*}
|
||||||
s=${version_slot##*:}
|
s=${version_slot##*:}
|
||||||
mvm_c_add "${pkg}" "${s}" "${v}"
|
mvm_c_add "${pkg}" "${s}" "${v}"
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
pkg_set_ref["${pkg}"]='x'
|
pkg_set_ref["${pkg}"]='x'
|
||||||
mvm_add "${pkg_slots_set_mvm_var_name}" "${pkg}" "${s}"
|
mvm_add "${pkg_slots_set_mvm_var_name}" "${pkg}" "${s}"
|
||||||
pkg_debug_disable
|
pkg_debug_disable
|
||||||
@ -1412,9 +1405,7 @@ function ver_min_max() {
|
|||||||
max=${v}
|
max=${v}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
min_ref=${min}
|
min_ref=${min}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
max_ref=${max}
|
max_ref=${max}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1556,7 +1547,6 @@ function consistency_check_for_package() {
|
|||||||
function consistency_checks() {
|
function consistency_checks() {
|
||||||
local which pkg_slots_set_mvm_var_name pkg_slot_verminmax_mvm_var_name
|
local which pkg_slots_set_mvm_var_name pkg_slot_verminmax_mvm_var_name
|
||||||
which=${1}; shift
|
which=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n all_pkgs_ref=${1}; shift
|
local -n all_pkgs_ref=${1}; shift
|
||||||
pkg_slots_set_mvm_var_name=${1}; shift
|
pkg_slots_set_mvm_var_name=${1}; shift
|
||||||
pkg_slot_verminmax_mvm_var_name=${1}; shift
|
pkg_slot_verminmax_mvm_var_name=${1}; shift
|
||||||
@ -1634,7 +1624,6 @@ function consistency_checks() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local cc_slots_set_var_name s cc_min cc_max verminmax
|
local cc_slots_set_var_name s cc_min cc_max verminmax
|
||||||
# shellcheck disable=SC2034 # used by name below
|
|
||||||
local -A empty_map=()
|
local -A empty_map=()
|
||||||
local -a verminmax_map_var_names verminmaxes
|
local -a verminmax_map_var_names verminmaxes
|
||||||
local cc_slot_verminmax_map_var_name
|
local cc_slot_verminmax_map_var_name
|
||||||
@ -1739,7 +1728,6 @@ function read_package_sources() {
|
|||||||
# 2 - name of the package tags map mvm variable
|
# 2 - name of the package tags map mvm variable
|
||||||
function handle_package_changes() {
|
function handle_package_changes() {
|
||||||
local pkg_to_tags_mvm_var_name
|
local pkg_to_tags_mvm_var_name
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n renamed_old_to_new_map_ref=${1}; shift
|
local -n renamed_old_to_new_map_ref=${1}; shift
|
||||||
pkg_to_tags_mvm_var_name=${1}; shift
|
pkg_to_tags_mvm_var_name=${1}; shift
|
||||||
|
|
||||||
@ -1880,7 +1868,6 @@ function handle_package_changes() {
|
|||||||
local hpc_changed hpc_slot_changed hpc_update_dir_non_slot hpc_category_dir
|
local hpc_changed hpc_slot_changed hpc_update_dir_non_slot hpc_category_dir
|
||||||
local which slots_set_var_name_var_name slot_verminmax_map_var_name_var_name filtered_slots_set_var_name verminmax
|
local which slots_set_var_name_var_name slot_verminmax_map_var_name_var_name filtered_slots_set_var_name verminmax
|
||||||
local -A hpc_old_filtered_slots_set hpc_new_filtered_slots_set
|
local -A hpc_old_filtered_slots_set hpc_new_filtered_slots_set
|
||||||
# shellcheck disable=SC2034 # used by name below, in a special case
|
|
||||||
empty_map_or_set=()
|
empty_map_or_set=()
|
||||||
while [[ ${pkg_idx} -lt ${#old_pkgs[@]} ]]; do
|
while [[ ${pkg_idx} -lt ${#old_pkgs[@]} ]]; do
|
||||||
old_name=${old_pkgs["${pkg_idx}"]}
|
old_name=${old_pkgs["${pkg_idx}"]}
|
||||||
@ -2129,7 +2116,6 @@ function handle_package_changes() {
|
|||||||
# 1 - name of the set variable
|
# 1 - name of the set variable
|
||||||
# 2 - name of the variable where the element will be stored
|
# 2 - name of the variable where the element will be stored
|
||||||
function get_first_from_set() {
|
function get_first_from_set() {
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n set_ref=${1}; shift
|
local -n set_ref=${1}; shift
|
||||||
local -n return_ref=${1}; shift
|
local -n return_ref=${1}; shift
|
||||||
|
|
||||||
@ -2138,7 +2124,6 @@ function get_first_from_set() {
|
|||||||
return_ref=${item}
|
return_ref=${item}
|
||||||
return 0
|
return 0
|
||||||
done
|
done
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
return_ref=''
|
return_ref=''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2181,7 +2166,6 @@ function handle_pkg_update() {
|
|||||||
fi
|
fi
|
||||||
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
generate_ebuild_diff "${OLD_PORTAGE_STABLE}" "${NEW_PORTAGE_STABLE}" "${old_pkg}" "${new_pkg}" "${old_s}" "${new_s}" "${old}" "${new}"
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # these variables are used by name
|
|
||||||
local hpu_update_dir hpu_update_dir_non_slot
|
local hpu_update_dir hpu_update_dir_non_slot
|
||||||
update_dir_non_slot "${new_pkg}" hpu_update_dir_non_slot
|
update_dir_non_slot "${new_pkg}" hpu_update_dir_non_slot
|
||||||
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpu_update_dir
|
update_dir "${new_pkg}" "${old_s}" "${new_s}" hpu_update_dir
|
||||||
@ -2297,7 +2281,6 @@ function handle_pkg_as_is() {
|
|||||||
# Nothing relevant has changed, return early.
|
# Nothing relevant has changed, return early.
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2034 # ref to an external variable
|
|
||||||
changed_ref=x
|
changed_ref=x
|
||||||
lines+=( '0:TODO: review occurences' )
|
lines+=( '0:TODO: review occurences' )
|
||||||
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
if [[ ${old_pkg} != "${new_pkg}" ]]; then
|
||||||
@ -2410,7 +2393,6 @@ function tags_for_pkg() {
|
|||||||
tags_ref=()
|
tags_ref=()
|
||||||
else
|
else
|
||||||
local -n tags_in_mvm_ref=${tfp_tags_var_name}
|
local -n tags_in_mvm_ref=${tfp_tags_var_name}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
tags_ref=( "${tags_in_mvm_ref[@]}" )
|
tags_ref=( "${tags_in_mvm_ref[@]}" )
|
||||||
pkg_debug "tags available: ${tags_in_mvm_ref[*]}"
|
pkg_debug "tags available: ${tags_in_mvm_ref[*]}"
|
||||||
fi
|
fi
|
||||||
@ -2714,7 +2696,6 @@ function update_dir_non_slot() {
|
|||||||
# shellcheck source=for-shellcheck/globals
|
# shellcheck source=for-shellcheck/globals
|
||||||
source "${WORKDIR}/globals"
|
source "${WORKDIR}/globals"
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
dir_ref="${REPORTS_DIR}/updates/${pkg}"
|
dir_ref="${REPORTS_DIR}/updates/${pkg}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2744,7 +2725,6 @@ function update_dir() {
|
|||||||
|
|
||||||
local ud_non_slot_dir
|
local ud_non_slot_dir
|
||||||
update_dir_non_slot "${pkg}" ud_non_slot_dir
|
update_dir_non_slot "${pkg}" ud_non_slot_dir
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
dir_ref="${ud_non_slot_dir}/${slot_dir}"
|
dir_ref="${ud_non_slot_dir}/${slot_dir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2786,7 +2766,6 @@ function handle_gentoo_sync() {
|
|||||||
mvm_declare hgs_pkg_to_tags_mvm
|
mvm_declare hgs_pkg_to_tags_mvm
|
||||||
process_listings hgs_pkg_to_tags_mvm
|
process_listings hgs_pkg_to_tags_mvm
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # passed to other function through a name
|
|
||||||
local -A hgs_renames_old_to_new_map=()
|
local -A hgs_renames_old_to_new_map=()
|
||||||
process_profile_updates_directory hgs_renames_old_to_new_map
|
process_profile_updates_directory hgs_renames_old_to_new_map
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ function get_repo_from_profile_path() {
|
|||||||
path=${1}; shift
|
path=${1}; shift
|
||||||
local -n repo_dir_ref=${1}; shift
|
local -n repo_dir_ref=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
repo_dir_ref="${path%/profiles/*}"
|
repo_dir_ref="${path%/profiles/*}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +77,6 @@ function repo_path_to_name() {
|
|||||||
path=${1}; shift
|
path=${1}; shift
|
||||||
local -n name_ref=${1}; shift
|
local -n name_ref=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
name_ref=${repo_data_r["${path}"]:-'<unknown>'}
|
name_ref=${repo_data_r["${path}"]:-'<unknown>'}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +136,6 @@ function process_profile() {
|
|||||||
done <"${parent_file}"
|
done <"${parent_file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
children_ref=( "${children[@]}" )
|
children_ref=( "${children[@]}" )
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +149,6 @@ function get_profile_name() {
|
|||||||
repo_path=${repo_data["${repo_name}"]}
|
repo_path=${repo_data["${repo_name}"]}
|
||||||
profile_name=${profile_path#"${repo_path}/profiles/"}
|
profile_name=${profile_path#"${repo_path}/profiles/"}
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
profile_name_ref="${profile_name}"
|
profile_name_ref="${profile_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ function dirname_out() {
|
|||||||
dir_ref='.'
|
dir_ref='.'
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
dir_ref=${dn}
|
dir_ref=${dn}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ function basename_out() {
|
|||||||
cleaned_up=${cleaned_up//+(\/)/\/}
|
cleaned_up=${cleaned_up//+(\/)/\/}
|
||||||
# keep last component
|
# keep last component
|
||||||
dn=${cleaned_up##*/}
|
dn=${cleaned_up##*/}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
base_ref=${dn}
|
base_ref=${dn}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +84,6 @@ THIS=$(realpath "${THIS}")
|
|||||||
THIS_DIR=$(realpath "${THIS_DIR}")
|
THIS_DIR=$(realpath "${THIS_DIR}")
|
||||||
dirname_out "${BASH_SOURCE[0]}" PKG_AUTO_IMPL_DIR
|
dirname_out "${BASH_SOURCE[0]}" PKG_AUTO_IMPL_DIR
|
||||||
PKG_AUTO_IMPL_DIR=$(realpath "${PKG_AUTO_IMPL_DIR}")
|
PKG_AUTO_IMPL_DIR=$(realpath "${PKG_AUTO_IMPL_DIR}")
|
||||||
# shellcheck disable=SC2034 # may be used by scripts sourcing this file
|
|
||||||
PKG_AUTO_DIR=$(realpath "${PKG_AUTO_IMPL_DIR}/..")
|
PKG_AUTO_DIR=$(realpath "${PKG_AUTO_IMPL_DIR}/..")
|
||||||
|
|
||||||
# Prints an info line.
|
# Prints an info line.
|
||||||
@ -165,7 +162,6 @@ function join_by() {
|
|||||||
printf -v "${output_var_name}" '%s' "${first}" "${@/#/${delimiter}}";
|
printf -v "${output_var_name}" '%s' "${first}" "${@/#/${delimiter}}";
|
||||||
else
|
else
|
||||||
local -n output_ref=${output_var_name}
|
local -n output_ref=${output_var_name}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
output_ref=''
|
output_ref=''
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -207,7 +203,6 @@ function strip_out() {
|
|||||||
t=${l}
|
t=${l}
|
||||||
t=${t/#+([[:space:]])}
|
t=${t/#+([[:space:]])}
|
||||||
t=${t/%+([[:space:]])}
|
t=${t/%+([[:space:]])}
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
out_ref=${t}
|
out_ref=${t}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,10 +212,8 @@ function strip_out() {
|
|||||||
#
|
#
|
||||||
# 1 - name of an array variable, where the architectures will be stored
|
# 1 - name of an array variable, where the architectures will be stored
|
||||||
function get_valid_arches() {
|
function get_valid_arches() {
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n arches_ref=${1}; shift
|
local -n arches_ref=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
arches_ref=( 'amd64' 'arm64' )
|
arches_ref=( 'amd64' 'arm64' )
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +228,6 @@ function get_valid_arches() {
|
|||||||
# 2 - separator string
|
# 2 - separator string
|
||||||
# @ - strings
|
# @ - strings
|
||||||
function all_pairs() {
|
function all_pairs() {
|
||||||
# shellcheck disable=SC2178 # shellcheck doesn't grok references to arrays
|
|
||||||
local -n pairs_ref=${1}; shift
|
local -n pairs_ref=${1}; shift
|
||||||
local sep=${1}; shift
|
local sep=${1}; shift
|
||||||
|
|
||||||
@ -269,11 +261,8 @@ function all_pairs() {
|
|||||||
function sets_split() {
|
function sets_split() {
|
||||||
local -n first_set_ref=${1}; shift
|
local -n first_set_ref=${1}; shift
|
||||||
local -n second_set_ref=${1}; shift
|
local -n second_set_ref=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok references
|
|
||||||
local -n only_in_first_set_ref=${1}; shift
|
local -n only_in_first_set_ref=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok references
|
|
||||||
local -n only_in_second_set_ref=${1}; shift
|
local -n only_in_second_set_ref=${1}; shift
|
||||||
# shellcheck disable=SC2178 # shellcheck does not grok references
|
|
||||||
local -n common_set_ref=${1}; shift
|
local -n common_set_ref=${1}; shift
|
||||||
|
|
||||||
only_in_first_set_ref=()
|
only_in_first_set_ref=()
|
||||||
@ -285,10 +274,8 @@ function sets_split() {
|
|||||||
for item in "${!first_set_ref[@]}"; do
|
for item in "${!first_set_ref[@]}"; do
|
||||||
mark=${second_set_ref["${item}"]:-}
|
mark=${second_set_ref["${item}"]:-}
|
||||||
if [[ -z ${mark} ]]; then
|
if [[ -z ${mark} ]]; then
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
only_in_first_set_ref["${item}"]=x
|
only_in_first_set_ref["${item}"]=x
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
common_set_ref["${item}"]=x
|
common_set_ref["${item}"]=x
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -296,7 +283,6 @@ function sets_split() {
|
|||||||
for item in "${!second_set_ref[@]}"; do
|
for item in "${!second_set_ref[@]}"; do
|
||||||
mark=${first_set_ref["${item}"]:-}
|
mark=${first_set_ref["${item}"]:-}
|
||||||
if [[ -z ${mark} ]]; then
|
if [[ -z ${mark} ]]; then
|
||||||
# shellcheck disable=SC2034 # it's a reference to external variable
|
|
||||||
only_in_second_set_ref["${item}"]=x
|
only_in_second_set_ref["${item}"]=x
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -319,7 +305,6 @@ function gen_varname() {
|
|||||||
fi
|
fi
|
||||||
local -n name_ref=${1}; shift
|
local -n name_ref=${1}; shift
|
||||||
|
|
||||||
# shellcheck disable=SC2034 # shellcheck does not grok references
|
|
||||||
name_ref="${prefix}_${__UTIL_SH_COUNTER}"
|
name_ref="${prefix}_${__UTIL_SH_COUNTER}"
|
||||||
__UTIL_SH_COUNTER=$((__UTIL_SH_COUNTER + 1))
|
__UTIL_SH_COUNTER=$((__UTIL_SH_COUNTER + 1))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user