[pacman-dev] [PATCH 3/7] libmakepkg: lint disallowed variables in package()
morganamilo
morganamilo at gmail.com
Fri Jun 8 18:18:55 UTC 2018
makepkpg will now error if disallowed variables are overridden inside of
the package function.
Signed-off-by: morganamilo <morganamilo at gmail.com>
---
.../libmakepkg/lint_pkgbuild/variable.sh.in | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
index 3266cb5e..68512a62 100644
--- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
@@ -37,6 +37,12 @@ lint_variable() {
replaces sha1sums sha256sums sha384sums sha512sums source)
local string=(changelog epoch install pkgdesc pkgrel pkgver url)
+ local no_overide_string=(pkgbase pkgver pkgrel epoch)
+
+ local no_overide_array=(checkdepends makedepends
+ noextract source validpgpkeys md5suns sha1sums
+ sha224sums sha256sums sha384sums sha512sums)
+
local i a v pkg keys out bad ret=0
# global variables
@@ -87,6 +93,22 @@ lint_variable() {
for a in ${arch[@]}; do
[[ $a == "any" ]] && continue
+ for i in ${no_overide_string[@]}; do
+ if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
+ error "$(gettext "%s_%s can not be overridden in package function")" "$i" "$a"
+ ret=1
+ fi
+ done
+
+ for i in ${no_overide_array[@]}; do
+ if extract_function_variable "package_$pkg" "${i}_${a}" 1 out; then
+ error "$(gettext "%s_%s can not be overridden in package function")" "$i" "$a"
+ ret=1
+ fi
+
+ done
+
+
for i in ${arch_array[@]}; do
if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
error "$(gettext "%s_%s should be an array")" "$i" "$a"
@@ -95,6 +117,20 @@ lint_variable() {
done
done
+ for i in ${no_overide_string[@]}; do
+ if extract_function_variable "package_$pkg" "$i" 0 out; then
+ error "$(gettext "%s can not be overridden in package function")" "$i"
+ ret=1
+ fi
+ done
+
+ for i in ${no_overide_string[@]}; do
+ if extract_function_variable "package_$pkg" "$i" 1 out; then
+ error "$(gettext "%s can not be overridden in package function")" "$i"
+ ret=1
+ fi
+ done
+
for i in ${string[@]}; do
if extract_function_variable "package_$pkg" $i 1 out; then
error "$(gettext "%s should not be an array")" "$i"
--
2.17.1
More information about the pacman-dev
mailing list