From: "Ludovic Courtès" <ludo@gnu.org>
To: Giacomo Leidi <goodoldpaul@autistici.org>
Cc: 60497-done@debbugs.gnu.org
Subject: bug#60497: [PATCH] services: unattended-upgrade: Add 'expression' field.
Date: Tue, 10 Jan 2023 11:11:23 +0100 [thread overview]
Message-ID: <87pmbmog1g.fsf_-_@gnu.org> (raw)
In-Reply-To: <20230102170524.32115-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Mon, 2 Jan 2023 18:05:24 +0100")
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
Hi,
Giacomo Leidi <goodoldpaul@autistici.org> skribis:
> * gnu/services/admin.scm (<unattended-upgrade-configuration>)[expression]:
> New field.
> (unattended-upgrade-mcron-jobs): Honor it.
> * doc/guix.texi (Unattended Upgrades): Document it.
Nice! I made the cosmetic changes below to improve consistency.
BTW, previously it had:
(if expression
#~(list "-e" (format #t "~s" expression))
…)
but ‘expression’ is unbound within that gexp (missing #$ somewhere).
Thanks,
Ludo’.
[-- Attachment #2: Type: text/x-patch, Size: 4816 bytes --]
diff --git a/doc/guix.texi b/doc/guix.texi
index 78d1dd8b2a..cda940b1fa 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22,7 +22,7 @@
@set SUBSTITUTE-URLS https://@value{SUBSTITUTE-SERVER-1} https://@value{SUBSTITUTE-SERVER-2}
@copying
-Copyright @copyright{} 2012-2022 Ludovic Courtès@*
+Copyright @copyright{} 2012-2023 Ludovic Courtès@*
Copyright @copyright{} 2013, 2014, 2016 Andreas Enge@*
Copyright @copyright{} 2013 Nikita Karetnikov@*
Copyright @copyright{} 2014, 2015, 2016 Alex Kost@*
@@ -21340,17 +21340,6 @@ This gexp specifies the channels to use for the upgrade
(@pxref{Channels}). By default, the tip of the official @code{guix}
channel is used.
-@item @code{expression} (default: @code{#f})
-This field specifies the Guile expression to use for the upgrade
-(@pxref{Invoking guix system}) as a list of symbols. If no value is provided the
-@code{operating-system-file} field value will be used.
-
-@lisp
-(unattended-upgrade-configuration
- (expression
- '(@@ (guix system install) installation-os)))
-@end lisp
-
@item @code{operating-system-file} (default: @code{"/run/current-system/configuration.scm"})
This field specifies the operating system configuration file to use.
The default is to reuse the config file of the current configuration.
@@ -21374,6 +21363,17 @@ Therefore, uses of @code{local-file} within @file{config.scm} will work
as expected. @xref{G-Expressions}, for information about
@code{local-file} and @code{file-append}.
+@item @code{operating-system-expression} (default: @code{#f})
+This field specifies an expression that evaluates to the operating
+system to use for the upgrade. If no value is provided the
+@code{operating-system-file} field value is used.
+
+@lisp
+(unattended-upgrade-configuration
+ (operating-system-expression
+ #~(@@ (guix system install) installation-os)))
+@end lisp
+
@item @code{services-to-restart} (default: @code{'(mcron)})
This field specifies the Shepherd services to restart when the upgrade
completes.
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index ff5ceae47e..a864da25e9 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
-;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
@@ -59,8 +59,8 @@ (define-module (gnu services admin)
unattended-upgrade-service-type
unattended-upgrade-configuration
unattended-upgrade-configuration?
- unattended-upgrade-configuration-expression
unattended-upgrade-configuration-operating-system-file
+ unattended-upgrade-configuration-operating-system-expression
unattended-upgrade-configuration-channels
unattended-upgrade-configuration-schedule
unattended-upgrade-configuration-services-to-restart
@@ -266,8 +266,8 @@ (define-record-type* <unattended-upgrade-configuration>
unattended-upgrade-configuration?
(operating-system-file unattended-upgrade-operating-system-file
(default "/run/current-system/configuration.scm"))
- (expression unattended-upgrade-expression
- (default #f))
+ (operating-system-expression unattended-upgrade-operating-system-expression
+ (default #f))
(schedule unattended-upgrade-configuration-schedule
(default "30 01 * * 0"))
(channels unattended-upgrade-configuration-channels
@@ -302,11 +302,11 @@ (define config-file
(unattended-upgrade-operating-system-file config))
(define expression
- (unattended-upgrade-expression config))
+ (unattended-upgrade-operating-system-expression config))
- (define reconfigure-args
+ (define arguments
(if expression
- #~(list "-e" (format #t "~s" expression))
+ #~(list "-e" (object->string '#$expression))
#~(list config-file)))
(define code
@@ -348,7 +348,7 @@ (define (alarm-handler . _)
(report-invoke-error c)))
(invoke #$(file-append guix "/bin/guix")
"time-machine" "-C" #$channels
- "--" "system" "reconfigure" #$@reconfigure-args)
+ "--" "system" "reconfigure" #$@arguments)
;; 'guix system delete-generations' fails when there's no
;; matching generation. Thus, catch 'invoke-error?'.
prev parent reply other threads:[~2023-01-10 10:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-02 17:04 [bug#60497] [PATCH] services: unattended-upgrade: Add 'expression' field goodoldpaul--- via Guix-patches via
2023-01-02 17:05 ` Giacomo Leidi via Guix-patches via
2023-01-10 10:11 ` Ludovic Courtès [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmbmog1g.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=60497-done@debbugs.gnu.org \
--cc=goodoldpaul@autistici.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.