[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
47/66: search-paths: Add 'environment-variable-definition'.
From: |
Manolis Fragkiskos Ragkousis |
Subject: |
47/66: search-paths: Add 'environment-variable-definition'. |
Date: |
Thu, 21 May 2015 12:52:05 +0000 |
phant0mas pushed a commit to branch wip-hurd
in repository guix.
commit 0a49822f9f0155b80151aa4f2011432704e12e5f
Author: Ludovic Courtès <address@hidden>
Date: Mon May 4 22:06:24 2015 +0200
search-paths: Add 'environment-variable-definition'.
* guix/search-paths.scm (environment-variable-definition): New variable.
* guix/scripts/package.scm (search-path-environment-variables): Use it.
---
guix/scripts/package.scm | 2 +-
guix/search-paths.scm | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 933f7d8..9e433dd 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -384,7 +384,7 @@ current settings and report only settings not already
effective."
(append-map manifest-entry-search-paths entries))))
(filter-map (match-lambda
((variable . value)
- (format #f "export ~a=\"~a\"" variable value)))
+ (environment-variable-definition variable value)))
(evaluate-search-paths search-paths profile getenv))))
(define (display-search-paths entries profile)
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index b17f5ac..7957c88 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -33,7 +33,8 @@
search-path-specification->sexp
sexp->search-path-specification
- evaluate-search-paths))
+ evaluate-search-paths
+ environment-variable-definition))
;;; Commentary:
;;;
@@ -144,4 +145,26 @@ current settings and report only settings not already
effective."
(filter-map search-path-definition search-paths))
+(define* (environment-variable-definition variable value
+ #:key
+ (kind 'exact)
+ (separator ":"))
+ "Return a the definition of VARIABLE to VALUE in Bash syntax:
+
+KIND can be either 'exact (return the definition of VARIABLE=VALUE),
+'prefix (return the definition where VALUE is added as a prefix to VARIABLE's
+current value), or 'suffix (return the definition where VALUE is added as a
+suffix to VARIABLE's current value.) In the case of 'prefix and 'suffix,
+SEPARATOR is used as the separator between VARIABLE's current value and its
+prefix/suffix."
+ (match kind
+ ('exact
+ (format #f "export ~a=\"~a\"" variable value))
+ ('prefix
+ (format #f "export ~a=\"~a${~a:+~a}$~a\""
+ variable value variable separator variable))
+ ('suffix
+ (format #f "export ~a=\"$~a${~a:+~a}~a\""
+ variable variable variable separator value))))
+
;;; search-paths.scm ends here
- 37/66: doc: Suggest 'groupadd --system'., (continued)
- 37/66: doc: Suggest 'groupadd --system'., Manolis Fragkiskos Ragkousis, 2015/05/21
- 34/66: gnu: Add taskwarrior., Manolis Fragkiskos Ragkousis, 2015/05/21
- 39/66: gnu: Add python-sympy., Manolis Fragkiskos Ragkousis, 2015/05/21
- 35/66: gnu: bamtools: Set rpath via LDFLAGS., Manolis Fragkiskos Ragkousis, 2015/05/21
- 33/66: gnu: Add samtools-0.1.19., Manolis Fragkiskos Ragkousis, 2015/05/21
- 31/66: gnu: samtools: Remove patch-makefile-curses phase., Manolis Fragkiskos Ragkousis, 2015/05/21
- 36/66: doc: Clarify installation from the binary tarball., Manolis Fragkiskos Ragkousis, 2015/05/21
- 43/66: substitute: Increase TTL from 24h to 36h., Manolis Fragkiskos Ragkousis, 2015/05/21
- 40/66: gnu: curl: Update to 7.42.1., Manolis Fragkiskos Ragkousis, 2015/05/21
- 44/66: gnu: Add markdown., Manolis Fragkiskos Ragkousis, 2015/05/21
- 47/66: search-paths: Add 'environment-variable-definition'.,
Manolis Fragkiskos Ragkousis <=
- 49/66: profiles: Use a &message error condition instead of 'error'., Manolis Fragkiskos Ragkousis, 2015/05/21
- 48/66: search-paths: 'evaluate-search-paths' now returns spec/value pairs., Manolis Fragkiskos Ragkousis, 2015/05/21
- 42/66: gnu: Add libwpg., Manolis Fragkiskos Ragkousis, 2015/05/21
- 41/66: guix: build: Fix indentation for --sources in help output., Manolis Fragkiskos Ragkousis, 2015/05/21
- 46/66: search-paths: Add 'evaluate-search-paths', from (guix scripts package)., Manolis Fragkiskos Ragkousis, 2015/05/21
- 45/66: Move search path specifications to (guix search-paths)., Manolis Fragkiskos Ragkousis, 2015/05/21
- 51/66: gnu: Add soil., Manolis Fragkiskos Ragkousis, 2015/05/21
- 50/66: records: Make 'make-syntactic-constructor' available at load/eval/expand., Manolis Fragkiskos Ragkousis, 2015/05/21
- 56/66: gnu: vcftools: Remove "-m64" from CFLAGS., Manolis Fragkiskos Ragkousis, 2015/05/21
- 53/66: gnu: Add bluez., Manolis Fragkiskos Ragkousis, 2015/05/21