diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-01-20 22:26:15 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-01-20 22:29:17 +0100 |
| commit | 1a0965045bfa7eb277efb0cd8c3513b5c03ba810 (patch) | |
| tree | 02b288209d8a650fb2d79ccadbf522a76056999a | |
| parent | 03411993a8848f8db93bcfccdba1098ac4557255 (diff) | |
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'.
| -rw-r--r-- | guix/scripts/package.scm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 30b0658198e..1ff898d8dd2 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> | 3 | ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> |
| 4 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> | 4 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> |
| 5 | ;;; Copyright © 2014 Alex Kost <alezost@gmail.com> | 5 | ;;; Copyright © 2014 Alex Kost <alezost@gmail.com> |
| @@ -331,6 +331,11 @@ an output path different than CURRENT-PATH." | |||
| 331 | ;;; Search paths. | 331 | ;;; Search paths. |
| 332 | ;;; | 332 | ;;; |
| 333 | 333 | ||
| 334 | (define-syntax-rule (with-null-error-port exp) | ||
| 335 | "Evaluate EXP with the error port pointing to the bit bucket." | ||
| 336 | (with-error-to-port (%make-void-port "w") | ||
| 337 | (lambda () exp))) | ||
| 338 | |||
| 334 | (define* (search-path-environment-variables entries profile | 339 | (define* (search-path-environment-variables entries profile |
| 335 | #:optional (getenv getenv)) | 340 | #:optional (getenv getenv)) |
| 336 | "Return environment variable definitions that may be needed for the use of | 341 | "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." | |||
| 373 | (files (if pattern | 378 | (files (if pattern |
| 374 | (map (cut string-append <> "/") files) | 379 | (map (cut string-append <> "/") files) |
| 375 | files)) | 380 | files)) |
| 376 | (path (search-path-as-list files (list profile) | 381 | |
| 377 | #:type type | 382 | ;; XXX: Silence 'find-files' when it stumbles upon non-existent |
| 378 | #:pattern pattern))) | 383 | ;; directories (see |
| 384 | ;; <http://lists.gnu.org/archive/html/guix-devel/2015-01/msg00269.html>.) | ||
| 385 | (path (with-null-error-port | ||
| 386 | (search-path-as-list files (list profile) | ||
| 387 | #:type type | ||
| 388 | #:pattern pattern)))) | ||
| 379 | (if (every (cut member <> values) path) | 389 | (if (every (cut member <> values) path) |
| 380 | #f | 390 | #f |
| 381 | (format #f "export ~a=\"~a\"" | 391 | (format #f "export ~a=\"~a\"" |
