pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mk/tests: reduce indentation and number of external program calls



Module Name:	pkgsrc-wip
Committed By:	Roland Illig <roland.illig%gmx.de@localhost>
Pushed By:	rillig
Date:		Fri Mar 9 21:19:59 2018 +0100
Changeset:	81a434c16db5d2c6fed0cba0f8ea582a56f3074f

Modified Files:
	mk/tests/zzz-copy-paste

Log Message:
mk/tests: reduce indentation and number of external program calls

Especially on Cygwin, this makes a difference in execution speed.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=81a434c16db5d2c6fed0cba0f8ea582a56f3074f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mk/tests/zzz-copy-paste | 53 ++++++++++++++++++++++---------------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

diffs:
diff --git a/mk/tests/zzz-copy-paste b/mk/tests/zzz-copy-paste
index eb811a0730..78bfe7c20f 100755
--- a/mk/tests/zzz-copy-paste
+++ b/mk/tests/zzz-copy-paste
@@ -1,30 +1,28 @@
 #! /bin/sh
+#
+# Ensures that the tests and the code don't contain obvious
+# copy-and-paste errors.
+
 set -eu
 
 cd "${0%/*}"
 
-# Ensures that the tests and the code don't contain obvious
-# copy-and-paste errors.
-
 scms="cvs fossil git hg svn"
 keywords_hg="Mercurial"
 keywords_svn="Subversion"
 
 for haystack in $scms; do
 	for needle in $scms; do
-		if [ "$haystack" != "$needle" ]; then
-			eval "keywords=\"\${keywords_$needle-} $needle\""
-
-			for keyword in $keywords; do
-				eval "filemask=./\${filemask_$haystack:-$haystack}-*"
-
-				for file in $filemask ../$haystack-package.mk; do
-					if grep -Hi "$keyword" "$file"; then
-						error=1
-					fi
-				done
-			done
-		fi
+		[ "$haystack" != "$needle" ] || continue
+		eval "keywords=\"\${keywords_$needle-} $needle\""
+
+		for keyword in $keywords; do
+			eval "filemask=./\${filemask_$haystack:-$haystack}-*"
+
+			if grep -Hi "$keyword" $filemask ../$haystack-package.mk; then
+				error=1
+			fi
+		done
 	done
 done
 
@@ -34,19 +32,16 @@ keywords_show_all="show-all"
 
 for haystack in $tests; do
 	for needle in $tests; do
-		if [ "$needle" != "$haystack" ]; then
-			eval "keywords=\"\${keywords_$needle-} $needle\""
-
-			for keyword in $keywords; do
-				eval "filemask=./*-\${filemask_$haystack:-$haystack}*"
-
-				for file in $filemask; do
-					if grep -Hi "$keyword" "$file"; then
-						error=1
-					fi
-				done
-			done
-		fi
+		[ "$needle" != "$haystack" ] || continue
+		eval "keywords=\"\${keywords_$needle-} $needle\""
+
+		for keyword in $keywords; do
+			eval "filemask=./*-\${filemask_$haystack:-$haystack}*"
+
+			if grep -Hi "$keyword" $filemask; then
+				error=1
+			fi
+		done
 	done
 done
 


Home | Main Index | Thread Index | Old Index