build-system/gnu: Fix `#:path-exclusions' handling.

* guix/build/gnu-build-system.scm (set-paths)[relevant-input-directories]:
  New procedure.  Use it.  This fixes #:path-exclusions handling.
This commit is contained in:
Ludovic Courtès 2012-09-06 22:58:43 +02:00
parent 9d9ef458e8
commit 2d14ef0f2c

View file

@ -49,38 +49,34 @@ (define (first-subdirectory dir)
(define* (set-paths #:key inputs (path-exclusions '()) (define* (set-paths #:key inputs (path-exclusions '())
#:allow-other-keys) #:allow-other-keys)
(let ((inputs (map cdr inputs))) (define (relevant-input-directories env-var)
;; Return the subset of INPUTS that should be considered when setting
;; ENV-VAR.
(match (assoc-ref path-exclusions env-var)
(#f
(map cdr inputs))
((excluded ...)
(filter-map (match-lambda
((name . dir)
(and (not (member name excluded))
dir)))
inputs))))
(set-path-environment-variable "PATH" '("bin") (set-path-environment-variable "PATH" '("bin")
(remove (cute member <> (relevant-input-directories "PATH"))
(or (assoc-ref path-exclusions
"PATH")
'()))
inputs))
(set-path-environment-variable "CPATH" '("include") (set-path-environment-variable "CPATH" '("include")
(remove (cute member <> (relevant-input-directories "CPATH"))
(or (assoc-ref path-exclusions
"CPATH")
'()))
inputs))
(set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64") (set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64")
(remove (cute member <> (relevant-input-directories "LIBRARY_PATH"))
(or (assoc-ref path-exclusions
"LIBRARY_PATH")
'()))
inputs))
;; FIXME: Eventually move this to the `search-paths' field of the ;; FIXME: Eventually move this to the `search-paths' field of the
;; `pkg-config' package. ;; `pkg-config' package.
(set-path-environment-variable "PKG_CONFIG_PATH" (set-path-environment-variable "PKG_CONFIG_PATH"
'("lib/pkgconfig" "lib64/pkgconfig") '("lib/pkgconfig" "lib64/pkgconfig")
(remove (cute member <> (relevant-input-directories "PKG_CONFIG_PATH"))
(or (assoc-ref path-exclusions
"PKG_CONFIG_PATH")
'()))
inputs))
;; Dump the environment variables as a shell script, for handy debugging. ;; Dump the environment variables as a shell script, for handy debugging.
(system "export > environment-variables"))) (system "export > environment-variables"))
(define* (unpack #:key source #:allow-other-keys) (define* (unpack #:key source #:allow-other-keys)
(and (zero? (system* "tar" "xvf" source)) (and (zero? (system* "tar" "xvf" source))