summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-20 22:26:15 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-20 22:29:17 +0100
commit1a0965045bfa7eb277efb0cd8c3513b5c03ba810 (patch)
tree02b288209d8a650fb2d79ccadbf522a76056999a /guix/scripts
parent03411993a8848f8db93bcfccdba1098ac4557255 (diff)
downloadgnu-guix-1a0965045bfa7eb277efb0cd8c3513b5c03ba810.tar
gnu-guix-1a0965045bfa7eb277efb0cd8c3513b5c03ba810.tar.gz
guix package: Avoid spurious warnings from 'find-files'.
Reported by Andreas Enge <andreas@enge.fr>. * guix/scripts/package.scm (with-null-error-port): New macro. (search-path-environment-variables): Wrap 'search-path-as-list' call in 'with-null-error-port'.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/package.scm18
1 files changed, 14 insertions, 4 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 30b0658198..1ff898d8dd 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
@@ -331,6 +331,11 @@ an output path different than CURRENT-PATH."
;;; Search paths.
;;;
+(define-syntax-rule (with-null-error-port exp)
+ "Evaluate EXP with the error port pointing to the bit bucket."
+ (with-error-to-port (%make-void-port "w")
+ (lambda () exp)))
+
(define* (search-path-environment-variables entries profile
#:optional (getenv getenv))
"Return environment variable definitions that may be needed for the use of
@@ -373,9 +378,14 @@ current settings and report only settings not already effective."
(files (if pattern
(map (cut string-append <> "/") files)
files))
- (path (search-path-as-list files (list profile)
- #:type type
- #:pattern pattern)))
+
+ ;; XXX: Silence 'find-files' when it stumbles upon non-existent
+ ;; directories (see
+ ;; <http://lists.gnu.org/archive/html/guix-devel/2015-01/msg00269.html>.)
+ (path (with-null-error-port
+ (search-path-as-list files (list profile)
+ #:type type
+ #:pattern pattern))))
(if (every (cut member <> values) path)
#f
(format #f "export ~a=\"~a\""