bug-guix
[Top][All Lists]
Advanced

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

bug#43818: [PATCH] packages: Fix a bug in %patch-path.


From: Maxim Cournoyer
Subject: bug#43818: [PATCH] packages: Fix a bug in %patch-path.
Date: Sun, 25 Oct 2020 01:52:34 -0400

Fixes <https://issues.guix.gnu.org/43818>.

Having the Guix root trailed by a slash in the GUILE_LOAD_PATH would
previously cause %patch-path to not return an entry with the patches
sub-directory, leading to errors such as:

   While executing meta-command:
   ERROR:
     1. &formatted-message:
         format: "~a: patch not found\n"
         arguments: ("icecat-use-older-reveal-hidden-html.patch")

* gnu/packages.scm (strip-trailing-slash): New procedure.
(%patch-path): Use it to strip any trailing slash from the %load-path entries.
---
 gnu/packages.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index ccfc83dd11..f5acbda897 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -4,6 +4,7 @@
 ;;; Copyright ?? 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright ?? 2016, 2017 Alex Kost <alezost@gmail.com>
 ;;; Copyright ?? 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright ?? 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -159,6 +160,12 @@ flags."
              %default-package-module-path
              channels-scm))))
 
+(define (strip-trailing-slash s)
+  ;; Strip the trailing slash of a string, if present.
+  (if (string-suffix? "/" s)
+      (string-drop-right s 1)
+      s))
+
 (define %patch-path
   ;; Define it after '%package-module-path' so that '%load-path' contains user
   ;; directories, allowing patches in $GUIX_PACKAGE_PATH to be found.
@@ -167,7 +174,7 @@ flags."
           (if (string=? directory %distro-root-directory)
               (string-append directory "/gnu/packages/patches")
               directory))
-        %load-path)))
+        (map strip-trailing-slash %load-path))))
 
 ;; This procedure is used by Emacs-Guix up to 0.5.1.1, so keep it for now.
 ;; See <https://github.com/alezost/guix.el/issues/30>.
-- 
2.28.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]