From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SOUnGR48vWMXZQEAbAwnHQ (envelope-from ) for ; Tue, 10 Jan 2023 11:21:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mHxfGB48vWO7cwAAG6o9tA (envelope-from ) for ; Tue, 10 Jan 2023 11:21:18 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DAFB0AB73 for ; Tue, 10 Jan 2023 11:21:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFBbz-0008FS-9B; Tue, 10 Jan 2023 05:12:07 -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 1pFBbv-0008Da-LD for guix-patches@gnu.org; Tue, 10 Jan 2023 05:12:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFBbu-00014q-VK for guix-patches@gnu.org; Tue, 10 Jan 2023 05:12:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFBbu-0005zY-QP for guix-patches@gnu.org; Tue, 10 Jan 2023 05:12:02 -0500 Subject: bug#60497: [PATCH] services: unattended-upgrade: Add 'expression' field. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Tue, 10 Jan 2023 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 60497 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Giacomo Leidi Cc: 60497-done@debbugs.gnu.org Mail-Followup-To: 60497@debbugs.gnu.org, ludo@gnu.org, goodoldpaul@autistici.org Received: via spool by 60497-done@debbugs.gnu.org id=D60497.167334549522960 (code D ref 60497); Tue, 10 Jan 2023 10:12:02 +0000 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=RBNaMkZP; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673346078; a=rsa-sha256; cv=none; b=l2/ay2bDerA4CvMMFURDwnEL+G6Nuk7+3lCWk4RXq5dRH6VpfzmS7vOgfnXFWRq0mkHrT7 mWgXEsKtP7iSm5oNYLlOAL1mGmDM/DYOcUs+y1l+QdoRHibBPjSOlaBgiGeGgZfkkbkkmH sKc9QkpTc22dSqrvmlw6rSrTX2ulN7TnTrpuKBz/nCUahIJNDAO/q4g+EqoXXUr2qUKVXQ 8LMC6Qdz87EJdclZ9CaP2px7XXWlkOFrZpwCrWQNAcJO+lbuIBSjtljoaK4JbWcJ8P4cIV NhRnSuxFj5crrC7zWA12Ua3jGzslnqAMEs/HJqolSH74CwHj82D+eyRq5QBZdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673346078; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-to:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=l/aT5gDHLjwrFtJQtRLg1PFvxnmZRq202pEhJG3XbpY=; b=oUhhbu6aoOMIfSthmUvMRlARhbOi+72kopSDX6uzwJT4r7qXlFBauXUW0XjOH6Jv93J5rr 7NVOTsFRuYZM98y6WlYZ8uKv8T2sB+3eH3dW1xwdFtVKtWXfIIVXtCANx7tWtpoofGoe9M fkwjIf2SqFwNZJbf7vHQrMR82VFKFekUEC9ZAUoZPUwIHv/lMUvHHe+xShLnVhUkAWGi0M 3KmiJjZimxIndJktk691Ja4ddfpwc20SVmd+is/sGEjrwEj7JjiMOqExHUBBpvo4YfbGxR hjfXyVWjLW9dmdlweyRdmeMKx3uZEHL2SdPL/UjRM1dwSAfQ/jnKCYmlj86fWg== X-Migadu-Queue-Id: DAFB0AB73 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=RBNaMkZP; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-Migadu-Spam-Score: -3.28 X-Spam-Score: -3.28 X-TUID: 80DfRDxAFUo6 --=-=-= 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?'. --=-=-=--