summaryrefslogtreecommitdiff
path: root/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
diff options
context:
space:
mode:
authormorganamilo <morganamilo@gmail.com>2019-01-30 18:07:20 +0000
committerAllan McRae <allan@archlinux.org>2019-01-31 10:02:37 +1000
commit75aae126c423dcc9b215aef57daff9e7bd8f5f6b (patch)
tree090e8f87eadd5eacfb3c19b5b1696ad02383b1a7 /scripts/libmakepkg/lint_pkgbuild/variable.sh.in
parent6cf0548128d6d1a839ba93997b017661520395be (diff)
downloadpacman-75aae126c423dcc9b215aef57daff9e7bd8f5f6b.tar.xz
libmakepkg: centralise random arrays of pkgbuild variables
Refactor many of the different arrays of pkgbuild variables into scripts/libmakepkg/util/schema.sh.in. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/lint_pkgbuild/variable.sh.in')
-rw-r--r--scripts/libmakepkg/lint_pkgbuild/variable.sh.in20
1 files changed, 7 insertions, 13 deletions
diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
index a975b024..512bed7b 100644
--- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
@@ -25,22 +25,16 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
source "$LIBRARY/util/pkgbuild.sh"
+source "$LIBRARY/util/schema.sh"
lint_pkgbuild_functions+=('lint_variable')
lint_variable() {
- # TODO: refactor - similar arrays are used elsewhere
- local array=(arch backup groups license noextract options validpgpkeys)
- local arch_array=(checkdepends conflicts depends makedepends md5sums
- optdepends provides replaces sha1sums sha224sums
- sha256sums sha384sums sha512sums source)
- local string=(changelog epoch install pkgbase pkgdesc pkgrel pkgver url)
-
local i a pkg out bad ret=0
# global variables
- for i in ${array[@]} ${arch_array[@]}; do
+ for i in ${pkgbuild_schema_arrays[@]}; do
if declare -p $i > /dev/null 2>&1; then
if ! is_array $i; then
error "$(gettext "%s should be an array")" "$i"
@@ -52,7 +46,7 @@ lint_variable() {
for a in ${arch[@]}; do
[[ $a == "any" ]] && continue
- for i in ${arch_array[@]}; do
+ for i in ${pkgbuild_schema_arch_arrays[@]}; do
if declare -p "${i}_${a}" > /dev/null 2>&1; then
if ! is_array ${i}_${a}; then
error "$(gettext "%s should be an array")" "${i}_${a}"
@@ -62,7 +56,7 @@ lint_variable() {
done
done
- for i in ${string[@]}; do
+ for i in ${pkgbuild_schema_strings[@]}; do
if declare -p "$i" > /dev/null 2>&1; then
if is_array $i; then
error "$(gettext "%s should not be an array")" "$i"
@@ -73,7 +67,7 @@ lint_variable() {
# package function variables
for pkg in ${pkgname[@]}; do
- for i in ${array[@]} ${arch_array[@]}; do
+ for i in ${pkgbuild_schema_arrays[@]}; do
if extract_function_variable "package_$pkg" $i 0 out; then
error "$(gettext "%s should be an array")" "$i"
ret=1
@@ -83,7 +77,7 @@ lint_variable() {
for a in ${arch[@]}; do
[[ $a == "any" ]] && continue
- for i in ${arch_array[@]}; do
+ for i in ${pkgbuild_schema_arch_arrays[@]}; do
if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
error "$(gettext "%s should be an array")" "${i}_${a}"
ret=1
@@ -91,7 +85,7 @@ lint_variable() {
done
done
- for i in ${string[@]}; do
+ for i in ${pkgbuild_schema_strings[@]}; do
if extract_function_variable "package_$pkg" $i 1 out; then
error "$(gettext "%s should not be an array")" "$i"
ret=1