From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eHw/MKuWEGKUfAAAgWs5BA (envelope-from ) for ; Sat, 19 Feb 2022 08:05:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wHijLauWEGLSxgAA9RJhRA (envelope-from ) for ; Sat, 19 Feb 2022 08:05:15 +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 51478F638 for ; Sat, 19 Feb 2022 08:05:15 +0100 (CET) Received: from localhost ([::1]:50474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLJnu-0007CU-Cv for larch@yhetil.org; Sat, 19 Feb 2022 02:05:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLJlo-00077y-Ch for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLJlm-0007TF-ER for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLJlm-0005SQ-9v for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#40998: [PATCH v2 1/4] system: Add a version field to the record. References: <87r1w3kbi0.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: <87r1w3kbi0.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 19 Feb 2022 07:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40998 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: 40998@debbugs.gnu.org Received: via spool by 40998-submit@debbugs.gnu.org id=B40998.164525413720878 (code B ref 40998); Sat, 19 Feb 2022 07:03:02 +0000 Received: (at 40998) by debbugs.gnu.org; 19 Feb 2022 07:02:17 +0000 Received: from localhost ([127.0.0.1]:56785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJkz-0005QT-2a for submit@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:17 -0500 Received: from mail-qv1-f50.google.com ([209.85.219.50]:42859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJkx-0005Q7-A2 for 40998@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:11 -0500 Received: by mail-qv1-f50.google.com with SMTP id e22so19234111qvf.9 for <40998@debbugs.gnu.org>; Fri, 18 Feb 2022 23:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7LFLXG1oTSZ8uxSyGwC+LifVPyD3WlhhBDZEX6nM5T0=; b=ZkkKBi4oIO2665oFPD2wDOm4pgZ3gNDg7fSxYmn9n5noqXTa8HqtmC8ZySUVMyWZpJ u/3tGOVJLigX7oZUzeUQGVe7bHUutUFl8DeDASn3hS3bJUB+vVAAObslfkD1a2Nxbnsr bWTqJd5DDsey4Gz38dBkrybYrIsew3m5VFZ+62zPRcQ5L76ft1OLOjyTQKTLSjKV8KvT WSdUqkuSkTrsd0qEuLxJIP27ZLVjZWzHpEOAY5QTW53KFo++nXoGuv7pQOQ2uUyxfdry v8HzSr4jh8OMmTX5kD6L4rW3SMCvLYBOltPEd4xaXi5qmaKnQGCpY1C2Q2L9HrTWN+Jd M5eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7LFLXG1oTSZ8uxSyGwC+LifVPyD3WlhhBDZEX6nM5T0=; b=hcR7byaVtTD7pmNs2J+Gv8uKa9sgq7MZYLBCzXIhHdybk29+D57oXrjk7lG3laTG7z Cq0LuZwA/1Qq+p+9YNeq4WdD3T48Luz4Rl9QHWp6wNayw7DGE7GgbUAYZeDHgf2/65yU vNgB9rc7eosmFdSI7XJs8nIgPpCUVk+uJ+Gt5N6tm0qZgCWntX2zACFiFGPRk1VwD5h7 wO8g4NIj7GuT5qAcQA2DjnUe7FfOGTlbk/0yxlGf51nunNfsC/4KIm2CIvKDO3fQJ4zJ wSabRQJjCbSLwHIhCyUPHlXdvPZjijWHGMNdEVUx5e2F+2XSDcZkYuVzlyQwvpuQd/GM wxwQ== X-Gm-Message-State: AOAM5314PDsvwwL+RfEVYsumuxS1LcrKNIflLtm0rde1Ip7MaS80/787 3M74vrPuTMs22Rm8ffJ4OPpFGoRPU6I= X-Google-Smtp-Source: ABdhPJzVqXCDn2/Lmj0wTIMhZDwCLZMuSHJDStXzO160AI0nLxeuMGPSs+GB2R/DQrdBe1/CjAU97w== X-Received: by 2002:a05:6214:262d:b0:430:c99:8d6f with SMTP id gv13-20020a056214262d00b004300c998d6fmr8479602qvb.41.1645254125515; Fri, 18 Feb 2022 23:02:05 -0800 (PST) Received: from localhost.localdomain (dsl-149-79.b2b2c.ca. [66.158.149.79]) by smtp.gmail.com with ESMTPSA id g16sm4121024qka.11.2022.02.18.23.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 23:02:05 -0800 (PST) From: Maxim Cournoyer Date: Sat, 19 Feb 2022 02:01:52 -0500 Message-Id: <20220219070155.1924-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645254315; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: 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=7LFLXG1oTSZ8uxSyGwC+LifVPyD3WlhhBDZEX6nM5T0=; b=EPghXJKLeVkWGQvh+8JiTl0iFtgbiQ82Cr7c4D5iz2xP03w+wnJEh9PNwwhE/OLyWnY9nK Ixh+8+3X7D1ND3ovKwIsZM+KS99WmOQxw0gZbn2KCy2g1QJ3rAaqb+iqBDhFSog4MFp2Xu Gst2YKFpJskzx9C0F9Qmvu0Bl5UNv9ZaOt9a1Hyhfi3VYKzfNVGLjoVKVL/2zltRqS1+Jb RHKXsyRJzFh619u/pthCXxrltM1qOwDYRkW1zAeJIiHByl3JRyChk2bR+MBfvDG9xYNVIx 6dZ1CmOq9oqh1WQ4o4ko/Nuuvlx3KZnJgyLbgUBDGN8qXWvt6a2zn85/ye7NtQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645254315; a=rsa-sha256; cv=none; b=OYt2qWa40dIJUO/mCxwDnrg7id+Y5Pdgf0GlYcNBzLTSJei5fcZHa5KtsOEPe+M0/Xz19Q 0mqRb1N6Ic+SmbLcYxODgV599eCF7duBj8hxPnQ29TtgmBq9ZvtISdv+p9Gsm34C8MZo2b gLEdOw/zPLXH4V8QBwTEoA2Br1c4PNy4L5wEk3pvFz3yw6MsbeSZ0V/SBldUqvfZNv2MGO WVw2LznJVZKzq858nnLY9h/KyehtSEyHJB7TJJUIuEOMK5T7EEvf4NIKFcxT7EZE1kJkH5 LQMHU6QJUSDef0H5VPgodx1U2gQD6WbUlt/3N9ZqgXeKTIVMfc3Rr6Pp35GBWQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=ZkkKBi4o; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=ZkkKBi4o; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 51478F638 X-Spam-Score: -2.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: TdZeKAtTdBjP This version field exposes the (already present) version information of a boot parameters file. * gnu/system.scm (%boot-parameters-version): New variable. ()[version]: New field. (read-boot-parameters): Use it. (operating-system-boot-parameters-file): Likewise. * tests/boot-parameters.scm (test-read-boot-parameters): Use %boot-parameters-version as the default version value in the template. --- gnu/system.scm | 18 ++++++++++++++---- tests/boot-parameters.scm | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index cc925de16f..c29a44111b 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2020 Danny Milosavljevic ;;; Copyright © 2020, 2021 Brice Waegeneire ;;; Copyright © 2020 Florian Pelz -;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2020, 2022 Maxim Cournoyer ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2021 Maxime Devos @@ -161,6 +161,8 @@ (define-module (gnu system) boot-parameters-kernel-arguments boot-parameters-initrd boot-parameters-multiboot-modules + boot-parameters-version + %boot-parameters-version read-boot-parameters read-boot-parameters-file boot-parameters->menu-entry @@ -295,6 +297,8 @@ (define (operating-system-kernel-arguments os root-device) ;;; Boot parameters ;;; +(define %boot-parameters-version 0) + (define-record-type* boot-parameters make-boot-parameters boot-parameters? (label boot-parameters-label) @@ -322,7 +326,9 @@ (define-record-type* (kernel boot-parameters-kernel) (kernel-arguments boot-parameters-kernel-arguments) (initrd boot-parameters-initrd) - (multiboot-modules boot-parameters-multiboot-modules)) + (multiboot-modules boot-parameters-multiboot-modules) + (version boot-parameters-version ;positive integer + (default %boot-parameters-version))) (define (ensure-not-/dev device) "If DEVICE starts with a slash, return #f. This is meant to filter out @@ -359,12 +365,16 @@ (define uuid-sexp->uuid (warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port)) #f))) + (define (version? n) + (and (exact-integer? n) (not (negative? n)))) + (match (read port) - (('boot-parameters ('version 0) + (('boot-parameters ('version (? version? version)) ('label label) ('root-device root) ('kernel kernel) rest ...) (boot-parameters + (version version) (label label) (root-device (device-sexp->device root)) @@ -1500,7 +1510,7 @@ (define* (operating-system-boot-parameters-file os system-kernel-arguments?))) (scheme-file "parameters" #~(boot-parameters - (version 0) + (version #$(boot-parameters-version params)) (label #$(boot-parameters-label params)) (root-device #$(device->sexp diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm index b2799d0596..d4b680df2e 100644 --- a/tests/boot-parameters.scm +++ b/tests/boot-parameters.scm @@ -101,7 +101,7 @@ (define (quote-uuid uuid) ;; Call read-boot-parameters with the desired string as input. (define* (test-read-boot-parameters #:key - (version 0) + (version %boot-parameters-version) (bootloader-name 'grub) (bootloader-menu-entries '()) (label %default-label) -- 2.34.0