GNU bug report logs - #19364
search-patch fails to consult GUIX_PACKAGE_PATH

Previous Next

Package: guix;

Reported by: Mark H Weaver <mhw <at> netris.org>

Date: Sat, 13 Dec 2014 08:46:01 UTC

Severity: normal

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 19364 in the body.
You can then email your comments to 19364 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 bug-guix <at> gnu.org:
bug#19364; Package guix. (Sat, 13 Dec 2014 08:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mark H Weaver <mhw <at> netris.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 13 Dec 2014 08:46:02 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: bug-guix <at> gnu.org
Subject: search-patch fails to consult GUIX_PACKAGE_PATH
Date: Sat, 13 Dec 2014 03:43:14 -0500
Tomáš Čech <sleep_walker <at> suse.cz> reported on IRC that 'search-patch'
failed to find a patch he had put into DIR/gnu/packages/patches/, where
DIR was in $GUIX_PACKAGE_PATH.  Adding DIR to GUILE_LOAD_PATH fixed the
problem.

Also, it would be good to improve the error message when 'search-patch'
fails.  This is what he reported seeing:

--8<---------------cut here---------------start------------->8---
guix/packages.scm:374:17: In procedure #<procedure 47c70c0 at guix/packages.scm:372:9 (number patch)>:
guix/packages.scm:374:17: Throw to key `match-error' with args `("match" "no matching pattern" #f)'.
--8<---------------cut here---------------end--------------->8---

      Mark




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sat, 03 Jan 2015 23:02:02 GMT) Full text and rfc822 format available.

Notification sent to Mark H Weaver <mhw <at> netris.org>:
bug acknowledged by developer. (Sat, 03 Jan 2015 23:02:03 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw <at> netris.org>
Cc: 19364-done <at> debbugs.gnu.org
Subject: Re: bug#19364: search-patch fails to consult GUIX_PACKAGE_PATH
Date: Sun, 04 Jan 2015 00:01:19 +0100
[Message part 1 (text/plain, inline)]
Mark H Weaver <mhw <at> netris.org> skribis:

> Tomáš Čech <sleep_walker <at> suse.cz> reported on IRC that 'search-patch'
> failed to find a patch he had put into DIR/gnu/packages/patches/, where
> DIR was in $GUIX_PACKAGE_PATH.  Adding DIR to GUILE_LOAD_PATH fixed the
> problem.

Fixed in ee06af5.

> Also, it would be good to improve the error message when 'search-patch'
> fails.  This is what he reported seeing:
>
> guix/packages.scm:374:17: In procedure #<procedure 47c70c0 at guix/packages.scm:372:9 (number patch)>:
> guix/packages.scm:374:17: Throw to key `match-error' with args `("match" "no matching pattern" #f)'.

I came up with this patch:

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 7f0b58b..57a3e21 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -30,6 +30,8 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (srfi srfi-39)
   #:export (search-patch
             search-bootstrap-binary
@@ -70,13 +72,23 @@
         %load-path)))
 
 (define (search-patch file-name)
-  "Search the patch FILE-NAME."
-  (search-path (%patch-path) file-name))
+  "Search the patch FILE-NAME.  Raise an error if not found."
+  (or (search-path (%patch-path) file-name)
+      (raise (condition
+              (&message (message (format #f (_ "~a: patch not found")
+                                         file-name)))))))
 
 (define (search-bootstrap-binary file-name system)
-  "Search the bootstrap binary FILE-NAME for SYSTEM."
-  (search-path (%bootstrap-binaries-path)
-               (string-append system "/" file-name)))
+  "Search the bootstrap binary FILE-NAME for SYSTEM.  Raise an error if not
+found."
+  (or (search-path (%bootstrap-binaries-path)
+                   (string-append system "/" file-name))
+      (raise (condition
+              (&message
+               (message
+                (format #f (_ "could not find bootstrap binary '~a' \
+for system '~a'")
+                        file-name system)))))))
 
 (define %distro-root-directory
   ;; Absolute file name of the module hierarchy.
[Message part 3 (text/plain, inline)]
However, since ‘search-patch’ errors happen at load time, the actual
exception is hidden, and one just gets a “package not found” error.

To fix that, we’d need to make ‘patches’ a thunked field, which sounds
reasonable to me.  WDYT?

Thanks,
Ludo’.

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

This bug report was last modified 9 years and 58 days ago.

Previous Next


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