GNU bug report logs - #30772
[PATCH 0/2] Factorize the 'bootstrap' phase

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sun, 11 Mar 2018 21:14:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


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

From: Ludovic Courtès <ludo <at> gnu.org>
To: 30772 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 1/2] utils: Add 'false-if-file-not-found'.
Date: Sun, 11 Mar 2018 22:49:50 +0100
* guix/build/utils.scm (false-if-file-not-found): New macro.
---
 guix/build/utils.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index d7ed3d517..ab309aa0d 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2013 Andreas Enge <andreas <at> enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita <at> karetnikov.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw <at> netris.org>
@@ -61,6 +61,7 @@
             delete-file-recursively
             file-name-predicate
             find-files
+            false-if-file-not-found
 
             search-path-as-list
             set-path-environment-variable
@@ -396,6 +397,15 @@ also be included.  If FAIL-ON-ERROR? is true, raise an exception upon error."
                             stat)
           string<?)))
 
+(define-syntax-rule (false-if-file-not-found exp)
+  "Evaluate EXP but return #f if it raises to 'system-error with ENOENT."
+  (catch 'system-error
+    (lambda () exp)
+    (lambda args
+      (if (= ENOENT (system-error-errno args))
+          #f
+          (apply throw args)))))
+
 
 ;;;
 ;;; Search paths.
-- 
2.16.2





This bug report was last modified 7 years and 96 days ago.

Previous Next


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