From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id wKEkBn8HPGZW8gAAqHPOHw:P1 (envelope-from ) for ; Thu, 09 May 2024 01:15:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wKEkBn8HPGZW8gAAqHPOHw (envelope-from ) for ; Thu, 09 May 2024 01:15:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=b3NaZ6HT; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=DFTvkK8i; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none); 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715210110; a=rsa-sha256; cv=none; b=R6FE+e07R+9Jfc42hRBwsuGxDh79sqCjc6KtwoZJoRM3Evbi1CbjwsTH78NKi8nexJVVD/ rVkKR5oiIQQ7Nj1Dgjjyx5dL/NUv4zS71OhzI1lHhTbDwytS5n6/3zkoox/1w1AzLns6Lu 3waXGimQ+IXk1yGR88o9gi3wLPRkNgHcXv1UKz0GBN5iggsLFDbl8e77wms5xE3VC1WeHw cbRTc50uI5zGGVKCqF0AYcT733tR7jF2DxMoZbiT0Ams8KdeghwAY1xUZzCLpHcM43/z2+ mW0EJfMeQFNXY/kT5m07uLWEvx+p8NF7XtYhkklMQU5OGyP6GvnBsYRcVu4Kcw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=b3NaZ6HT; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=DFTvkK8i; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715210110; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=/93j8gKk35TcxL4XjPC2Cjx8nJhKqIwcaIPEGn2WjPY=; b=jYF+ZEl1jWPWjbcF8iQUj8qfQdvVjk2vDxyF0YvL5bD6fLB2WNDUMkfgdKV1zSgfc4N5Hh my+2OBwEBcmro7J3WF3fZ4PKSlbKbRHMvSH5uma1M+nrQ2QysI+puFRXpdgqBHcZYHtkE4 XXtLZc++Q6VJ68xgp3J3aRIGxJVf/8+EEsqolv2VoYJ9aXQMPLCvEIBoF7YZGPwvUQFl4O 9rK+FlVJea1jf7Cu1dRVf6M1YoFWYanU6xETuVkjvdY+FnmSCOHyK6fIhN9u0wmg9PXQn4 fAWL9g78E8aDjYHjM1nu2VS7KNKcrTZa4Y13n33rlu5tZDMZmkQG1KSmZgm+pA== 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 D1F8B63358 for ; Thu, 9 May 2024 01:15:10 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4qUl-0001EF-20; Wed, 08 May 2024 19:14:43 -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 1s4qUi-0001DL-9e for guix-patches@gnu.org; Wed, 08 May 2024 19:14:40 -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 1s4qUh-0001nA-MP; Wed, 08 May 2024 19:14:39 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s4qV4-0004YI-Hc; Wed, 08 May 2024 19:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70839] [PATCH 2/3] channels: Add `read-channels-file' procedure. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Wed, 08 May 2024 23:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70839 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70839@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 70839-submit@debbugs.gnu.org id=B70839.171521004617455 (code B ref 70839); Wed, 08 May 2024 23:15:02 +0000 Received: (at 70839) by debbugs.gnu.org; 8 May 2024 23:14:06 +0000 Received: from localhost ([127.0.0.1]:51435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4qUA-0004XS-1I for submit@debbugs.gnu.org; Wed, 08 May 2024 19:14:06 -0400 Received: from wolfsden.cz ([37.205.8.62]:52668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1s4qU4-0004Wk-Gh for 70839@debbugs.gnu.org; Wed, 08 May 2024 19:14:04 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 49B9928322D; Wed, 8 May 2024 23:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715210013; bh=7KhNkJrCoUXbAHO2MbicZHJNKsZedPj8duha/4fr1i0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=b3NaZ6HTgA0IYjrPrwKeqo7m9c3Vsw8anlu2c4YjtuMBfdR95pmQFN2d2QzKBIRIP PUYvC5B+JqGKMjfqeFlwsDUFtytB10cBDiq3tyEXqPzhd3ZD+EPDW1Hu57fZsjnVya l0S2c+ruBwOKMzri2ZTua1CMfWI5rB51MCclV5ipNvez7POA4zecAySAPbSfEQw8Mt R/brOwAw7E6L48gg3BLwY5D9YIFGTnC3pFc5T1OiAkD/gnya2BFuqTmIfwlll2wkG3 KNHW4bnH0KgoMSsQsw8rW030b2xKmMGAVr88G9zLBTMvCNxak9w3Spkh7IR8rWboQc 5IMg+ZROtfvlSPb8W2zttMrbpn0WR1GKGPbZn46eG/KEM4rPoNO4rRj4pqQn/jEBv+ iMMP0D6tx8c8Aj/OktUcXTSf99XE6c7iGL+HqITGRRO2AlelzHX57i4luWbvBnyBoc k2eUH2/t1iYAE1VTNZLJq6Fzwr4SriLVmzYtodKcP36jrDIM9pNdDQCzSMAhkeiJYY +IG0ffpxNxQlut9lfwFiPm319IWN5SHJsFOKA7W0LCnnnn4rT17cWiCdV/Pso8K9UI EWXKhK7TaKs02j2XZf7xDfEk/wVm7fFQ/iAEed0vBKtMaHPF1QM5lFqOldT1G3uRNU bq2oJMbUo8wZJPflof3UegRw= Received: from localhost (unknown [146.70.134.183]) by wolfsden.cz (Postfix) with ESMTPSA id 4C2F1284509; Wed, 8 May 2024 23:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715210012; bh=7KhNkJrCoUXbAHO2MbicZHJNKsZedPj8duha/4fr1i0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DFTvkK8ikXvJ4eVTvY58pxtjS+vWJBpRuMeIHSEAXVx1MakdVIadua2h7pPboXOAS pL/YHGXYpg2DhIrZLuHEhCrRXxzvwq30Vv/P9u/Vz4RQHDH2oFO/2XvgsOMavaO+6h SGZy4XFf6Ei+ekkzNOrEx8un5sm2BVfku0kKrsXriJjg5TFgjokFh3eT06mQvVUh0w ruXwVOlYnnkcbUA6ngviX+uLRauqAR1WE2Lign/+32tf6hMS70ZjVW5LpYd0RYk4X1 rzNQXUuYAxLSpevCBa7FWLTEaAY7yQ1IhGRD3mrLZmtda6yauu210AkEI5iUuDwflB gsO2KtZnhH48TXUROh8KwCCMNuYmT/EiziMwmRc4D23uWBtFn+XVJbWYnqz8t7UP9D trhSnzNDncnFDUz1oHIKlorYpNdWU+ttYjgc/Vn3FDDD0clA+Fhc/yPrqmjK8VQ4TR 9JlRuCZnmD8XhdKDAhXOECVxCiXmunWhCkA/iyAUnlIPnqtRupkQ44MJOZ0QuVflbG gPMaUAGw4MHojw4ikXC4Cr2H46mcsH3BJ9csouDaxRFR1EKrSNwYMHSAvyNP21VcW7 NKuTeQ6/++QJlXIAbA8iIBe4x+UoouZyR2lI9BA/E3g8/IDl+Vbr9SldBKkYhy3uz+ bD0E6pPFvRYjTeOh6yd37Nfw= From: Tomas Volf <~@wolfsden.cz> Date: Thu, 9 May 2024 01:13:23 +0200 Message-ID: <06234d6dbf04c97da49ecadb8f8d139bf1fe1536.1715208954.git.~@wolfsden.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 X-Migadu-Queue-Id: D1F8B63358 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: 5.61 X-Spam-Score: 5.61 X-TUID: HUIbbe6dnqzL This commit moves non-exported local procedure from (guix pull) in order to provide a single, canonical way to read a file produced by `guix describe --format=channels'. * guix/channels.scm (read-channels-file): New procedure. (define-module): Export it. * guix/scripts/pull.scm (channel-list): Use it. Change-Id: I147fdf3cb177114f4607209de2299f46761b64be --- guix/channels.scm | 14 +++++++++++++- guix/scripts/pull.scm | 12 +++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/guix/channels.scm b/guix/channels.scm index 51024dcad4..38d5c8c325 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -37,6 +37,7 @@ (define-module (guix channels) #:autoload (guix git-authenticate) (authenticate-repository) #:autoload (guix openpgp) (openpgp-public-key-fingerprint openpgp-format-fingerprint) + #:autoload (guix ui) (load* make-user-module) #:use-module (guix base16) #:use-module (guix records) #:use-module (guix gexp) @@ -111,7 +112,9 @@ (define-module (guix channels) channel-news-entry-title channel-news-entry-body - channel-news-for-commit)) + channel-news-for-commit + + read-channels-file)) ;;; Commentary: ;;; @@ -1086,6 +1089,15 @@ (define* (channel->code channel #:key (include-introduction? #t)) intro)))))) '())))) +(define (read-channels-file file) + "Return channel list read from FILE. + +The file shall have format produced by `guix describe --format=channels'." + (let ((result (load* file (make-user-module '((guix channels)))))) + (if (and (list? result) (every channel? result)) + result + (leave (G_ "'~a' did not return a list of channels~%") file)))) + ;;; ;;; News. diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 58d3cd7e83..7240b2f25e 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -750,21 +750,15 @@ (define (channel-list opts) (define global-file (string-append %sysconfdir "/guix/channels.scm")) - (define (load-channels file) - (let ((result (load* file (make-user-module '((guix channels)))))) - (if (and (list? result) (every channel? result)) - result - (leave (G_ "'~a' did not return a list of channels~%") file)))) - (define channels (cond (file - (load-channels file)) + (read-channels-file file)) ((and (not ignore-channel-files?) (file-exists? default-file)) - (load-channels default-file)) + (read-channels-file default-file)) ((and (not ignore-channel-files?) (file-exists? global-file)) - (load-channels global-file)) + (read-channels-file global-file)) (else %default-channels))) -- 2.41.0