From patchwork Thu Apr 25 15:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 63361 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BF3FD27BBEA; Thu, 25 Apr 2024 16:58:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E8CAA27BBE2 for ; Thu, 25 Apr 2024 16:58:28 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s01U9-0000qZ-NS; Thu, 25 Apr 2024 11:58:09 -0400 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 1s01U7-0000pB-Fc for guix-patches@gnu.org; Thu, 25 Apr 2024 11:58:07 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s01U7-00034l-0o for guix-patches@gnu.org; Thu, 25 Apr 2024 11:58:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s01UO-00076t-CP for guix-patches@gnu.org; Thu, 25 Apr 2024 11:58:24 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70569] [PATCH 3/3] system: Warn when multiple nss-certs packages are used. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Apr 2024 15:58:23 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70569 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70569@debbugs.gnu.org Cc: john.kehayias@protonmail.com, Maxim Cournoyer , Ian Eure Received: via spool by 70569-submit@debbugs.gnu.org id=B70569.171406063426570 (code B ref 70569); Thu, 25 Apr 2024 15:58:23 +0000 Received: (at 70569) by debbugs.gnu.org; 25 Apr 2024 15:57:14 +0000 Received: from localhost ([127.0.0.1]:33120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s01T9-0006ti-U7 for submit@debbugs.gnu.org; Thu, 25 Apr 2024 11:57:12 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:55706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s01SI-0006jE-MJ for 70569@debbugs.gnu.org; Thu, 25 Apr 2024 11:56:25 -0400 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6ea2ac4607aso590841a34.3 for <70569@debbugs.gnu.org>; Thu, 25 Apr 2024 08:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714060551; x=1714665351; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nlbj8Ge6bkCLfPtYGl2p+4nEOq41iOUyfqgRdNqij3g=; b=GlcRH99eCeRjvW+dudkd5PSJ0mD55XSuMNS8SvFBbuRXSsg+MWmogu/hLV64QeBxK7 zi9aCovgDhJeh+OdxXsSYk2IH6uNbrvzOrIN2fBENxHbHpPjhGRg2VoEv0NVlDBBCAuF qN8ZU+tAeFUuhzEJDd6wPeiWDNSCoIMGsr+5MiTnmXT2WmrBybgoel27f2yXxJ5U+lLd YLPgvS5ukyQxfdJJWFVH+nTICk4pkHclw/epYWfPd3NvkgwOJ88jDOi8c2ANbAt7TtSL hqeYB1TDxCrmHIR8Ib3SK1waiN2D5hWtj6nqFVWiKIxV28FUAPu2N0wPnXE0WfsqU+Bn 8q8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714060551; x=1714665351; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nlbj8Ge6bkCLfPtYGl2p+4nEOq41iOUyfqgRdNqij3g=; b=X36o6QS2rhqsy+BjJgT7oGA/lcmhcjnAZK0npsCWv4ua7YnJcaRJKKjeC+LO5wQrqw 5mdDqotfzbfUvr6x1585w62UAeAPIXrr4DQVQpyb3UTJDqHj1bGYM2oFRJ/ZeEmhfD9M 72Uai0Y88G56fEQ+dV5R9nPwzh/wn+u9SpEQGkjRu3bRp8TBjUwegtbwMcFE+SGATjvd xuZYg+QrsvJujZ3SEBnt1qY9/yAZjZDrDwRv9pnV2tWt20VU93pe0Dmr/J/UyldC3Xys pga75yD0omf4RSGYQjE0pxcp1d6mK78zzb3A0ABkFIH+mEJO/lGuH1KQbieyvWAhWUmT 96rA== X-Gm-Message-State: AOJu0Yy14Fa7/NXz6aa9StyU6o1etSMTPQutxVIwKykiokFkCPzOk1LT E6uErpb6yxlkHdqrjUBm9iaNx4wM6I8/Q0ZHLsY62qSIv3XChqFfedOstw== X-Google-Smtp-Source: AGHT+IE2qMTz88n1fhy9rhNEE/QA6i9L6VOjefniNSXga/CaOw6JdGAj4GHlqzjgaGJsW4sVGu6Whg== X-Received: by 2002:a05:6830:44:b0:6eb:7c8a:5e40 with SMTP id d4-20020a056830004400b006eb7c8a5e40mr7490353otp.11.1714060550883; Thu, 25 Apr 2024 08:55:50 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-191.b2b2c.ca. [205.233.124.191]) by smtp.gmail.com with ESMTPSA id xx24-20020a05620a5d9800b0078f1583f724sm6464519qkn.59.2024.04.25.08.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 08:55:50 -0700 (PDT) From: Maxim Cournoyer Date: Thu, 25 Apr 2024 11:54:30 -0400 Message-ID: <3c869bd9be359f4c524d26789b1260f266a6a949.1714060468.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This can happen due to users providing 'nss-certs' and adding it to the %base-packages, which now include 'nss-certs'. * gnu/system.scm (operating-system-packages): Warn when multiple nss-certs packages are detected; keep only the latest one. Change-Id: I6104f134ea1cc155ae9e8e0ae70bb5a38fc05800 Reported-by: Ian Eure --- gnu/system.scm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index c7f8003ad2..025834328c 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -43,7 +43,8 @@ (define-module (gnu system) #:use-module (guix deprecation) #:use-module (guix derivations) #:use-module (guix profiles) - #:use-module ((guix utils) #:select (substitute-keyword-arguments)) + #:use-module ((guix utils) #:select (substitute-keyword-arguments + version>?)) #:use-module (guix i18n) #:use-module (guix diagnostics) #:use-module (guix ui) @@ -275,7 +276,7 @@ (define-record-type* operating-system (issue operating-system-issue ; string (default %default-issue)) - (packages operating-system-packages ; list of (PACKAGE OUTPUT...) + (packages %operating-system-packages ; list of (PACKAGE OUTPUT...) (default %base-packages)) ; or just PACKAGE (timezone operating-system-timezone @@ -316,6 +317,29 @@ (define-deprecated (operating-system-hosts-file os) hosts-service-type (%operating-system-hosts-file os)) +;;; XXX: Remove after a new release of Guix no longer suggests to install +;;; nss-certs. +(define (operating-system-packages os) + "Return the packages of the OS record object." + ;; This wrapper is used to warn users that their operating system packages + ;; field contains a duplicated nss-certs packages. + (let* ((packages (%operating-system-packages os)) + (nss-certs-packages (sort (filter (lambda (p) + (string=? "nss-certs" (package-name p))) + packages) + (lambda (x y) + ;; Sort from newer to older versions. + (version>? (package-version x) + (package-version y)))))) + (if (> (length nss-certs-packages) 1) + (begin + (warning #f + (G_ "multiple 'nss-certs' packages found; 'nss-certs' \ +is now included by default in '%base-packages'; ensure it is not explicitly \ +listed in the operating system 'packages' field~%")) + (fold delete packages (drop nss-certs-packages 1))) + packages))) + (define* (operating-system-kernel-arguments os root-device #:key (version %boot-parameters-version)) "Return all the kernel arguments, including the ones not specified directly