about summary refs log tree commit diff
path: root/xlint
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-11-14 16:21:59 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2014-11-14 16:21:59 +0100
commit4312818437090471cee3dab7205969dc7ab795d6 (patch)
treea107e64499c21d6a4943d1306e12bcfc7c3d4c77 /xlint
parent790c4778a02dbeba8ea70876654127b7045091ac (diff)
downloadxtools-4312818437090471cee3dab7205969dc7ab795d6.tar.gz
xtools-4312818437090471cee3dab7205969dc7ab795d6.tar.xz
xtools-4312818437090471cee3dab7205969dc7ab795d6.zip
xlint: check whether template exists.
Diffstat (limited to 'xlint')
-rwxr-xr-xxlint8
1 files changed, 6 insertions, 2 deletions
diff --git a/xlint b/xlint
index a3eef1a..5cacbc9 100755
--- a/xlint
+++ b/xlint
@@ -1,6 +1,8 @@
 #!/bin/sh
 # xlint TEMPLATE - scan XBPS template for common mistakes
 
+export LC_ALL=C
+
 scan() {
 	local rx="$1" msg="$2"
 	grep -P -Hn -e "$rx" "$template" |
@@ -90,7 +92,7 @@ xml_entries" | tr '\n' '|')
 
 ret=0
 for template; do
-	{
+	if [ -f "$template" ]; then
 	scan 'short_desc=.*\."' "unwanted trailing dot in short_desc"
 	scan 'short_desc=["'\''][a-z]' "short_desc should start uppercase"
 	scan 'short_desc=["'\''].{72}' "short_desc should be less than 72 chars"
@@ -121,6 +123,8 @@ for template; do
 	scan 'distfiles=.*ftp\.mozilla\.org' 'use $MOZILLA_SITE'
 	scan 'distfiles=.*ftp\.gnu\.org/(pub/)?gnu' 'use $GNU_SITE'
 	scan 'distfiles=.*freedesktop\.org/software' 'use $FREEDESKTOP_SITE'
-	} | sort -t: -n -k2 | grep . && ret=1
+	else
+	echo no such template "$template" 1>&2
+	fi | sort -t: -n -k2 | grep . && ret=1
 done
 exit $ret