Subject: bug#40588: closed (Re: [bug#40588] [PATCH] gnu: fish: Upgrade to 3.1.0.)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 08 May 2020 14:25:01 +0000

Your bug report

#40588: [PATCH] gnu: fish: Upgrade to 3.1.0.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
40588: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40588
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#40588] [PATCH] gnu: fish: Upgrade to 3.1.0.
From: Ludovic Courtès <[email-masked]>
To: John Soo <[email-masked]>
Cc: [email-masked]
Date: Fri, 08 May 2020 16:23:38 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi John,

Looks like this had fallen through the cracks…

John Soo <[email-masked]> skribis:

>>>From f3e813e2374b0bf38391488442a1bded1c4016b2 Mon Sep 17 00:00:00 2001
> From: John Soo <[email-masked]>
> Date: Sun, 12 Apr 2020 14:18:30 -0700
> Subject: [PATCH 2/2] gnu: fish: Upgrade to 3.1.0.
>
> * gnu/packages/shells (fish):[version] Update to 3.1.0. [arguments] Enable
>   tests, patch test files, and avoid patches that no longer apply. [inputs]
>   Make groff a native-input.

Applied!

For the other patch, can you please let us know separately when you
think it’s ready for inclusion?

Thanks,
Ludo’.

Subject: [PATCH] gnu: fish: Upgrade to 3.1.0.
From: John Soo <[email-masked]>
To: [email-masked]
Date: Sun, 12 Apr 2020 16:27:30 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix,

Fish shell had a large minor release a couple months ago. Here are the
patches to use the updated version.

It features a cmake build system, an extensive test suite and a lot of
new features and bug fixes.

I also include what I think might be a patch to export some variables
that should be exposed all the time but I am not sure.  That patch might
not be desirable to have on master yet, as it is mostly my research into
issue #30265.

Thanks!

John

>From 2277db5acc05cea916f96c9c7d6d417bd92eff5f Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 12 Apr 2020 15:53:35 -0700
Subject: [PATCH 1/2] gnu: fish: export extra directories.

* gnu/packages/shells.scm (fish): [arguments] export extra directories when
  patching __fish_build_paths.fish.
---
 gnu/packages/shells.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 8708b703ef..6b03b6bc0f 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -161,15 +161,15 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
                  " variables.\n"
                  "set -l __guix_profile_paths ~/.guix-profile"
                  " /run/current-system/profile\n"
-                 "set __extra_completionsdir"
+                 "set -xg __extra_completionsdir"
                  " $__guix_profile_paths\"/etc/fish/completions\""
                  " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
                  " $__extra_completionsdir\n"
-                 "set __extra_functionsdir"
+                 "set -xg __extra_functionsdir"
                  " $__guix_profile_paths\"/etc/fish/functions\""
                  " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
                  " $__extra_functionsdir\n"
-                 "set __extra_confdir"
+                 "set -xg __extra_confdir"
                  " $__guix_profile_paths\"/etc/fish/conf.d\""
                  " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
                  " $__extra_confdir\n")
-- 
2.26.0

>From f3e813e2374b0bf38391488442a1bded1c4016b2 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 12 Apr 2020 14:18:30 -0700
Subject: [PATCH 2/2] gnu: fish: Upgrade to 3.1.0.

* gnu/packages/shells (fish):[version] Update to 3.1.0. [arguments] Enable
  tests, patch test files, and avoid patches that no longer apply. [inputs]
  Make groff a native-input.
---
 gnu/packages/shells.scm | 74 +++++++++++++++++++++++++++--------------
 1 file changed, 49 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 6b03b6bc0f..b64c319eb8 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -40,6 +40,7 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libedit)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -48,13 +49,15 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages scheme)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix licenses)
-  #:use-module (guix packages))
+  #:use-module (guix packages)
+  #:use-module (guix utils))
 
 (define-public dash
   (package
@@ -95,7 +98,7 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
 (define-public fish
   (package
     (name "fish")
-    (version "3.0.2")
+    (version "3.1.0")
     (source
      (origin
        (method url-fetch)
@@ -103,38 +106,53 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
                            "releases/download/" version "/"
                            "fish-" version ".tar.gz"))
        (sha256
-        (base32 "03j3jl9jzlnhq4p86zj8wqsh5sx45j1d1fvfa80ks1cfdg68qwhl"))))
-    (build-system gnu-build-system)
+        (base32 "0s2356mlx7fp9kgqgw91lm5ds2i9iq9hq071fbqmcp3875l1xnz5"))))
+    (build-system cmake-build-system)
     (inputs
      `(("fish-foreign-env" ,fish-foreign-env)
-       ("groff" ,groff)                 ; for 'fish --help'
        ("ncurses" ,ncurses)
        ("pcre2" ,pcre2)      ; don't use the bundled PCRE2
        ("python" ,python)))  ; for fish_config and manpage completions
     (native-inputs
-     `(("doxygen" ,doxygen)))
+     `(("doxygen" ,doxygen)
+       ; for 'fish --help'
+       ("groff" ,groff)))
     (arguments
-     '(#:tests? #f                      ; no check target
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'patch-source
-           (lambda _
-             (substitute* '("build_tools/build_commands_hdr.sh"
-                            "build_tools/build_user_doc.sh")
-               (("/usr/bin/env") "env"))
-             #t))
-         ;; Embed absolute paths.
-         (add-before 'install 'embed-absolute-paths
-           (lambda _
-             (substitute* '("share/functions/__fish_config_interactive.fish"
-                            "share/functions/fish_config.fish"
-                            "share/functions/fish_update_completions.fish")
-               (("python3") (which "python3")))
-             (substitute* "share/functions/__fish_print_help.fish"
-               (("nroff") (which "nroff")))
-             #t))
+         (add-after 'unpack 'patch-tests
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((coreutils (assoc-ref inputs "coreutils"))
+                   (bash (assoc-ref inputs "bash")))
+               ;; These try to open a terminal
+               (delete-file "tests/checks/interactive.fish")
+               (delete-file "tests/checks/login-interactive.fish")
+               ;; These contain absolute path references
+               (substitute* "src/fish_tests.cpp"
+                 (("/bin/echo" echo) (string-append coreutils echo))
+                 (("/bin/ca" ca) (string-append coreutils ca))
+                 (("\"(/bin/c)\"" _ c) (string-append "\"" coreutils c "\""))
+                 (("/bin/ls_not_a_path" ls-not-a-path)
+                  (string-append coreutils ls-not-a-path))
+                 (("/bin/ls" ls) (string-append coreutils ls))
+                 (("(/bin/)\"" _ bin) (string-append coreutils bin "\""))
+                 (("/bin -" bin) (string-append coreutils bin))
+                 (((string-append
+                    "do_test\\(is_potential_path\\("
+                    "L\"/usr\", wds, vars, PATH_REQUIRE_DIR\\)\\);"))
+                  ""))
+               (substitute*
+                   (append (find-files "tests" ".*\\.(in|out|err)$")
+                           (find-files "tests/checks" ".*\\.fish"))
+                 (("/bin/pwd" pwd) (string-append coreutils pwd))
+                 (("/bin/echo" echo) (string-append coreutils echo))
+                 (("/bin/sh" sh) (string-append bash sh))
+                 (("/bin/ls" ls) (string-append coreutils ls)))
+               (substitute* (find-files "tests" ".*\\.(in|out|err)$")
+                 (("/usr/bin") (string-append coreutils "/bin")))
+               #t)))
          ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
-         (add-before 'install 'patch-fish-config
+         (add-after 'patch-tests 'patch-fish-config
            (lambda _
              (let ((port (open-file "etc/config.fish" "a")))
                (display (string-append
@@ -147,6 +165,12 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
                         port)
                (close-port port))
              #t))
+         ;; Embed absolute paths.
+         (add-before 'install 'embed-absolute-paths
+           (lambda _
+               (substitute* "share/functions/__fish_print_help.fish"
+                 (("nroff") (which "nroff")))
+               #t))
          ;; Enable completions, functions and configurations in user's and
          ;; system's guix profiles by adding them to __extra_* variables.
          (add-before 'install 'patch-fish-extra-paths
-- 
2.26.0