GNU bug report logs - #32608
[PATCH] gnu: haskell-mode: Fix test failure.

Previous Next

Package: guix-patches;

Reported by: Alex Vong <alexvong1995 <at> gmail.com>

Date: Sun, 2 Sep 2018 00:36:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32608 in the body.
You can then email your comments to 32608 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#32608; Package guix-patches. (Sun, 02 Sep 2018 00:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Vong <alexvong1995 <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 02 Sep 2018 00:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH] gnu: haskell-mode: Fix test failure.
Date: Sun, 02 Sep 2018 08:34:53 +0800
[Message part 1 (text/plain, inline)]
Hello guix,

I manage to fix all test failures of haskell-mode (which FTBFS for a
long time). I use Jack's bug report
<https://github.com/haskell/haskell-mode/issues/1601> as a starting
point and continue from there. The fix consists of backporting 2 commits
from upstream and hard-coding the filename in the tests. (This is okay
since the tests will not be installed.) 

Let's write some Haskell for good (`・ω・´)

[0001-gnu-haskell-mode-Fix-test-failure.patch (text/x-diff, inline)]
From 99fefcd43adbe8effe24480e64f9fa0b461b8fe5 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 2 Sep 2018 07:47:05 +0800
Subject: [PATCH] gnu: haskell-mode: Fix test failure.

Thanks to Jack Hill <jackhill <at> jackhill.us> for exploring differnt solutions
at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31726>.

* gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch,
gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch:
New files.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/emacs.scm (haskell-mode)[source]: Use them.
[arguments]: Adjust 'pre-build' phase to embed filename.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/emacs.scm                        | 17 ++++---
 ...ode-Removed-unused-lexical-variables.patch | 44 +++++++++++++++++++
 ...-removed-check-conventions-from-make.patch | 35 +++++++++++++++
 4 files changed, 91 insertions(+), 7 deletions(-)
 create mode 100644 gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch
 create mode 100644 gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 91de38c5a..7bb88f151 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -791,6 +791,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
   %D%/packages/patches/gzdoom-search-in-installed-share.patch	\
   %D%/packages/patches/handbrake-pkg-config-path.patch		\
+  %D%/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch	\
+  %D%/packages/patches/haskell-mode-removed-check-conventions-from-make.patch	\
   %D%/packages/patches/hdf4-architectures.patch 		\
   %D%/packages/patches/hdf4-reproducibility.patch 		\
   %D%/packages/patches/hdf4-shared-fortran.patch 		\
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a1ce64ffa..b6121961d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -646,7 +646,11 @@ only a handful of functions that are not resource-specific.")
                     "https://github.com/haskell/haskell-mode/archive/v"
                     version ".tar.gz"))
               (sha256
-               (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))))
+               (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))
+              (patches
+               (search-patches ; backport test failure fixes
+                "haskell-mode-Removed-unused-lexical-variables.patch"
+                "haskell-mode-removed-check-conventions-from-make.patch"))))
     (inputs
      `(("emacs-el-search" ,emacs-el-search) ; for tests
        ("emacs-stream" ,emacs-stream)))     ; for tests
@@ -686,12 +690,11 @@ only a handful of functions that are not resource-specific.")
                               (_ ""))
                             inputs)))
               (substitute* (find-files "." "\\.el") (("/bin/sh") sh))
-              (substitute* "tests/haskell-code-conventions.el"
-                ;; Function name recently changed in "emacs-el-search".
-                (("el-search--search-pattern") "el-search-forward")
-                ;; Don't contact home.
-                (("\\(when \\(>= emacs-major-version 25\\)")
-                 "(require 'el-search) (when nil"))
+              ;; embed filename to fix test failure
+              (let ((file "tests/haskell-cabal-tests.el"))
+                (substitute* file
+                  (("\\(buffer-file-name\\)")
+                   (format #f "(or (buffer-file-name) ~s)" file))))
               #t)))
          (replace
           'install
diff --git a/gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch b/gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch
new file mode 100644
index 000000000..b175fae28
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch
@@ -0,0 +1,44 @@
+Copied verbatim from upstream repository.
+
+From cee22450ee30e79952f594796721dc6b17798ee6 Mon Sep 17 00:00:00 2001
+From: Sascha Wilde <wilde <at> sha-bang.de>
+Date: Fri, 23 Sep 2016 15:35:59 +0200
+Subject: [PATCH] Removed unused lexical variables.
+
+---
+ haskell-lexeme.el  | 3 +--
+ haskell-process.el | 4 +---
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/haskell-lexeme.el b/haskell-lexeme.el
+index 4256a79..b832560 100644
+--- a/haskell-lexeme.el
++++ b/haskell-lexeme.el
+@@ -138,8 +138,7 @@ When match is successful, match-data will contain:
+   (match-text 2) - whole qualified identifier
+   (match-text 3) - unqualified part of identifier
+   (match-text 4) - closing backtick"
+-  (let ((begin (point))
+-        (match-data-old (match-data))
++  (let ((match-data-old (match-data))
+         first-backtick-start
+         last-backtick-start
+         qid-start
+diff --git a/haskell-process.el b/haskell-process.el
+index b4efba2..4f3f859 100644
+--- a/haskell-process.el
++++ b/haskell-process.el
+@@ -160,9 +160,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
+ (defun haskell-process-log (msg)
+   "Effective append MSG to the process log (if enabled)."
+   (when haskell-process-log
+-    (let* ((append-to (get-buffer-create "*haskell-process-log*"))
+-           (windows (get-buffer-window-list append-to t t))
+-           move-point-in-windows)
++    (let* ((append-to (get-buffer-create "*haskell-process-log*")))
+       (with-current-buffer append-to
+         ;; point should follow insertion so that it stays at the end
+         ;; of the buffer
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch b/gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch
new file mode 100644
index 000000000..a4d4d525f
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch
@@ -0,0 +1,35 @@
+Copied from upstream repository.
+Hunk #2 is removed since it cannot be applied and it is not needed.
+
+From 7cead7137bf54851c1b7df5a3854351296d21276 Mon Sep 17 00:00:00 2001
+From: Vasantha Ganesh K <vasanthaganesh.k <at> tuta.io>
+Date: Thu, 22 Jun 2017 23:38:40 +0530
+Subject: [PATCH] removed `check-conventions' from make
+
+---
+ Makefile                          |   7 +-
+ tests/haskell-code-conventions.el | 165 ------------------------------
+ 2 files changed, 1 insertion(+), 171 deletions(-)
+ delete mode 100644 tests/haskell-code-conventions.el
+
+diff --git a/Makefile b/Makefile
+index b2c89d6..aa907c5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -79,12 +79,7 @@ build-$(EMACS_VERSION)/build-flag : build-$(EMACS_VERSION) $(patsubst %.el,build
+ check-%: tests/%-tests.el
+ 	$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;
+ 
+-check: compile $(AUTOLOADS) check-ert check-conventions
+-
+-check-conventions :
+-	$(BATCH) -l tests/haskell-code-conventions.el                                           \
+-                 -f haskell-check-conventions-batch-and-exit
+-	@echo "conventions are okay"
++check: compile $(AUTOLOADS) check-ert
+ 
+ check-ert: $(ELCHECKS)
+ 	$(BATCH) --eval "(when (= emacs-major-version 24)					\
+-- 
+2.18.0
+
-- 
2.18.0

[Message part 3 (text/plain, inline)]
Cheers,
Alex
[signature.asc (application/pgp-signature, inline)]

Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sun, 02 Sep 2018 15:09:03 GMT) Full text and rfc822 format available.

Notification sent to Alex Vong <alexvong1995 <at> gmail.com>:
bug acknowledged by developer. (Sun, 02 Sep 2018 15:09:03 GMT) Full text and rfc822 format available.

Message #10 received at 32608-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: 32608-done <at> debbugs.gnu.org, 31726-done <at> debbugs.gnu.org
Subject: Re: [bug#32608] [PATCH] gnu: haskell-mode: Fix test failure.
Date: Sun, 02 Sep 2018 17:08:17 +0200
Hi Alex,

Alex Vong <alexvong1995 <at> gmail.com> skribis:

> I manage to fix all test failures of haskell-mode (which FTBFS for a
> long time). I use Jack's bug report
> <https://github.com/haskell/haskell-mode/issues/1601> as a starting
> point and continue from there. The fix consists of backporting 2 commits
> from upstream and hard-coding the filename in the tests. (This is okay
> since the tests will not be installed.) 

Awesome.

> Let's write some Haskell for good (`・ω・´)

:-)

> From 99fefcd43adbe8effe24480e64f9fa0b461b8fe5 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995 <at> gmail.com>
> Date: Sun, 2 Sep 2018 07:47:05 +0800
> Subject: [PATCH] gnu: haskell-mode: Fix test failure.
>
> Thanks to Jack Hill <jackhill <at> jackhill.us> for exploring differnt solutions
> at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31726>.
>
> * gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch,
> gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch:
> New files.
> * gnu/local.mk (dist_patch_DATA): Add them.
> * gnu/packages/emacs.scm (haskell-mode)[source]: Use them.
> [arguments]: Adjust 'pre-build' phase to embed filename.

I’ve shorted the patch file names as suggested by ‘guix lint’, added a
“Fixes” line in the commit log, and applied.

Thanks to both of you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 01 Oct 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.