libmakepkg: fix compatibility with bash-5.2 globskipdots

Bash 5.2 has a new globskipdots option, which is enabled by default. The
check_dotfiles lint fails with globskipdots due to the assumption that
at least the "." and ".." paths will match. Disabling globskipdots would
be the usual solution, but that fails on bash<5.2.  Instead, enable
nullglob for this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit a6b06a5b17)
This commit is contained in:
Allan McRae 2022-10-02 11:40:52 +10:00
parent 1daabff0fb
commit 5c10680f6f

View file

@ -29,10 +29,17 @@ lint_package_functions+=('check_dotfiles')
check_dotfiles() {
local ret=0
local shellopts=$(shopt -p nullglob)
shopt -s nullglob
for f in "$pkgdir"/.*; do
[[ ${f##*/} == . || ${f##*/} == .. ]] && continue
error "$(gettext "Dotfile found in package root '%s'")" "$f"
ret=1
done
eval "$shellopts"
return $ret
}