From 31f148a94a13c7901ab11930c2d28eb7b7637716 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Thu, 17 Nov 2022 22:06:54 +0100
Subject: [PATCH] WIP
guix/extensions/workflow.scm.in | 90 ++++++++++++++++-----------------
1 file changed, 45 insertions(+), 45 deletions(-)
(define-module (guix extensions workflow)
#:use-module (guix scripts)
+ #:use-module (ice-9 format)
#:use-module (ice-9 match)
#:export (guix-workflow))
;; because we need to adjust the guile load paths first. It's okay to
;; import modules from core Guile and (guix scripts) though.
-(define (replace-load-paths!)
- (let ((own-load-path
- (if (getenv "GWL_UNINSTALLED")
- (list "@abs_top_srcdir@"
- "@abs_top_builddir@")
- (list "@guilemoduledir@")))
- (own-load-compiled-path
- (if (getenv "GWL_UNINSTALLED")
- (list "@abs_top_srcdir@"
- "@abs_top_builddir@")
- (list "@guileobjectdir@"))))
- ;; Override load paths
- (set! %load-path
- (append own-load-path
- ;; This is Guile's own pristine load path.
- (list (%library-dir) (%site-dir)
- (%global-site-dir) (%package-data-dir))
- ;; When building in an impure environment this
- ;; variable may contain locations that collide with
- ;; Guile's own load path, so we put it at the very
- ;; end. We add it for all the additional Guile
- ;; packages.
- (parse-path "@GUILE_LOAD_PATH@")))
- (set! %load-compiled-path
- (append own-load-compiled-path
- ;; This is Guile's own pristine load path for
- ;; compiled modules.
- (let ((ccache (%site-ccache-dir)))
- (list (string-append
- (string-drop-right ccache
- (string-length "site-ccache"))
- "ccache")
- ccache))
- ;; When building in an impure environment this
- ;; variable may contain locations that collide with
- ;; Guile's own load path, so we put it at the very
- ;; end. We add it for all the additional Guile
- ;; packages.
- (parse-path "@GUILE_LOAD_COMPILED_PATH@")))))
;;;
;;; Entry point.
(category main) ; TODO: use something else
(synopsis "execute or visualize workflows")
- (replace-load-paths!)
(match (command-line)
((guix workflow . args)
- (setenv "GUILE_LOAD_PATH"
- (string-join %load-path ":"))
- (setenv "GUILE_LOAD_COMPILED_PATH"
- (string-join %load-compiled-path ":"))
(setenv "_GWL_INVOKING_GUIX"
(dirname (dirname guix)))
(apply execl "@GUILE@" "@GUILE@" "-q"
- "-c" "(apply (@ (gwl main) guix-workflow-main) (command-line))"
+ "-c"
+ (format #false "~y"
+ '(begin
+ (define (replace-load-paths!)
+ (let ((own-load-path
+ (if (getenv "GWL_UNINSTALLED")
+ (list "@abs_top_srcdir@"
+ "@abs_top_builddir@")
+ (list "@guilemoduledir@")))
+ (own-load-compiled-path
+ (if (getenv "GWL_UNINSTALLED")
+ (list "@abs_top_srcdir@"
+ "@abs_top_builddir@")
+ (list "@guileobjectdir@"))))
+ ;; Override load paths
+ (set! %load-path
+ (append own-load-path
+ ;; This is a placeholder for Guile's own pristine load path.
+ (list (%library-dir) (%site-dir)
+ (%global-site-dir) (%package-data-dir))
+ ;; When building in an impure environment this
+ ;; variable may contain locations that collide with
+ ;; Guile's own load path, so we put it at the very
+ ;; end. We add it for all the additional Guile
+ ;; packages.
+ (parse-path "@GUILE_LOAD_PATH@")))
+ (set! %load-compiled-path
+ (append own-load-compiled-path
+ ;; This is Guile's own pristine load path for
+ ;; compiled modules.
+ (let ((ccache (%site-ccache-dir)))
+ (list (string-append
+ (string-drop-right ccache
+ (string-length "site-ccache"))
+ "ccache")
+ ccache))
+ ;; When building in an impure environment this
+ ;; variable may contain locations that collide with
+ ;; Guile's own load path, so we put it at the very
+ ;; end. We add it for all the additional Guile
+ ;; packages.
+ (parse-path "@GUILE_LOAD_COMPILED_PATH@")))))
+ (replace-load-paths!)
+ (apply (@ (gwl main) guix-workflow-main) (command-line))))
"--" args))))
--
2.36.1