From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#19364: search-patch fails to consult GUIX_PACKAGE_PATH Date: Sun, 04 Jan 2015 00:01:19 +0100 Message-ID: <87vbkn79kw.fsf@gnu.org> References: <87fvck549p.fsf@yeeloong.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y7Xhz-0006dQ-9J for bug-guix@gnu.org; Sat, 03 Jan 2015 18:02:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y7Xhr-00014e-Ez for bug-guix@gnu.org; Sat, 03 Jan 2015 18:02:11 -0500 Received: from debbugs.gnu.org ([140.186.70.43]:54740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y7Xhr-00014a-D4 for bug-guix@gnu.org; Sat, 03 Jan 2015 18:02:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y7Xhq-0002Ue-Sh for bug-guix@gnu.org; Sat, 03 Jan 2015 18:02:03 -0500 Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Message-ID: In-Reply-To: <87fvck549p.fsf@yeeloong.lan> (Mark H. Weaver's message of "Sat, 13 Dec 2014 03:43:14 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Mark H Weaver Cc: 19364-done@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mark H Weaver skribis: > Tom=C3=A1=C5=A1 =C4=8Cech reported on IRC that 'se= arch-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 #: > guix/packages.scm:374:17: Throw to key `match-error' with args `("match" = "no matching pattern" #f)'. I came up with this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: 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. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable However, since =E2=80=98search-patch=E2=80=99 errors happen at load time, t= he actual exception is hidden, and one just gets a =E2=80=9Cpackage not found=E2=80= =9D error. To fix that, we=E2=80=99d need to make =E2=80=98patches=E2=80=99 a thunked = field, which sounds reasonable to me. WDYT? Thanks, Ludo=E2=80=99. --=-=-=--