2018-03-14 22:59:18 -04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# variable.sh - Check that variables are or are not arrays as appropriate
|
|
|
|
#
|
2025-04-02 11:35:34 +10:00
|
|
|
# Copyright (c) 2018-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
2018-03-14 22:59:18 -04:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
[[ -n "$LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH" ]] && return
|
|
|
|
LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
|
|
|
|
|
2023-10-21 01:45:20 +01:00
|
|
|
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
2018-03-14 22:59:18 -04:00
|
|
|
|
2023-10-21 01:45:20 +01:00
|
|
|
source "$MAKEPKG_LIBRARY/util/message.sh"
|
2018-03-14 22:59:18 -04:00
|
|
|
|
2018-09-04 15:17:54 -04:00
|
|
|
lint_config_functions+=('lint_config_variables')
|
2018-03-14 22:59:18 -04:00
|
|
|
|
|
|
|
|
2018-09-04 15:17:54 -04:00
|
|
|
lint_config_variables() {
|
2018-03-14 22:59:18 -04:00
|
|
|
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
|
|
|
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
|
|
|
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
2024-12-07 23:06:49 +10:00
|
|
|
local string=(CARCH CHOST NPROC CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LTOFLAGS
|
|
|
|
DEBUG_CFLAGS DEBUG_CXXFLAGS DISTCC_HOSTS BUILDDIR STRIP_BINARIES
|
|
|
|
STRIP_SHARED STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST LOGDEST
|
|
|
|
PACKAGER GPGKEY PKGEXT SRCEXT)
|
2018-03-14 22:59:18 -04:00
|
|
|
|
|
|
|
local i keys ret=0
|
|
|
|
|
|
|
|
# global variables
|
|
|
|
for i in ${array[@]}; do
|
|
|
|
eval "keys=(\"\${!$i[@]}\")"
|
|
|
|
if (( ${#keys[*]} > 0 )); then
|
|
|
|
if ! is_array $i; then
|
|
|
|
error "$(gettext "%s should be an array")" "$i"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in ${string[@]}; do
|
|
|
|
eval "keys=(\"\${!$i[@]}\")"
|
|
|
|
if (( ${#keys[*]} > 0 )); then
|
|
|
|
if is_array $i; then
|
|
|
|
error "$(gettext "%s should not be an array")" "$i"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return $ret
|
|
|
|
}
|