unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 19364-done@debbugs.gnu.org
Subject: bug#19364: search-patch fails to consult GUIX_PACKAGE_PATH
Date: Sun, 04 Jan 2015 00:01:19 +0100	[thread overview]
Message-ID: <87vbkn79kw.fsf@gnu.org> (raw)
In-Reply-To: <87fvck549p.fsf@yeeloong.lan> (Mark H. Weaver's message of "Sat, 13 Dec 2014 03:43:14 -0500")

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

Mark H Weaver <mhw@netris.org> skribis:

> Tomáš Čech <sleep_walker@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1504 bytes --]

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.

[-- Attachment #3: Type: text/plain, Size: 276 bytes --]


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’.

      reply	other threads:[~2015-01-03 23:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-13  8:43 bug#19364: search-patch fails to consult GUIX_PACKAGE_PATH Mark H Weaver
2015-01-03 23:01 ` Ludovic Courtès [this message]

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=87vbkn79kw.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=19364-done@debbugs.gnu.org \
    --cc=mhw@netris.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).