summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-20 10:17:24 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-20 10:17:24 +0100
commitdbab5150f83543f0c8a424dfddb698d7812370b7 (patch)
tree8e6e4194a1b734885eb60cc6a7075906519994e7 /gnu
parent6b1f9721a83f343315ae4b936ec9b9542ba8523e (diff)
downloadguix-dbab5150f83543f0c8a424dfddb698d7812370b7.tar.gz
gnu: 'search-patch' raises an error when a patch is not found.
* gnu/packages.scm (search-patch): Raise an error condition when
  'search-path' returns #f.
* tests/packages.scm ("patch not found yields a run-time error"): New
  test.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 7f0b58b971..263addb8be 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,8 +72,11 @@
         %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."