all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#36872] [PATCH 1/2] remote: Build derivations appropriate for the remote's architecture.
@ 2019-07-31 13:41 Jakob L. Kreuze
  2019-07-31 13:43 ` [bug#36872] [PATCH 2/2] remote: Remove '--system' argument Jakob L. Kreuze
  0 siblings, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-07-31 13:41 UTC (permalink / raw)
  To: 36872

[-- Attachment #1: Type: text/plain, Size: 2988 bytes --]

* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
 guix/remote.scm | 13 ++++++++-----
 guix/ssh.scm    |  7 +++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/guix/remote.scm b/guix/remote.scm
index 853029c54f..d5738ebbfa 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -72,7 +72,7 @@ prerequisites of EXP are already available on the host at SESSION."
   "Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
 result to the current output port using the (guix repl) protocol."
   (define program
-    (scheme-file "remote-exp.scm" exp))
+    (program-file "remote-exp.scm" exp))
 
   (with-imported-modules (source-module-closure '((guix repl)))
     #~(begin
@@ -97,10 +97,13 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
 When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
 the remote store afterwards; otherwise, dependencies are built directly on the
 remote store."
-  (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
-                                           #:module-path %load-path))
-                      (remote -> (connect-to-remote-daemon session
-                                                           socket-name)))
+  (mlet* %store-monad ((system -> (remote-system session))
+                       (lowered (lower-gexp (trampoline exp)
+                                            #:system system
+                                            #:guile-for-build #f
+                                            #:module-path %load-path))
+                       (remote -> (connect-to-remote-daemon session
+                                                            socket-name)))
     (define inputs
       (cons (lowered-gexp-guile lowered)
             (lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
             remote-inferior
             remote-daemon-channel
             connect-to-remote-daemon
+            remote-system
             send-files
             retrieve-files
             retrieve-files*
@@ -282,6 +283,12 @@ be read.  When RECURSIVE? is true, the closure of FILES is exported."
                              ,(object->string
                                (object->string export))))))
 
+(define (remote-system session)
+  "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+  (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+                        session))
+
 (define* (send-files local files remote
                      #:key
                      recursive?
-- 
2.22.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-07-31 13:41 [bug#36872] [PATCH 1/2] remote: Build derivations appropriate for the remote's architecture Jakob L. Kreuze
@ 2019-07-31 13:43 ` Jakob L. Kreuze
  2019-08-06 20:57   ` Christopher Lemmer Webber
  0 siblings, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-07-31 13:43 UTC (permalink / raw)
  To: 36872

[-- Attachment #1: Type: text/plain, Size: 5075 bytes --]

* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
 gnu/services.scm        | 56 ++++++++++++++++++++---------------------
 guix/scripts/deploy.scm |  8 ++----
 2 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
 (define (activation-script gexps)
   "Return the system's activation script, which evaluates GEXPS."
   (define actions
-    (map (cut scheme-file "activate-service" <>) gexps))
-
-  (scheme-file "activate"
-               (with-imported-modules (source-module-closure
-                                       '((gnu build activation)
-                                         (guix build utils)))
-                 #~(begin
-                     (use-modules (gnu build activation)
-                                  (guix build utils))
-
-                     ;; Make sure the user accounting database exists.  If it
-                     ;; does not exist, 'setutxent' does not create it and
-                     ;; thus there is no accounting at all.
-                     (close-port (open-file "/var/run/utmpx" "a0"))
-
-                     ;; Same for 'wtmp', which is populated by mingetty et
-                     ;; al.
-                     (mkdir-p "/var/log")
-                     (close-port (open-file "/var/log/wtmp" "a0"))
-
-                     ;; Set up /run/current-system.  Among other things this
-                     ;; sets up locales, which the activation snippets
-                     ;; executed below may expect.
-                     (activate-current-system)
-
-                     ;; Run the services' activation snippets.
-                     ;; TODO: Use 'load-compiled'.
-                     (for-each primitive-load '#$actions)))))
+    (map (cut program-file "activate-service.scm" <>) gexps))
+
+  (program-file "activate.scm"
+                (with-imported-modules (source-module-closure
+                                        '((gnu build activation)
+                                          (guix build utils)))
+                  #~(begin
+                      (use-modules (gnu build activation)
+                                   (guix build utils))
+
+                      ;; Make sure the user accounting database exists.  If it
+                      ;; does not exist, 'setutxent' does not create it and
+                      ;; thus there is no accounting at all.
+                      (close-port (open-file "/var/run/utmpx" "a0"))
+
+                      ;; Same for 'wtmp', which is populated by mingetty et
+                      ;; al.
+                      (mkdir-p "/var/log")
+                      (close-port (open-file "/var/log/wtmp" "a0"))
+
+                      ;; Set up /run/current-system.  Among other things this
+                      ;; sets up locales, which the activation snippets
+                      ;; executed below may expect.
+                      (activate-current-system)
+
+                      ;; Run the services' activation snippets.
+                      ;; TODO: Use 'load-compiled'.
+                      (for-each primitive-load '#$actions)))))
 
 (define (gexps->activation-gexp gexps)
   "Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 8eeb9ae7a1..bc1d93a93a 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -44,8 +44,6 @@
 (define (show-help)
   (display (G_ "Usage: guix deploy [OPTION] FILE...
 Perform the deployment specified by FILE.\n"))
-  (display (G_ "
-  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
   (show-build-options-help)
   (newline)
   (display (G_ "
@@ -67,8 +65,7 @@ Perform the deployment specified by FILE.\n"))
          %standard-build-options))
 
 (define %default-options
-  `((system . ,(%current-system))
-    (substitutes? . #t)
+  `((substitutes? . #t)
     (build-hook? . #t)
     (graft? . #t)
     (debug . 0)
@@ -91,8 +88,7 @@ Perform the deployment specified by FILE.\n"))
       (for-each (lambda (machine)
                   (info (G_ "deploying to ~a...~%")
                         (machine-display-name machine))
-                  (parameterize ((%current-system (assq-ref opts 'system))
-                                 (%graft? (assq-ref opts 'graft?)))
+                  (parameterize ((%graft? (assq-ref opts 'graft?)))
                     (guard (c ((message-condition? c)
                                (report-error (G_ "failed to deploy ~a: '~a'~%")
                                              (machine-display-name machine)
-- 
2.22.0



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-07-31 13:43 ` [bug#36872] [PATCH 2/2] remote: Remove '--system' argument Jakob L. Kreuze
@ 2019-08-06 20:57   ` Christopher Lemmer Webber
  2019-08-06 20:58     ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
  2019-08-06 21:29     ` [bug#36872] [PATCH " Jakob L. Kreuze
  0 siblings, 2 replies; 13+ messages in thread
From: Christopher Lemmer Webber @ 2019-08-06 20:57 UTC (permalink / raw)
  To: 36872

I'm still wondering whether asking the remote machine what its
architecture is won't turn out to be fragile in some way, though I'm not
sure how to articulate how that would be yet.  It seems like a weird
side effect to apply before doing the build.  (What if we want to build
derivations when we don't actually have a machine up and running yet?
Etc, etc.)

But you and Dave seem to think it's the right thing to do, so I'm going
to assume that you both know what to do better than I do at this point.

At any rate, the patch looks fine; once it's rebased on top of master
I'm ok with pushing it if there are no objections.

Jakob L. Kreuze writes:

> * gnu/services.scm (activation-script): Return a <program-file> rather
> than a <scheme-file>.
> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
> (show-help): Remove documentation for '--system'.
> (%default-options): Remove default setting for 'system'.
> ---
>  gnu/services.scm        | 56 ++++++++++++++++++++---------------------
>  guix/scripts/deploy.scm |  8 ++----
>  2 files changed, 30 insertions(+), 34 deletions(-)
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 7de78105ff..6ee05d4580 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
>  (define (activation-script gexps)
>    "Return the system's activation script, which evaluates GEXPS."
>    (define actions
> -    (map (cut scheme-file "activate-service" <>) gexps))
> -
> -  (scheme-file "activate"
> -               (with-imported-modules (source-module-closure
> -                                       '((gnu build activation)
> -                                         (guix build utils)))
> -                 #~(begin
> -                     (use-modules (gnu build activation)
> -                                  (guix build utils))
> -
> -                     ;; Make sure the user accounting database exists.  If it
> -                     ;; does not exist, 'setutxent' does not create it and
> -                     ;; thus there is no accounting at all.
> -                     (close-port (open-file "/var/run/utmpx" "a0"))
> -
> -                     ;; Same for 'wtmp', which is populated by mingetty et
> -                     ;; al.
> -                     (mkdir-p "/var/log")
> -                     (close-port (open-file "/var/log/wtmp" "a0"))
> -
> -                     ;; Set up /run/current-system.  Among other things this
> -                     ;; sets up locales, which the activation snippets
> -                     ;; executed below may expect.
> -                     (activate-current-system)
> -
> -                     ;; Run the services' activation snippets.
> -                     ;; TODO: Use 'load-compiled'.
> -                     (for-each primitive-load '#$actions)))))
> +    (map (cut program-file "activate-service.scm" <>) gexps))
> +
> +  (program-file "activate.scm"
> +                (with-imported-modules (source-module-closure
> +                                        '((gnu build activation)
> +                                          (guix build utils)))
> +                  #~(begin
> +                      (use-modules (gnu build activation)
> +                                   (guix build utils))
> +
> +                      ;; Make sure the user accounting database exists.  If it
> +                      ;; does not exist, 'setutxent' does not create it and
> +                      ;; thus there is no accounting at all.
> +                      (close-port (open-file "/var/run/utmpx" "a0"))
> +
> +                      ;; Same for 'wtmp', which is populated by mingetty et
> +                      ;; al.
> +                      (mkdir-p "/var/log")
> +                      (close-port (open-file "/var/log/wtmp" "a0"))
> +
> +                      ;; Set up /run/current-system.  Among other things this
> +                      ;; sets up locales, which the activation snippets
> +                      ;; executed below may expect.
> +                      (activate-current-system)
> +
> +                      ;; Run the services' activation snippets.
> +                      ;; TODO: Use 'load-compiled'.
> +                      (for-each primitive-load '#$actions)))))
>  
>  (define (gexps->activation-gexp gexps)
>    "Return a gexp that runs the activation script containing GEXPS."
> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
> index 8eeb9ae7a1..bc1d93a93a 100644
> --- a/guix/scripts/deploy.scm
> +++ b/guix/scripts/deploy.scm
> @@ -44,8 +44,6 @@
>  (define (show-help)
>    (display (G_ "Usage: guix deploy [OPTION] FILE...
>  Perform the deployment specified by FILE.\n"))
> -  (display (G_ "
> -  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
>    (show-build-options-help)
>    (newline)
>    (display (G_ "
> @@ -67,8 +65,7 @@ Perform the deployment specified by FILE.\n"))
>           %standard-build-options))
>  
>  (define %default-options
> -  `((system . ,(%current-system))
> -    (substitutes? . #t)
> +  `((substitutes? . #t)
>      (build-hook? . #t)
>      (graft? . #t)
>      (debug . 0)
> @@ -91,8 +88,7 @@ Perform the deployment specified by FILE.\n"))
>        (for-each (lambda (machine)
>                    (info (G_ "deploying to ~a...~%")
>                          (machine-display-name machine))
> -                  (parameterize ((%current-system (assq-ref opts 'system))
> -                                 (%graft? (assq-ref opts 'graft?)))
> +                  (parameterize ((%graft? (assq-ref opts 'graft?)))
>                      (guard (c ((message-condition? c)
>                                 (report-error (G_ "failed to deploy ~a: '~a'~%")
>                                               (machine-display-name machine)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's
  2019-08-06 20:57   ` Christopher Lemmer Webber
@ 2019-08-06 20:58     ` Jakob L. Kreuze
  2019-08-06 20:59       ` [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument Jakob L. Kreuze
  2019-08-06 21:29     ` [bug#36872] [PATCH " Jakob L. Kreuze
  1 sibling, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-06 20:58 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: 36872

* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
 guix/remote.scm | 13 ++++++++-----
 guix/ssh.scm    |  7 +++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/guix/remote.scm b/guix/remote.scm
index 5fecd954e9..0a0bdaf30b 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -71,7 +71,7 @@ prerequisites of EXP are already available on the host at SESSION."
   "Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
 result to the current output port using the (guix repl) protocol."
   (define program
-    (scheme-file "remote-exp.scm" exp))
+    (program-file "remote-exp.scm" exp))
 
   (with-imported-modules (source-module-closure '((guix repl)))
     #~(begin
@@ -96,10 +96,13 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
 When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
 the remote store afterwards; otherwise, dependencies are built directly on the
 remote store."
-  (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
-                                           #:module-path %load-path))
-                      (remote -> (connect-to-remote-daemon session
-                                                           socket-name)))
+  (mlet* %store-monad ((system -> (remote-system session))
+                       (lowered (lower-gexp (trampoline exp)
+                                            #:system system
+                                            #:guile-for-build #f
+                                            #:module-path %load-path))
+                       (remote -> (connect-to-remote-daemon session
+                                                            socket-name)))
     (define inputs
       (cons (lowered-gexp-guile lowered)
             (lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
             remote-inferior
             remote-daemon-channel
             connect-to-remote-daemon
+            remote-system
             send-files
             retrieve-files
             retrieve-files*
@@ -282,6 +283,12 @@ be read.  When RECURSIVE? is true, the closure of FILES is exported."
                              ,(object->string
                                (object->string export))))))
 
+(define (remote-system session)
+  "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+  (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+                        session))
+
 (define* (send-files local files remote
                      #:key
                      recursive?
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument.
  2019-08-06 20:58     ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
@ 2019-08-06 20:59       ` Jakob L. Kreuze
  0 siblings, 0 replies; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-06 20:59 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: 36872

* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
 gnu/services.scm        | 56 ++++++++++++++++++++---------------------
 guix/scripts/deploy.scm |  8 ++----
 2 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
 (define (activation-script gexps)
   "Return the system's activation script, which evaluates GEXPS."
   (define actions
-    (map (cut scheme-file "activate-service" <>) gexps))
-
-  (scheme-file "activate"
-               (with-imported-modules (source-module-closure
-                                       '((gnu build activation)
-                                         (guix build utils)))
-                 #~(begin
-                     (use-modules (gnu build activation)
-                                  (guix build utils))
-
-                     ;; Make sure the user accounting database exists.  If it
-                     ;; does not exist, 'setutxent' does not create it and
-                     ;; thus there is no accounting at all.
-                     (close-port (open-file "/var/run/utmpx" "a0"))
-
-                     ;; Same for 'wtmp', which is populated by mingetty et
-                     ;; al.
-                     (mkdir-p "/var/log")
-                     (close-port (open-file "/var/log/wtmp" "a0"))
-
-                     ;; Set up /run/current-system.  Among other things this
-                     ;; sets up locales, which the activation snippets
-                     ;; executed below may expect.
-                     (activate-current-system)
-
-                     ;; Run the services' activation snippets.
-                     ;; TODO: Use 'load-compiled'.
-                     (for-each primitive-load '#$actions)))))
+    (map (cut program-file "activate-service.scm" <>) gexps))
+
+  (program-file "activate.scm"
+                (with-imported-modules (source-module-closure
+                                        '((gnu build activation)
+                                          (guix build utils)))
+                  #~(begin
+                      (use-modules (gnu build activation)
+                                   (guix build utils))
+
+                      ;; Make sure the user accounting database exists.  If it
+                      ;; does not exist, 'setutxent' does not create it and
+                      ;; thus there is no accounting at all.
+                      (close-port (open-file "/var/run/utmpx" "a0"))
+
+                      ;; Same for 'wtmp', which is populated by mingetty et
+                      ;; al.
+                      (mkdir-p "/var/log")
+                      (close-port (open-file "/var/log/wtmp" "a0"))
+
+                      ;; Set up /run/current-system.  Among other things this
+                      ;; sets up locales, which the activation snippets
+                      ;; executed below may expect.
+                      (activate-current-system)
+
+                      ;; Run the services' activation snippets.
+                      ;; TODO: Use 'load-compiled'.
+                      (for-each primitive-load '#$actions)))))
 
 (define (gexps->activation-gexp gexps)
   "Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 52bba3f3bf..52d5e1e1da 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -42,8 +42,6 @@
 (define (show-help)
   (display (G_ "Usage: guix deploy [OPTION] FILE...
 Perform the deployment specified by FILE.\n"))
-  (display (G_ "
-  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
   (show-build-options-help)
   (newline)
   (display (G_ "
@@ -65,8 +63,7 @@ Perform the deployment specified by FILE.\n"))
          %standard-build-options))
 
 (define %default-options
-  `((system . ,(%current-system))
-    (substitutes? . #t)
+  `((substitutes? . #t)
     (build-hook? . #t)
     (graft? . #t)
     (debug . 0)
@@ -88,7 +85,6 @@ Perform the deployment specified by FILE.\n"))
       (set-build-options-from-command-line store opts)
       (for-each (lambda (machine)
                   (info (G_ "deploying to ~a...") (machine-display-name machine))
-                  (parameterize ((%current-system (assq-ref opts 'system))
-                                 (%graft? (assq-ref opts 'graft?)))
+                  (parameterize ((%graft? (assq-ref opts 'graft?)))
                     (run-with-store store (deploy-machine machine))))
                 machines))))
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-08-06 20:57   ` Christopher Lemmer Webber
  2019-08-06 20:58     ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
@ 2019-08-06 21:29     ` Jakob L. Kreuze
  2019-08-07 18:31       ` Christopher Lemmer Webber
  1 sibling, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-06 21:29 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: 36872

Hey Chris!

Christopher Lemmer Webber <cwebber@dustycloud.org> writes:

> I'm still wondering whether asking the remote machine what its
> architecture is won't turn out to be fragile in some way, though I'm not
> sure how to articulate how that would be yet.  It seems like a weird
> side effect to apply before doing the build.  (What if we want to build
> derivations when we don't actually have a machine up and running yet?
> Etc, etc.)

I agree that it isn't the purest solution, but my thinking is that
'remote-eval' is meant to be effectful anyway. As for the situation
where we build derivations for a machine that isn't running yet: I think
we can cross that bridge when we get to it -- 'guix deploy' doesn't have
the feature at the moment.

Regards,
Jakob

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-08-06 21:29     ` [bug#36872] [PATCH " Jakob L. Kreuze
@ 2019-08-07 18:31       ` Christopher Lemmer Webber
  2019-08-07 19:03         ` Thompson, David
  0 siblings, 1 reply; 13+ messages in thread
From: Christopher Lemmer Webber @ 2019-08-07 18:31 UTC (permalink / raw)
  To: Jakob L. Kreuze, David Thompson; +Cc: 36872

Jakob L. Kreuze writes:

> Hey Chris!
>
> Christopher Lemmer Webber <cwebber@dustycloud.org> writes:
>
>> I'm still wondering whether asking the remote machine what its
>> architecture is won't turn out to be fragile in some way, though I'm not
>> sure how to articulate how that would be yet.  It seems like a weird
>> side effect to apply before doing the build.  (What if we want to build
>> derivations when we don't actually have a machine up and running yet?
>> Etc, etc.)
>
> I agree that it isn't the purest solution, but my thinking is that
> 'remote-eval' is meant to be effectful anyway. As for the situation
> where we build derivations for a machine that isn't running yet: I think
> we can cross that bridge when we get to it -- 'guix deploy' doesn't have
> the feature at the moment.
>
> Regards,
> Jakob

I thought about it more between yesterday and today, and it continues to
seem strange to me that we're doing "probing" here.  We don't probe to
guess where Guix is currently installed or etc to specify disks.  I
guess that's not the same thing, but...

Here's the concern: imagine that we want to be able to up-front do
something like "guix system build" before we even start spinning up
servers.  Does this block that direction?

Dave, your input appreciated on this one.

I'm not sure I want to block the patch series with my hand wringing, but
I do want to make sure we give it appropriate consideration.

 - Chris

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-08-07 18:31       ` Christopher Lemmer Webber
@ 2019-08-07 19:03         ` Thompson, David
  2019-08-07 20:28           ` Jakob L. Kreuze
  0 siblings, 1 reply; 13+ messages in thread
From: Thompson, David @ 2019-08-07 19:03 UTC (permalink / raw)
  To: Christopher Lemmer Webber; +Cc: 36872

Hi,

On Wed, Aug 7, 2019 at 2:31 PM Christopher Lemmer Webber
<cwebber@dustycloud.org> wrote:
>
> I thought about it more between yesterday and today, and it continues to
> seem strange to me that we're doing "probing" here.  We don't probe to
> guess where Guix is currently installed or etc to specify disks.  I
> guess that's not the same thing, but...
>
> Here's the concern: imagine that we want to be able to up-front do
> something like "guix system build" before we even start spinning up
> servers.  Does this block that direction?

This is a good point.  We want to make sure that the config file
*completely* describes the operating systems that need to be built,
therefore having to talk to a remote machine is no bueno.  The reason
I didn't want the user to have to explicitly specify the remote
system's architecture is for usability.  I wanted 'guix deploy' to
just DTRT like guix already does when you run `guix system
reconfigure` or `guix build` locally where %current-system defaults to
what the local machine is running.  However, I think that providing
this information would only be a small inconvenience for the current
managed host environment type. This wouldn't be an issue at all for an
AWS environment type, for example, because the user would have to
specify which instance type they want and with that you know what the
value of %current-system should be when generating the OS derivation.
I imagine this would be the case for any cloud environment.

I think I've said this before (not sure if IRL or in an email) that we
should make it the responsibility of the environment type to determine
what the remote machine's system is.  I still think that should be the
case, but we should change the managed host type so that the user
specifies that information as a new record field rather than making
'guix deploy' probe for it.

Does this make sense?

- Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
  2019-08-07 19:03         ` Thompson, David
@ 2019-08-07 20:28           ` Jakob L. Kreuze
  2019-08-09 18:24             ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
  0 siblings, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-07 20:28 UTC (permalink / raw)
  To: Thompson, David; +Cc: 36872

[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]

Hi Chris and Dave,

"Thompson, David" <dthompson2@worcester.edu> writes:

> Hi,
>
> On Wed, Aug 7, 2019 at 2:31 PM Christopher Lemmer Webber
> <cwebber@dustycloud.org> wrote:
>>
>> I thought about it more between yesterday and today, and it continues to
>> seem strange to me that we're doing "probing" here.  We don't probe to
>> guess where Guix is currently installed or etc to specify disks.  I
>> guess that's not the same thing, but...
>>
>> Here's the concern: imagine that we want to be able to up-front do
>> something like "guix system build" before we even start spinning up
>> servers.  Does this block that direction?
>
> This is a good point.  We want to make sure that the config file
> *completely* describes the operating systems that need to be built,
> therefore having to talk to a remote machine is no bueno.  The reason
> I didn't want the user to have to explicitly specify the remote
> system's architecture is for usability.  I wanted 'guix deploy' to
> just DTRT like guix already does when you run `guix system
> reconfigure` or `guix build` locally where %current-system defaults to
> what the local machine is running.  However, I think that providing
> this information would only be a small inconvenience for the current
> managed host environment type. This wouldn't be an issue at all for an
> AWS environment type, for example, because the user would have to
> specify which instance type they want and with that you know what the
> value of %current-system should be when generating the OS derivation.
> I imagine this would be the case for any cloud environment.
>
> I think I've said this before (not sure if IRL or in an email) that we
> should make it the responsibility of the environment type to determine
> what the remote machine's system is.  I still think that should be the
> case, but we should change the managed host type so that the user
> specifies that information as a new record field rather than making
> 'guix deploy' probe for it.
>
> Does this make sense?

Right. My gut feels a bit conflicted since 'remote-eval' is already
talking to the remote, but the points about building ahead of time and
having the configuration file completely specify the deployment are
strong -- perhaps the better thing to do is to add a 'system' keyword to
'remote-eval'. I'll redo this patch as a 'system' field for the
'managed-host-environment-type' configuration.

Regards,
Jakob

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's
  2019-08-07 20:28           ` Jakob L. Kreuze
@ 2019-08-09 18:24             ` Jakob L. Kreuze
  2019-08-09 18:25               ` [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument Jakob L. Kreuze
  0 siblings, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-09 18:24 UTC (permalink / raw)
  To: Thompson, David; +Cc: 36872

[-- Attachment #1: Type: text/plain, Size: 7667 bytes --]

* gnu/machine/ssh.scm (machine-ssh-configuration): Add 'system' field.
(managed-host-remote-eval): Pass 'system' field to 'remote-eval'.
(machine-check-building-for-appropriate-system): New variable.
(check-deployment-sanity): Add call to
'machine-check-building-for-appropriate-system'.
* doc/guix.texi (Invoking guix deploy): Describe new 'system' field.
* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(remote-eval): Add 'system' keyword argument.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
 doc/guix.texi       |  3 +++
 gnu/machine/ssh.scm | 31 +++++++++++++++++++++++++++----
 guix/remote.scm     | 14 +++++++++-----
 guix/ssh.scm        |  7 +++++++
 4 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 734206a4b2..a7facf4701 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -25573,6 +25573,9 @@ with an @code{environment} of @code{managed-host-environment-type}.
 
 @table @asis
 @item @code{host-name}
+@item @code{system}
+The Nix system type describing the architecture of the machine being deployed
+to. This should look something like ``x86_64-linux''.
 @item @code{port} (default: @code{22})
 @item @code{user} (default: @code{"root"})
 @item @code{identity} (default: @code{#f})
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index ba3e33c922..670990a633 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -36,6 +36,7 @@
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
   #:export (managed-host-environment-type
 
@@ -68,6 +69,7 @@
   machine-ssh-configuration?
   this-machine-ssh-configuration
   (host-name      machine-ssh-configuration-host-name) ; string
+  (system         machine-ssh-configuration-system)    ; string
   (build-locally? machine-ssh-configuration-build-locally?
                   (default #t))
   (port           machine-ssh-configuration-port       ; integer
@@ -103,10 +105,12 @@ one from the configuration's parameters if one was not provided."
   "Internal implementation of 'machine-remote-eval' for MACHINE instances with
 an environment type of 'managed-host."
   (maybe-raise-unsupported-configuration-error machine)
-  (remote-eval exp (machine-ssh-session machine)
-               #:build-locally?
-               (machine-ssh-configuration-build-locally?
-                (machine-configuration machine))))
+  (let ((config (machine-configuration machine)))
+    (remote-eval exp (machine-ssh-session machine)
+                 #:build-locally?
+                 (machine-ssh-configuration-build-locally? config)
+                 #:system
+                 (machine-ssh-configuration-system config))))
 
 \f
 ;;;
@@ -240,10 +244,29 @@ MACHINE's 'system' declaration do not exist on the machine."
               device)
     (return #t)))
 
+(define (machine-check-building-for-appropriate-system machine)
+  "Raise a '&message' error condition if MACHINE is configured to be built
+locally and the 'system' field does not match the '%current-system' reported
+by MACHINE."
+  (let ((config (machine-configuration machine))
+        (system (remote-system (machine-ssh-session machine))))
+    (when (and (machine-ssh-configuration-build-locally? config)
+               (not (string= system (machine-ssh-configuration-system config))))
+      (raise (condition
+              (&message
+               (message (format #f (G_ "incorrect target system \
+('~a' was given, while the system reports that it is '~a')~%")
+                                (machine-ssh-configuration-system config)
+                                system)))))))
+  (with-monad %store-monad (return #t)))
+
 (define (check-deployment-sanity machine)
   "Raise a '&message' error condition if it is clear that deploying MACHINE's
 'system' declaration would fail."
+  ;; Order is important here -- an incorrect value for 'system' will cause
+  ;; invocations of 'remote-eval' to fail.
   (mbegin %store-monad
+    (machine-check-building-for-appropriate-system machine)
     (machine-check-file-system-availability machine)
     (machine-check-initrd-modules machine)))
 
diff --git a/guix/remote.scm b/guix/remote.scm
index 5fecd954e9..bcac64ea7a 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -24,6 +24,7 @@
   #:use-module (guix monads)
   #:use-module (guix modules)
   #:use-module (guix derivations)
+  #:use-module (guix utils)
   #:use-module (ssh popen)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
@@ -71,7 +72,7 @@ prerequisites of EXP are already available on the host at SESSION."
   "Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
 result to the current output port using the (guix repl) protocol."
   (define program
-    (scheme-file "remote-exp.scm" exp))
+    (program-file "remote-exp.scm" exp))
 
   (with-imported-modules (source-module-closure '((guix repl)))
     #~(begin
@@ -89,6 +90,7 @@ result to the current output port using the (guix repl) protocol."
 (define* (remote-eval exp session
                       #:key
                       (build-locally? #t)
+                      (system (%current-system))
                       (module-path %load-path)
                       (socket-name "/var/guix/daemon-socket/socket"))
   "Evaluate EXP, a gexp, on the host at SESSION, an SSH session.  Ensure that
@@ -96,10 +98,12 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
 When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
 the remote store afterwards; otherwise, dependencies are built directly on the
 remote store."
-  (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
-                                           #:module-path %load-path))
-                      (remote -> (connect-to-remote-daemon session
-                                                           socket-name)))
+  (mlet* %store-monad ((lowered (lower-gexp (trampoline exp)
+                                            #:system system
+                                            #:guile-for-build #f
+                                            #:module-path %load-path))
+                       (remote -> (connect-to-remote-daemon session
+                                                            socket-name)))
     (define inputs
       (cons (lowered-gexp-guile lowered)
             (lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
             remote-inferior
             remote-daemon-channel
             connect-to-remote-daemon
+            remote-system
             send-files
             retrieve-files
             retrieve-files*
@@ -282,6 +283,12 @@ be read.  When RECURSIVE? is true, the closure of FILES is exported."
                              ,(object->string
                                (object->string export))))))
 
+(define (remote-system session)
+  "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+  (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+                        session))
+
 (define* (send-files local files remote
                      #:key
                      recursive?
-- 
2.22.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument.
  2019-08-09 18:24             ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
@ 2019-08-09 18:25               ` Jakob L. Kreuze
  2019-08-14 19:40                 ` Christopher Lemmer Webber
  0 siblings, 1 reply; 13+ messages in thread
From: Jakob L. Kreuze @ 2019-08-09 18:25 UTC (permalink / raw)
  To: Thompson, David; +Cc: 36872

[-- Attachment #1: Type: text/plain, Size: 4989 bytes --]

* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
 gnu/services.scm        | 56 ++++++++++++++++++++---------------------
 guix/scripts/deploy.scm |  8 ++----
 2 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
 (define (activation-script gexps)
   "Return the system's activation script, which evaluates GEXPS."
   (define actions
-    (map (cut scheme-file "activate-service" <>) gexps))
-
-  (scheme-file "activate"
-               (with-imported-modules (source-module-closure
-                                       '((gnu build activation)
-                                         (guix build utils)))
-                 #~(begin
-                     (use-modules (gnu build activation)
-                                  (guix build utils))
-
-                     ;; Make sure the user accounting database exists.  If it
-                     ;; does not exist, 'setutxent' does not create it and
-                     ;; thus there is no accounting at all.
-                     (close-port (open-file "/var/run/utmpx" "a0"))
-
-                     ;; Same for 'wtmp', which is populated by mingetty et
-                     ;; al.
-                     (mkdir-p "/var/log")
-                     (close-port (open-file "/var/log/wtmp" "a0"))
-
-                     ;; Set up /run/current-system.  Among other things this
-                     ;; sets up locales, which the activation snippets
-                     ;; executed below may expect.
-                     (activate-current-system)
-
-                     ;; Run the services' activation snippets.
-                     ;; TODO: Use 'load-compiled'.
-                     (for-each primitive-load '#$actions)))))
+    (map (cut program-file "activate-service.scm" <>) gexps))
+
+  (program-file "activate.scm"
+                (with-imported-modules (source-module-closure
+                                        '((gnu build activation)
+                                          (guix build utils)))
+                  #~(begin
+                      (use-modules (gnu build activation)
+                                   (guix build utils))
+
+                      ;; Make sure the user accounting database exists.  If it
+                      ;; does not exist, 'setutxent' does not create it and
+                      ;; thus there is no accounting at all.
+                      (close-port (open-file "/var/run/utmpx" "a0"))
+
+                      ;; Same for 'wtmp', which is populated by mingetty et
+                      ;; al.
+                      (mkdir-p "/var/log")
+                      (close-port (open-file "/var/log/wtmp" "a0"))
+
+                      ;; Set up /run/current-system.  Among other things this
+                      ;; sets up locales, which the activation snippets
+                      ;; executed below may expect.
+                      (activate-current-system)
+
+                      ;; Run the services' activation snippets.
+                      ;; TODO: Use 'load-compiled'.
+                      (for-each primitive-load '#$actions)))))
 
 (define (gexps->activation-gexp gexps)
   "Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index ebc99e52cc..81f2b33260 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -43,8 +43,6 @@
 (define (show-help)
   (display (G_ "Usage: guix deploy [OPTION] FILE...
 Perform the deployment specified by FILE.\n"))
-  (display (G_ "
-  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
   (show-build-options-help)
   (newline)
   (display (G_ "
@@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
          %standard-build-options))
 
 (define %default-options
-  `((system . ,(%current-system))
-    (substitutes? . #t)
+  `((substitutes? . #t)
     (build-hook? . #t)
     (graft? . #t)
     (debug . 0)
@@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
       (set-build-options-from-command-line store opts)
       (for-each (lambda (machine)
                   (info (G_ "deploying to ~a...") (machine-display-name machine))
-                  (parameterize ((%current-system (assq-ref opts 'system))
-                                 (%graft? (assq-ref opts 'graft?)))
+                  (parameterize ((%graft? (assq-ref opts 'graft?)))
                     (run-with-store store (deploy-machine machine))))
                 machines))))
-- 
2.22.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument.
  2019-08-09 18:25               ` [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument Jakob L. Kreuze
@ 2019-08-14 19:40                 ` Christopher Lemmer Webber
  2019-08-14 20:29                   ` bug#36872: " Christopher Lemmer Webber
  0 siblings, 1 reply; 13+ messages in thread
From: Christopher Lemmer Webber @ 2019-08-14 19:40 UTC (permalink / raw)
  To: Jakob L. Kreuze; +Cc: 36872

Looks good.  Merged & pushed!

Jakob L. Kreuze writes:

> * gnu/services.scm (activation-script): Return a <program-file> rather
> than a <scheme-file>.
> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
> (show-help): Remove documentation for '--system'.
> (%default-options): Remove default setting for 'system'.
> ---
>  gnu/services.scm        | 56 ++++++++++++++++++++---------------------
>  guix/scripts/deploy.scm |  8 ++----
>  2 files changed, 30 insertions(+), 34 deletions(-)
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 7de78105ff..6ee05d4580 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
>  (define (activation-script gexps)
>    "Return the system's activation script, which evaluates GEXPS."
>    (define actions
> -    (map (cut scheme-file "activate-service" <>) gexps))
> -
> -  (scheme-file "activate"
> -               (with-imported-modules (source-module-closure
> -                                       '((gnu build activation)
> -                                         (guix build utils)))
> -                 #~(begin
> -                     (use-modules (gnu build activation)
> -                                  (guix build utils))
> -
> -                     ;; Make sure the user accounting database exists.  If it
> -                     ;; does not exist, 'setutxent' does not create it and
> -                     ;; thus there is no accounting at all.
> -                     (close-port (open-file "/var/run/utmpx" "a0"))
> -
> -                     ;; Same for 'wtmp', which is populated by mingetty et
> -                     ;; al.
> -                     (mkdir-p "/var/log")
> -                     (close-port (open-file "/var/log/wtmp" "a0"))
> -
> -                     ;; Set up /run/current-system.  Among other things this
> -                     ;; sets up locales, which the activation snippets
> -                     ;; executed below may expect.
> -                     (activate-current-system)
> -
> -                     ;; Run the services' activation snippets.
> -                     ;; TODO: Use 'load-compiled'.
> -                     (for-each primitive-load '#$actions)))))
> +    (map (cut program-file "activate-service.scm" <>) gexps))
> +
> +  (program-file "activate.scm"
> +                (with-imported-modules (source-module-closure
> +                                        '((gnu build activation)
> +                                          (guix build utils)))
> +                  #~(begin
> +                      (use-modules (gnu build activation)
> +                                   (guix build utils))
> +
> +                      ;; Make sure the user accounting database exists.  If it
> +                      ;; does not exist, 'setutxent' does not create it and
> +                      ;; thus there is no accounting at all.
> +                      (close-port (open-file "/var/run/utmpx" "a0"))
> +
> +                      ;; Same for 'wtmp', which is populated by mingetty et
> +                      ;; al.
> +                      (mkdir-p "/var/log")
> +                      (close-port (open-file "/var/log/wtmp" "a0"))
> +
> +                      ;; Set up /run/current-system.  Among other things this
> +                      ;; sets up locales, which the activation snippets
> +                      ;; executed below may expect.
> +                      (activate-current-system)
> +
> +                      ;; Run the services' activation snippets.
> +                      ;; TODO: Use 'load-compiled'.
> +                      (for-each primitive-load '#$actions)))))
>  
>  (define (gexps->activation-gexp gexps)
>    "Return a gexp that runs the activation script containing GEXPS."
> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
> index ebc99e52cc..81f2b33260 100644
> --- a/guix/scripts/deploy.scm
> +++ b/guix/scripts/deploy.scm
> @@ -43,8 +43,6 @@
>  (define (show-help)
>    (display (G_ "Usage: guix deploy [OPTION] FILE...
>  Perform the deployment specified by FILE.\n"))
> -  (display (G_ "
> -  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
>    (show-build-options-help)
>    (newline)
>    (display (G_ "
> @@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
>           %standard-build-options))
>  
>  (define %default-options
> -  `((system . ,(%current-system))
> -    (substitutes? . #t)
> +  `((substitutes? . #t)
>      (build-hook? . #t)
>      (graft? . #t)
>      (debug . 0)
> @@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
>        (set-build-options-from-command-line store opts)
>        (for-each (lambda (machine)
>                    (info (G_ "deploying to ~a...") (machine-display-name machine))
> -                  (parameterize ((%current-system (assq-ref opts 'system))
> -                                 (%graft? (assq-ref opts 'graft?)))
> +                  (parameterize ((%graft? (assq-ref opts 'graft?)))
>                      (run-with-store store (deploy-machine machine))))
>                  machines))))

^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#36872: [PATCH v2 2/2] remote: Remove '--system' argument.
  2019-08-14 19:40                 ` Christopher Lemmer Webber
@ 2019-08-14 20:29                   ` Christopher Lemmer Webber
  0 siblings, 0 replies; 13+ messages in thread
From: Christopher Lemmer Webber @ 2019-08-14 20:29 UTC (permalink / raw)
  To: Jakob L. Kreuze; +Cc: 36872-done

Forgot to signal -done :)

Christopher Lemmer Webber writes:

> Looks good.  Merged & pushed!
>
> Jakob L. Kreuze writes:
>
>> * gnu/services.scm (activation-script): Return a <program-file> rather
>> than a <scheme-file>.
>> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
>> (show-help): Remove documentation for '--system'.
>> (%default-options): Remove default setting for 'system'.
>> ---
>>  gnu/services.scm        | 56 ++++++++++++++++++++---------------------
>>  guix/scripts/deploy.scm |  8 ++----
>>  2 files changed, 30 insertions(+), 34 deletions(-)
>>
>> diff --git a/gnu/services.scm b/gnu/services.scm
>> index 7de78105ff..6ee05d4580 100644
>> --- a/gnu/services.scm
>> +++ b/gnu/services.scm
>> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
>>  (define (activation-script gexps)
>>    "Return the system's activation script, which evaluates GEXPS."
>>    (define actions
>> -    (map (cut scheme-file "activate-service" <>) gexps))
>> -
>> -  (scheme-file "activate"
>> -               (with-imported-modules (source-module-closure
>> -                                       '((gnu build activation)
>> -                                         (guix build utils)))
>> -                 #~(begin
>> -                     (use-modules (gnu build activation)
>> -                                  (guix build utils))
>> -
>> -                     ;; Make sure the user accounting database exists.  If it
>> -                     ;; does not exist, 'setutxent' does not create it and
>> -                     ;; thus there is no accounting at all.
>> -                     (close-port (open-file "/var/run/utmpx" "a0"))
>> -
>> -                     ;; Same for 'wtmp', which is populated by mingetty et
>> -                     ;; al.
>> -                     (mkdir-p "/var/log")
>> -                     (close-port (open-file "/var/log/wtmp" "a0"))
>> -
>> -                     ;; Set up /run/current-system.  Among other things this
>> -                     ;; sets up locales, which the activation snippets
>> -                     ;; executed below may expect.
>> -                     (activate-current-system)
>> -
>> -                     ;; Run the services' activation snippets.
>> -                     ;; TODO: Use 'load-compiled'.
>> -                     (for-each primitive-load '#$actions)))))
>> +    (map (cut program-file "activate-service.scm" <>) gexps))
>> +
>> +  (program-file "activate.scm"
>> +                (with-imported-modules (source-module-closure
>> +                                        '((gnu build activation)
>> +                                          (guix build utils)))
>> +                  #~(begin
>> +                      (use-modules (gnu build activation)
>> +                                   (guix build utils))
>> +
>> +                      ;; Make sure the user accounting database exists.  If it
>> +                      ;; does not exist, 'setutxent' does not create it and
>> +                      ;; thus there is no accounting at all.
>> +                      (close-port (open-file "/var/run/utmpx" "a0"))
>> +
>> +                      ;; Same for 'wtmp', which is populated by mingetty et
>> +                      ;; al.
>> +                      (mkdir-p "/var/log")
>> +                      (close-port (open-file "/var/log/wtmp" "a0"))
>> +
>> +                      ;; Set up /run/current-system.  Among other things this
>> +                      ;; sets up locales, which the activation snippets
>> +                      ;; executed below may expect.
>> +                      (activate-current-system)
>> +
>> +                      ;; Run the services' activation snippets.
>> +                      ;; TODO: Use 'load-compiled'.
>> +                      (for-each primitive-load '#$actions)))))
>>  
>>  (define (gexps->activation-gexp gexps)
>>    "Return a gexp that runs the activation script containing GEXPS."
>> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
>> index ebc99e52cc..81f2b33260 100644
>> --- a/guix/scripts/deploy.scm
>> +++ b/guix/scripts/deploy.scm
>> @@ -43,8 +43,6 @@
>>  (define (show-help)
>>    (display (G_ "Usage: guix deploy [OPTION] FILE...
>>  Perform the deployment specified by FILE.\n"))
>> -  (display (G_ "
>> -  -s, --system=SYSTEM    attempt to build for SYSTEM--e.g., \"i686-linux\""))
>>    (show-build-options-help)
>>    (newline)
>>    (display (G_ "
>> @@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
>>           %standard-build-options))
>>  
>>  (define %default-options
>> -  `((system . ,(%current-system))
>> -    (substitutes? . #t)
>> +  `((substitutes? . #t)
>>      (build-hook? . #t)
>>      (graft? . #t)
>>      (debug . 0)
>> @@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
>>        (set-build-options-from-command-line store opts)
>>        (for-each (lambda (machine)
>>                    (info (G_ "deploying to ~a...") (machine-display-name machine))
>> -                  (parameterize ((%current-system (assq-ref opts 'system))
>> -                                 (%graft? (assq-ref opts 'graft?)))
>> +                  (parameterize ((%graft? (assq-ref opts 'graft?)))
>>                      (run-with-store store (deploy-machine machine))))
>>                  machines))))

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-08-14 20:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-31 13:41 [bug#36872] [PATCH 1/2] remote: Build derivations appropriate for the remote's architecture Jakob L. Kreuze
2019-07-31 13:43 ` [bug#36872] [PATCH 2/2] remote: Remove '--system' argument Jakob L. Kreuze
2019-08-06 20:57   ` Christopher Lemmer Webber
2019-08-06 20:58     ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
2019-08-06 20:59       ` [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument Jakob L. Kreuze
2019-08-06 21:29     ` [bug#36872] [PATCH " Jakob L. Kreuze
2019-08-07 18:31       ` Christopher Lemmer Webber
2019-08-07 19:03         ` Thompson, David
2019-08-07 20:28           ` Jakob L. Kreuze
2019-08-09 18:24             ` [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's Jakob L. Kreuze
2019-08-09 18:25               ` [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument Jakob L. Kreuze
2019-08-14 19:40                 ` Christopher Lemmer Webber
2019-08-14 20:29                   ` bug#36872: " Christopher Lemmer Webber

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.