about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-10-20 19:24:52 +0200
committerLeah Neukirchen <leah@vuxu.org>2019-10-20 19:24:52 +0200
commit37fb7830a1111c1544b3ed1bb8b687d7e75a5e6a (patch)
tree794c6359bddca43286eae34f807c0f34e0dc65cf
parentf833bab96c13968ff3ca0ab65712867ecd8749c8 (diff)
downloadxtools-37fb7830a1111c1544b3ed1bb8b687d7e75a5e6a.tar.gz
xtools-37fb7830a1111c1544b3ed1bb8b687d7e75a5e6a.tar.xz
xtools-37fb7830a1111c1544b3ed1bb8b687d7e75a5e6a.zip
xlint: check required-and-unique variables
Closes #155.
-rwxr-xr-xxlint12
1 files changed, 12 insertions, 0 deletions
diff --git a/xlint b/xlint
index 60e6ac9..81ec57f 100755
--- a/xlint
+++ b/xlint
@@ -19,6 +19,17 @@ header() {
 	fi
 }
 
+exists_once() {
+	for var in pkgname version revision short_desc maintainer license \
+		   homepage distfiles checksum; do
+		case "$(grep -c "^${var}=" "$template")" in
+			0) echo "$template: '$var' missing!";;
+			1) ;;
+			*) echo "$template: '$var' defined more than once";;
+		esac
+	done
+}
+
 variables_order() {
 	local curr_index max_index max_index_line variables_end message line
 	max_index=0
@@ -237,6 +248,7 @@ xml_entries" | tr '\n' '|')
 ret=0
 for template; do
 	if [ -f "$template" ]; then
+	exists_once "$template"
 	scan 'short_desc=.*\."' "unwanted trailing dot in short_desc"
 	scan 'short_desc=["'\''][a-z]' "short_desc should start uppercase"
 	scan 'short_desc=["'\''](An?|The) ' "short_desc should not start with an article"