[Pkg-zsh-commits] [zsh] 01/01: Add conditional patch to prevent FTBFS on Hurd in case of wrong test assumptions

Axel Beckert abe at deuxchevaux.org
Fri Sep 20 15:15:19 UTC 2013


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch debian
in repository zsh.

commit ba5c7320d4876deb14dba60584fcdf5d5774e13b
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Fri Sep 20 17:09:30 2013 +0200

    Add conditional patch to prevent FTBFS on Hurd in case of wrong test assumptions
    
    debian/rules now calls debian/patch-test-suite.sh with some parameters
    to modify or unmodify Test/C02cond.ztst in a way that either the
    character device for testing zsh's -c either exists or the test for -c
    is disabled at all.
    
    There are three ways in which debian/patch-test-suite.sh can patch
    Test/C02cond.ztst:
    
    * Not at all if /dev/tty exists and is a character device.
    * Replace all occurrences of /dev/tty with another tty in case
      /dev/tty does not exist, but others do.
    * Disable the test for zsh's -c completely if no tty at all is
      available as to be tested character device.
---
 debian/patch-test-suite.sh                         |   48 ++++++++++++++++++++
 .../patches/disable-tests-which-need-dev-tty.patch |   29 ++++++++++++
 debian/rules                                       |   13 +++++-
 3 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/debian/patch-test-suite.sh b/debian/patch-test-suite.sh
new file mode 100755
index 0000000..9e46ae4
--- /dev/null
+++ b/debian/patch-test-suite.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+TEST=Test/C02cond.ztst
+
+if [ "$1" = "--reverse" ]; then
+    TTY="$2"
+
+    # Unpatch
+    if [ "$TTY" = "/dev/tty" ]; then
+        exit 0;
+    elif [ -n "$TTY" ]; then
+        echo "Replacing $TTY with /dev/tty in $TEST"
+        sed -e "s:$TTY:/dev/tty:" -i $TEST || true
+    else
+        echo "Patch back in that check that needs /dev/tty. (Failures are ok.)"
+        patch -R -f --no-backup-if-mismatch -F0 -r- -s -p1 < debian/patches/disable-tests-which-need-dev-tty.patch || true
+    fi
+else
+    TTY="$1"
+
+    if [ "$TTY" = "/dev/tty" ]; then
+        # Sanity check
+        if [ -c /dev/tty ]; then
+            echo "/dev/tty exists and is a character device, hence no patching needed."
+            exit 0;
+        else
+
+            echo "$MAKE's -c test in debian/rules said /dev/tty is"
+            echo "a character device, but $0's checks says it's not:"
+            ls -l /dev/tty
+            exit 1
+        fi
+    elif [ -n "$TTY" ]; then
+        echo "Replacing /dev/tty with $TTY in $TEST"
+        sed -e "s:/dev/tty:$TTY:" -i $TEST
+    else
+        echo "Huh? No character device named tty* found at all in /dev/"
+        # Reality check
+        find /dev/ -name 'tty*' -type c || true
+
+        echo "Well, then let's patch out that check that needs"
+        echo "/dev/tty to be a character device."
+
+        patch -f --no-backup-if-mismatch -F0 -r- -s -p1 < debian/patches/disable-tests-which-need-dev-tty.patch
+    fi
+fi
diff --git a/debian/patches/disable-tests-which-need-dev-tty.patch b/debian/patches/disable-tests-which-need-dev-tty.patch
new file mode 100644
index 0000000..6c2233f
--- /dev/null
+++ b/debian/patches/disable-tests-which-need-dev-tty.patch
@@ -0,0 +1,29 @@
+Description: Disable /dev/tty needing test in test-suite
+ One test in C02cond.ztst of the upstream test-suite always fails if
+ /dev/tty does not exist or is no character device..
+ .
+ This may be the case on the GNU/Hurd buildds.
+ .
+ This patch removes that test. As this is not always wanted, this test
+ should never be listed in debian/patches/series, but will be applied
+ when necessary by debian/patch-test-suite.sh.
+ .
+ Again: DO NOT LIST THIS PATCH IN THE series FILE.
+Author: Axel Beckert <abe at debian.org>
+
+Index: zsh/Test/C02cond.ztst
+===================================================================
+--- zsh.orig/Test/C02cond.ztst	2013-09-14 02:42:12.000000000 +0200
++++ zsh/Test/C02cond.ztst	2013-09-20 16:04:20.000000000 +0200
+@@ -41,11 +41,6 @@
+   fi
+ 0D:-b cond
+ 
+-  # Use hardcoded /dev/tty because globbing inside /dev fails on Cygwin
+-  char=/dev/tty
+-  [[ -c $char && ! -c $zerolength ]]
+-0:-c cond
+-
+   [[ -d . && ! -d zerolength ]]
+ 0:-d cond
+ 
diff --git a/debian/rules b/debian/rules
index 042cf8f..8909128 100755
--- a/debian/rules
+++ b/debian/rules
@@ -42,9 +42,13 @@ endif
 
 BUILT_USING=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libcap-dev libncursesw5-dev libpcre3-dev eglibc)
 
+# Check for /dev/tty and find potential alternatives to avoid test
+# suite failures on hurd
+TESTTTY=$(shell if [ -c /dev/tty ]; then echo /dev/tty; else find /dev -name 'tty*' -type c | head -1; fi)
+
 build: build-arch build-indep
 
-build-arch: configure-stamp
+build-arch: configure-stamp prepare-tests-stamp
 	dh_auto_build -B obj --parallel
 	HOME="$(CURDIR)/obj/testhome" dh_auto_test -B obj --parallel
 	touch $@
@@ -53,7 +57,7 @@ build-indep: configure-stamp
 	dh_auto_build -B obj --parallel -- pdf
 	touch $@
 
-build-static: configure-static-stamp
+build-static: configure-static-stamp prepare-tests-stamp
 	dh_testdir
 	dh_auto_build -B obj-static --parallel
 	HOME="$(CURDIR)/obj-static/testhome" dh_auto_test -B obj-static --parallel || true
@@ -62,6 +66,10 @@ build-static: configure-static-stamp
 build-debug: DEB_BUILD_OPTIONS+=debug
 build-debug: build
 
+prepare-tests-stamp:
+	debian/patch-test-suite.sh "$(TESTTTY)"
+	touch $@
+
 configure:
 	touch stamp-h.in
 	dh_autoreconf
@@ -89,6 +97,7 @@ clean:
 	dh_auto_clean -B obj        --parallel
 	dh_auto_clean -B obj-static --parallel
 	dh_auto_clean               --parallel
+	debian/patch-test-suite.sh  --reverse $(TESTTTY)
 	dh_clean
 	rm -rf config.cache obj obj-static autom4te.cache
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git



More information about the Pkg-zsh-commits mailing list