unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 43818@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#43818: [PATCH] packages: Fix a bug in %patch-path.
Date: Sun, 25 Oct 2020 01:52:34 -0400	[thread overview]
Message-ID: <20201025055234.19912-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <878sckk22g.fsf@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 1899 bytes --]

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





  parent reply	other threads:[~2020-10-25  5:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 17:36 bug#43818: Use of local-file in icecat-source definition breaks REPL Maxim Cournoyer
2020-10-05 17:39 ` Maxim Cournoyer
2020-10-24  4:55 ` Maxim Cournoyer
     [not found] ` <handler.43818.D43818.160351533211096.notifdone@debbugs.gnu.org>
2020-10-25  2:14   ` bug#43818: Use of local-file in icecat-source definition breaks REPL) Maxim Cournoyer
2020-10-25  5:52 ` Maxim Cournoyer [this message]
2020-10-26 23:15   ` bug#43818: [PATCH] packages: Fix a bug in %patch-path Ludovic Courtès
2020-10-27 16:41     ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201025055234.19912-1-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=43818@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).