about summary refs log tree commit diff
path: root/xlint
diff options
context:
space:
mode:
authorclassabbyamp <void@placeviolette.net>2022-11-22 16:14:22 -0500
committerLeah Neukirchen <leah@vuxu.org>2022-11-24 15:34:48 +0100
commitd8b58617b9d6cb8fe51b2906ae647f86f7792d2e (patch)
tree7d1b51b9017b19ce4a10480afafbe11c720137f2 /xlint
parent119fb175ed07a9ba78defb2e108b963372b9d203 (diff)
downloadxtools-d8b58617b9d6cb8fe51b2906ae647f86f7792d2e.tar.gz
xtools-d8b58617b9d6cb8fe51b2906ae647f86f7792d2e.tar.xz
xtools-d8b58617b9d6cb8fe51b2906ae647f86f7792d2e.zip
xlint: improve scanning of deprecated variables
previously, deprecated variables showed some spurious and confusing
messages. now they should have a better message.
Diffstat (limited to 'xlint')
-rwxr-xr-xxlint12
1 files changed, 9 insertions, 3 deletions
diff --git a/xlint b/xlint
index 19bb98d..34ca604 100755
--- a/xlint
+++ b/xlint
@@ -15,6 +15,10 @@ scan() {
 		done
 }
 
+check_old_vars() {
+	sed -E 's/^([^:]+:[0-9]+:).*: ('"$old_variables"')=.*$/\1 \2 is deprecated and should not be used/'
+}
+
 regex_escape() {
 	sed 's/\([.*+]\)/\\\1/g'
 }
@@ -271,6 +275,9 @@ version
 xml_catalogs
 xml_entries" | tr '\n' '|')
 
+old_variables=$(echo -n "long_desc
+wrksrc" | tr '\n' '|')
+
 old_accounts=$(echo -n "at
 avahi
 bitlbee
@@ -445,7 +452,7 @@ for argument; do
 	scan 'homepage=.*\$' "homepage should not use variables"
 	scan 'maintainer=(?!.*<.*@.*>).*' "maintainer needs email address"
 	scan 'maintainer=.*<.*@users.noreply.github.com>.*' "maintainer needs a valid address for sending mail"
-	scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\\2"
+	scan '^(?!\s*('"$variables"'))[^\s=-]+=' "custom variables should use _ prefix: \\\2" | check_old_vars
 	scan '^[^ =]*=(""|''|)$' "variable set to empty string: \\\2"
 	scan '^(.*)-docs_package().*' 'use <pkgname>-doc subpackage for documentation'
 	scan 'distfiles=.*github.com.*/archive/.*\.zip[\"]?$' 'Use the distfile .tar.gz instead of .zip'
@@ -465,7 +472,6 @@ for argument; do
 	scan 'distfiles=.*xorg\.freedesktop\.org/wiki/' 'use $XORG_HOME'
 	scan 'usr/lib/python3.[0-9]/site-packages' 'use $py3_sitelib'
 	scan 'pycompile_module=' 'do not set pycompile_module, it is autodetected'
-	scan '^wrksrc=' 'wrksrc should not be defined'
 	scan '^\t*function\b' 'do not use the function keyword'
 	scan '^\t*[^ ]*  *\(\)' 'do not use space before function parenthesis'
 	scan '^\t*[^ ]*\(\)(|   *){' 'use one space after function parenthesis'
@@ -480,7 +486,7 @@ for argument; do
 	scan "cargo update (--package|-p) [A-Za-z_][A-Za-z0-9_]*(?!\:[0-9]+\.[0-9]+\.[0-9]+)(\s.+)?$" '"cargo update" commands should include the specific version we are updating from in the --package SPEC' 
 	scan "cargo update (--package|-p) [A-Za-z_][A-Za-z0-9_-]*\:[0-9]+\.[0-9]+\.[0-9]+(?!--precise [0-9]+\.[0-9]+\.[0-9]+)$" '"cargo update" commands should include the specific version we are updating to, using --precise' 
 	scan '-D([[:alnum:]_-]+)=\$\(vopt_if \1 true false\)' 'use $(vopt_bool ...) instead of -D...=$(vopt_if ...)'
-	variables_order
+	variables_order | grep -Pv "($old_variables)="
 	header
 	file_end
 	explain_make_check