summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/util
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2018-04-03 23:48:14 +0200
committerAllan McRae <allan@archlinux.org>2018-04-29 13:49:05 +0200
commit91b72cc386ca03241791748da5da2b150c724ace (patch)
treeacd1519d07a1a3eeb6913ba7bd2606edb00e263f /scripts/libmakepkg/util
parentbcaf1b84ff0f0709d35cd0adb1f13965d1101aeb (diff)
downloadpacman-91b72cc386ca03241791748da5da2b150c724ace.tar.gz
pacman-91b72cc386ca03241791748da5da2b150c724ace.tar.xz
libmakepkg/lint_pkgbuild: lint depends/etc. as if they are pkgname
depends, provides, conflicts, replaces, and other variables that are meant to contain package names, are now checked to ensure 1) the name component contains only characters that would equate to a valid pkgname. 2) the version component contains only characters that would equate to a valid pkgver. 3) comparison operator is a valid comparison operator (e.g. provides only allows exact = while optdepends doesn't allow anything) This also refactors pkgname into a shared utility function, wires up pkgbase optdepends and provides to use it, and gives pkgver a touchup to allow referencing where it was called from. Fixes FS#57833 and a bit of extra. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg/util')
-rw-r--r--scripts/libmakepkg/util/pkgbuild.sh.in27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index d35c064b..2db46f1f 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -116,6 +116,33 @@ get_pkgbuild_attribute() {
fi
}
+get_pkgbuild_all_split_attributes() {
+ local attrname=$1 outputvar=$2 all_list list
+
+ if extract_global_variable "$attrname" 1 list; then
+ all_list+=("${list[@]}")
+ fi
+ for a in "${arch[@]}"; do
+ if extract_global_variable "${attrname}_$a" 1 list; then
+ all_list+=("${list[@]}")
+ fi
+ done
+
+ for name in "${pkgname[@]}"; do
+ if extract_function_variable "package_$name" "$attrname" 1 list; then
+ all_list+=("${list[@]}")
+ fi
+
+ for a in "${arch[@]}"; do
+ if extract_function_variable "package_$name" "${attrname}_$a" 1 list; then
+ all_list+=("${list[@]}")
+ fi
+ done
+ done
+
+ [[ ${all_list[@]} ]] && array_build "$outputvar" all_list
+}
+
##
# usage : get_full_version()
# return : full version spec, including epoch (if necessary), pkgver, pkgrel