From dbab5150f83543f0c8a424dfddb698d7812370b7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 20 Jan 2015 10:17:24 +0100 Subject: 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. --- gnu/packages.scm | 9 +++++++-- tests/packages.scm | 20 ++++++++++++++++++++ 2 files changed, 27 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." diff --git a/tests/packages.scm b/tests/packages.scm index bd5ba3ee92..ef34e76380 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -42,6 +42,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (ice-9 regex) @@ -248,6 +249,25 @@ (string=? (derivation->output-path drv) (package-output %store package "out"))))) +(test-assert "patch not found yields a run-time error" + (guard (c ((condition-has-type? c &message) + (and (string-contains (condition-message c) + "does-not-exist.patch") + (string-contains (condition-message c) + "not found")))) + (let ((p (package + (inherit (dummy-package "p")) + (source (origin + (method (const #f)) + (uri "http://whatever") + (patches + (list (search-patch "does-not-exist.patch"))) + (sha256 + (base32 + "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks4"))))))) + (package-derivation %store p) + #f))) + (test-assert "trivial" (let* ((p (package (inherit (dummy-package "trivial")) (build-system trivial-build-system) -- cgit v1.2.3 ?id=a2b89a3319dc1d621c546855f578acae5baaf6da'>services: configuration: Step back from *unspecified*....Maxim Cournoyer 2022-06-15services: configuration: Use *unspecified* instead of 'disabled....Attila Lendvai 2022-06-10services: jami-configuration: Rename 'jamid' field to 'libjami'....Maxim Cournoyer 2022-06-10services: jami: Modernize to adjust to Shepherd 0.9+ changes....Maxim Cournoyer 2022-04-12services: Replace murmur-service-type with mumble-server-service-type....Liliana Marie Prikler 2022-03-24services: murmur: Fix server program name....fesoj000 2022-01-13services: Adjust the jami service for the upgraded jami....Maxim Cournoyer 2021-11-30services: Accept <inferior-package>s in lieu of <package>s....Tobias Geerinckx-Rice 2021-08-02Reinstate "services: Add a service for Jami."...Maxim Cournoyer 2021-08-02Revert "services: Add a service for Jami."...Maxim Cournoyer 2021-08-02services: Add a service for Jami....Maxim Cournoyer