aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2017-04-15 13:21:39 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2017-04-15 13:28:25 +0200
commit475e2ce211ac05a814c1f1bc2b9648baa17ad369 (patch)
tree4c33219f82ba2cd1ea93ad8b1ef3ddfc83df536f
parentc2e9942b8fc8918c3e1d9612f99bea06be9ff81d (diff)
downloadpatches-475e2ce211ac05a814c1f1bc2b9648baa17ad369.tar
patches-475e2ce211ac05a814c1f1bc2b9648baa17ad369.tar.gz
scripts: system: Move save-load-path-excursion and save-environment-excursion macros to the top.
* guix/scripts/system.scm (save-load-path-excursion, save-environment-excursion): Move definitions to the top of the file. It allows to use them in the whole file. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
-rw-r--r--guix/scripts/system.scm54
1 files changed, 27 insertions, 27 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 57580c8d5d..a1c6d35909 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -78,6 +78,29 @@
;;; Installation.
;;;
+(define-syntax-rule (save-load-path-excursion body ...)
+ "Save the current values of '%load-path' and '%load-compiled-path', run
+BODY..., and restore them."
+ (let ((path %load-path)
+ (cpath %load-compiled-path))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ body ...)
+ (lambda ()
+ (set! %load-path path)
+ (set! %load-compiled-path cpath)))))
+
+(define-syntax-rule (save-environment-excursion body ...)
+ "Save the current environment variables, run BODY..., and restore them."
+ (let ((env (environ)))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ body ...)
+ (lambda ()
+ (environ env)))))
+
(define topologically-sorted*
(store-lift topologically-sorted))
@@ -202,29 +225,6 @@ the ownership of '~a' may be incorrect!~%")
;; The system profile.
(string-append %state-directory "/profiles/system"))
-(define-syntax-rule (save-environment-excursion body ...)
- "Save the current environment variables, run BODY..., and restore them."
- (let ((env (environ)))
- (dynamic-wind
- (const #t)
- (lambda ()
- body ...)
- (lambda ()
- (environ env)))))
-
-(define-syntax-rule (save-load-path-excursion body ...)
- "Save the current values of '%load-path' and '%load-compiled-path', run
-BODY..., and restore them."
- (let ((path %load-path)
- (cpath %load-compiled-path))
- (dynamic-wind
- (const #t)
- (lambda ()
- body ...)
- (lambda ()
- (set! %load-path path)
- (set! %load-compiled-path cpath)))))
-
(define-syntax-rule (with-shepherd-error-handling mbody ...)
"Catch and report Shepherd errors that arise when binding MBODY, a monadic
expression in %STORE-MONAD."
@@ -622,10 +622,10 @@ output when building a system derivation, such as a disk image."
(operating-system-bootloader os))))
(grub.cfg (if (eq? 'container action)
(return #f)
- (operating-system-grub.cfg os
- (if (eq? 'init action)
- '()
- (profile-grub-entries)))))
+ (operating-system-bootcfg os
+ (if (eq? 'init action)
+ '()
+ (profile-grub-entries)))))
;; For 'init' and 'reconfigure', always build GRUB.CFG, even if
;; --no-grub is passed, because GRUB.CFG because we then use it as a GC