summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-10-11 21:24:52 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-10-11 21:24:52 +0200
commit9eadebb67a12780b2923c1d28dc0c3091707f14e (patch)
treec46a09ec6831f2c72a08c969f76f9ae836cca574
parent63106028b4573a4952f6417b1558e09622a1f69f (diff)
downloadxtools-9eadebb67a12780b2923c1d28dc0c3091707f14e.tar.gz
xtools-9eadebb67a12780b2923c1d28dc0c3091707f14e.tar.xz
xtools-9eadebb67a12780b2923c1d28dc0c3091707f14e.zip
xlint: construct $variables only once
-rwxr-xr-xxlint6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlint b/xlint
index 85bf5f4..1303340 100755
--- a/xlint
+++ b/xlint
@@ -7,7 +7,7 @@ scan() {
 		sed "s/^\([^:]*:[^:]*:\)\(.*\)/\1 $msg/"
 }
 
-variables="#.*
+variables=$(echo -n "#.*
 _.*
 .*_descr
 .*_homedir
@@ -76,7 +76,7 @@ systemd_services
 triggers
 version
 wrksrc
-xml_entries"
+xml_entries" | tr '\n' '|')
 
 for template; do
 	scan 'short_desc=.*\."' "unwanted trailing dot in short_desc"
@@ -92,7 +92,7 @@ for template; do
 	scan 'replaces=[^<>]*$' "replaces needs depname with version"
 	scan 'conflicts=[^<>]*$' "conflicts needs depname with version"
 	scan 'maintainer=(?!.*<.*@.*>).*' "maintainer needs email address"
-	scan '^(?!\s*('"$(echo -n "$variables" | tr '\n' '|')"'))[^\s=-]+=' \
+	scan '^(?!\s*('"$variables"'))[^\s=-]+=' \
 		"custom variables should use _ prefix: \2" -1
 	scan '^[^ =]*=(""|''|)$' "variable set to empty string: \2" -1
 done