From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 02 12:04:14 2023 Received: (at submit) by debbugs.gnu.org; 2 Jan 2023 17:04:14 +0000 Received: from localhost ([127.0.0.1]:43926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOEQ-0000uW-1o for submit@debbugs.gnu.org; Mon, 02 Jan 2023 12:04:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:52566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOEO-0000uJ-3i for submit@debbugs.gnu.org; Mon, 02 Jan 2023 12:04:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCOEN-0006Ms-KN for guix-patches@gnu.org; Mon, 02 Jan 2023 12:04:11 -0500 Received: from latitanza.investici.org ([2001:888:2000:56::19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCOEK-0006WY-OU for guix-patches@gnu.org; Mon, 02 Jan 2023 12:04:11 -0500 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by latitanza.investici.org (Postfix) with ESMTP id 4Nm2Jh47SGzGp0h for ; Mon, 2 Jan 2023 17:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1672679044; bh=jnYfp77bmx6tsMTlTUZYrjQk1CALj+FEse06asAch1c=; h=Date:From:To:Subject:From; b=pPhWltciWrwqfWScRDTUnVlBd4FR/BP5eAv26PXQMsGqkvP+6smYxBR+B2DBoXs9O PMZi0lrJTqJmumt4sZEzq9CZkKAlbNMGauv0cYzuU09utjFcPFzLzQp5uBKPEZPDp3 T+p7nQ77hNi3WYylYzLZpkNFrKdoi4hAmPcRXBi0= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4Nm2Jh2vJYz5spj for ; Mon, 2 Jan 2023 17:04:04 +0000 (UTC) MIME-Version: 1.0 Date: Mon, 02 Jan 2023 17:04:04 +0000 From: goodoldpaul@autistici.org To: guix-patches@gnu.org Subject: [PATCH] services: unattended-upgrade: Add 'expression' field. User-Agent: Roundcube Webmail Message-ID: <868271b51416d65038128233f85f88f8@autistici.org> X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2001:888:2000:56::19; envelope-from=goodoldpaul@autistici.org; helo=latitanza.investici.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Dear Guixers, I'm sending a patch to add an expression field to the unattended-upgrade-configuration record. The main point of this field is to be passed to guix system reconfigure -e . This change should not break any existing configurations but I may have missed something. Thank you for your time and efforts, giacomo From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 02 12:05:55 2023 Received: (at 60497) by debbugs.gnu.org; 2 Jan 2023 17:05:55 +0000 Received: from localhost ([127.0.0.1]:43936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOG2-0000xd-IT for submit@debbugs.gnu.org; Mon, 02 Jan 2023 12:05:55 -0500 Received: from confino.investici.org ([93.190.126.19]:63101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOG0-0000xT-As for 60497@debbugs.gnu.org; Mon, 02 Jan 2023 12:05:53 -0500 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4Nm2Lk61B8z10ww; Mon, 2 Jan 2023 17:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1672679150; bh=84/970NjCnvo4J84r1z03QZGxXH5bD+F5ep+xCej4jo=; h=From:To:Cc:Subject:Date:From; b=WBAAmF5HYjZxTFUBIBllTjRklHZxIP3UEr4BdTC/DtdAKVnpgI9Wok7+/tWyjHhY1 tQAX5wQSY/8angBc3zcj8KmKQcNMjjQ9Uuzx+uL7t3YbKvsjIv109FwAXYvm2AZ687 eXnEPCcjXbdOlpt/rPm9MkIC3dJBQwCF/XwfzBMU= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4Nm2Lk54xrz10w6; Mon, 2 Jan 2023 17:05:50 +0000 (UTC) From: Giacomo Leidi To: 60497@debbugs.gnu.org Subject: [PATCH] services: unattended-upgrade: Add 'expression' field. Date: Mon, 2 Jan 2023 18:05:24 +0100 Message-Id: <20230102170524.32115-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60497 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/services/admin.scm ()[expression]: New field. (unattended-upgrade-mcron-jobs): Honor it. * doc/guix.texi (Unattended Upgrades): Document it. --- doc/guix.texi | 12 ++++++++++++ gnu/services/admin.scm | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5c85680831..cf109cf3d6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@* Copyright @copyright{} 2022 Simon Streit@* Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* +Copyright @copyright{} 2023 Giacomo Leidi@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -21270,6 +21271,17 @@ 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. diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 252bedb0bd..ff5ceae47e 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016-2022 Ludovic Courtès ;;; Copyright © 2020 Brice Waegeneire +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +31,7 @@ (define-module (gnu services admin) #:use-module (guix packages) #:use-module (guix records) #:use-module (srfi srfi-1) + #:use-module (ice-9 format) #:use-module (ice-9 vlist) #:export (%default-rotations %rotated-files @@ -57,6 +59,7 @@ (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-channels unattended-upgrade-configuration-schedule @@ -263,6 +266,8 @@ (define-record-type* unattended-upgrade-configuration? (operating-system-file unattended-upgrade-operating-system-file (default "/run/current-system/configuration.scm")) + (expression unattended-upgrade-expression + (default #f)) (schedule unattended-upgrade-configuration-schedule (default "30 01 * * 0")) (channels unattended-upgrade-configuration-channels @@ -296,6 +301,14 @@ (define expiration (define config-file (unattended-upgrade-operating-system-file config)) + (define expression + (unattended-upgrade-expression config)) + + (define reconfigure-args + (if expression + #~(list "-e" (format #t "~s" expression)) + #~(list config-file))) + (define code (with-imported-modules (source-module-closure '((guix build utils) (gnu services herd))) @@ -335,7 +348,7 @@ (define (alarm-handler . _) (report-invoke-error c))) (invoke #$(file-append guix "/bin/guix") "time-machine" "-C" #$channels - "--" "system" "reconfigure" #$config-file) + "--" "system" "reconfigure" #$@reconfigure-args) ;; 'guix system delete-generations' fails when there's no ;; matching generation. Thus, catch 'invoke-error?'. base-commit: 7efcf36e3b753a1dba6f8208f3c22d151007eaf0 -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 10 05:11:35 2023 Received: (at 60497-done) by debbugs.gnu.org; 10 Jan 2023 10:11:35 +0000 Received: from localhost ([127.0.0.1]:38851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFBbS-0005yC-TM for submit@debbugs.gnu.org; Tue, 10 Jan 2023 05:11:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFBbR-0005xy-VS for 60497-done@debbugs.gnu.org; Tue, 10 Jan 2023 05:11:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFBbL-0000u6-O3; Tue, 10 Jan 2023 05:11:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=l/aT5gDHLjwrFtJQtRLg1PFvxnmZRq202pEhJG3XbpY=; b=RBNaMkZPiVe0cFhgwwdp YDaH1QnzGa19umvFWmoDy8OCDNgGT+NSJIqYTuS8a1oS1Iyk191+h7rU1pjr0joNa6xZpSVU/4aJF oDxxcoWGI2peVogpCmm0skYJyXZySME4wuZx1yQ5U8mScSgWk6mZioS/u9HFIYREB5rG5k5Fi9c0e dGVUihrQ3UlxXj1PF78fPmPWDgRaFvk0g2QC65foJTEnv+tTKS3dGji2vY28BvF3K+cw99gVb5KFm VmwDvPDqzfCrzJH8TFBAEI3NNquxZu8IPcdhXAeTAVmvyWXpRgfdRq8VP0gn4qvK6sjVyk6jZ0dDR 18dVcndIMFvVnQ==; Received: from [193.50.110.246] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFBbJ-0007hI-UU; Tue, 10 Jan 2023 05:11:26 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Leidi Subject: Re: bug#60497: [PATCH] services: unattended-upgrade: Add 'expression' field. References: <868271b51416d65038128233f85f88f8@autistici.org> <20230102170524.32115-1-goodoldpaul@autistici.org> Date: Tue, 10 Jan 2023 11:11:23 +0100 In-Reply-To: <20230102170524.32115-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Mon, 2 Jan 2023 18:05:24 +0100") Message-ID: <87pmbmog1g.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60497-done Cc: 60497-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Giacomo Leidi skribis: > * gnu/services/admin.scm ()[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)) =E2=80=A6) but =E2=80=98expression=E2=80=99 is unbound within that gexp (missing #$ so= mewhere). Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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{SU= BSTITUTE-SERVER-2} =20 @copying -Copyright @copyright{} 2012-2022 Ludovic Court=C3=A8s@* +Copyright @copyright{} 2012-2023 Ludovic Court=C3=A8s@* 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 up= grade (@pxref{Channels}). By default, the tip of the official @code{guix} channel is used. =20 -@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 provi= ded 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/co= nfiguration.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}. =20 +@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 =C2=A9 2016 Jan Nieuwenhuizen -;;; Copyright =C2=A9 2016-2022 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2016-2023 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2020 Brice Waegeneire ;;; Copyright =C2=A9 2023 Giacomo Leidi ;;; @@ -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? (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-express= ion + (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)) =20 (define expression - (unattended-upgrade-expression config)) + (unattended-upgrade-operating-system-expression config)) =20 - (define reconfigure-args + (define arguments (if expression - #~(list "-e" (format #t "~s" expression)) + #~(list "-e" (object->string '#$expression)) #~(list config-file))) =20 (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) =20 ;; 'guix system delete-generations' fails when there's no ;; matching generation. Thus, catch 'invoke-error?'. --=-=-=-- From unknown Sun Jun 15 08:45:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 07 Feb 2023 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator