summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-19 00:52:36 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-19 00:52:36 +0200
commit96783ed6275cd2818ff56916274e6e4582f1dc9b (patch)
tree74b3942b6f4dd258187af1d13c61de67fb930d16 /guix/build
parentc498a07e2d5a0dbe3a68cae02355202095146697 (diff)
syscalls: 'define-as-needed' does not re-export local variables.
Fixes <https://bugs.gnu.org/36723>. Reported by Timothy Sample <samplet@ngyro.com>. * guix/build/syscalls.scm (define-as-needed): Rewrite to use lower-level module primitives; define VARIABLE only if it's not already defined to avoid "re-exporting local variable" error.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/syscalls.scm16
1 files changed, 5 insertions, 11 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 3c84d3893f..f2fdb4d9d1 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -396,17 +396,11 @@ the returned procedure is called."
((_ (proc args ...) body ...)
(define-as-needed proc (lambda* (args ...) body ...)))
((_ variable value)
- (begin
- (when (module-defined? the-scm-module 'variable)
- (re-export variable))
-
- (define variable
- (if (module-defined? the-scm-module 'variable)
- (module-ref the-scm-module 'variable)
- value))
-
- (unless (module-defined? the-scm-module 'variable)
- (export variable))))))
+ (if (module-defined? the-scm-module 'variable)
+ (module-re-export! (current-module) '(variable))
+ (begin
+ (module-define! (current-module) 'variable value)
+ (module-export! (current-module) '(variable)))))))
;;;