From 4312818437090471cee3dab7205969dc7ab795d6 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 14 Nov 2014 16:21:59 +0100 Subject: xlint: check whether template exists. --- xlint | 8 ++++++-- 1 file 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 -- cgit 1.4.1