On Thu, 10 May 2018, Emmanuel Bourg wrote:

> need some help from a make/shell expert.

You summoned?

Try this (untested):

diff --git a/debian/rules b/debian/rules
index 19037e6..6458af2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,10 +37,11 @@ override_dh_auto_build:
        nanoxml net.n3.nanoxml net.n3.nanoxml.sax -d api
 
 override_dh_auto_test:
-       if [ $(filter nocheck, $(DEB_BUILD_OPTIONS)) ]; \
-               then    echo "Disabeling tests"; \
-               else    make -f debian/rules test; \
-       fi;
+ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
+       make -f debian/rules test
+else
+       echo "Disabling tests"
+endif
 
 override_dh_clean:
        jh_clean
@@ -52,23 +53,22 @@ override_dh_clean:
        dh_clean
 
 test:
-       set -e
-       set -x
+       set -e; \
+       set -x; \
        cd Test/Lite && \
-       ${JAVA_HOME}/bin/javac ${JFLAGS} -cp .:../../${LITE} `find -iname 
*.java` && \
+       ${JAVA_HOME}/bin/javac ${JFLAGS} -cp .:../../${LITE} $$(find -iname 
*.java) && \
        for TESTFILE in *.xml; do \
                ${JAVA_HOME}/bin/java -cp .:../../${LITE} DumpXML_Lite 
$${TESTFILE} > $${TESTFILE}.test_out ; \
-               if diff -u $${TESTFILE}.out $${TESTFILE}.test_out ; \
+               if ! diff -u $${TESTFILE}.out $${TESTFILE}.test_out ; \
                then    echo ${LITE} failed $${TESTFILE}; \
                        exit 1; \
                fi; \
-       done
-
-       cd Test/Java && \
-       ${JAVA_HOME}/bin/javac ${JFLAGS} -cp .:../../${NANOXML} `find -iname 
*.java` && \
+       done; \
+       cd ../Java && \
+       ${JAVA_HOME}/bin/javac ${JFLAGS} -cp .:../../${NANOXML} $$(find -iname 
*.java) && \
        for TESTFILE in *.xml; do\
                ${JAVA_HOME}/bin/java -cp .:../../${NANOXML} DumpXML 
$${TESTFILE} > $${TESTFILE}.test_out ; \
-               if diff -u $${TESTFILE}.out $${TESTFILE}.test_out ; \
+               if ! diff -u $${TESTFILE}.out $${TESTFILE}.test_out ; \
                then    echo ${NANOXML} failed $${TESTFILE}; \
                        exit 1; \
                fi; \
@@ -76,5 +76,5 @@ test:
        touch $@
 
 get-orig-source:
-       set -e
+       set -e; \
        sh ${SRCDIR}/debian/origCleaner.sh thisIsIgnored ${VERSION} alsoIgnored 
${SRCDIR}/debian/orig.tmp

Summary of changes:
• don’t confuse make variables with shell checks
• make rule lines are run sequentially; if you want them
  to affect the next line you have to combine them
• `…` is obsolete since 1988 or so, even in POSIX
• if COMMAND; then …; fi ← runs if COMMAND exits 0 (successfully),
  you want to check for deviations (failure to compare)

Meow,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”  ‣‣‣ Please, http://deb.li/mysql and MariaDB, finally die!

Reply via email to