From patchwork Sat May 24 17:12:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Sergio_Pastor_P=C3=A9rez?= X-Patchwork-Id: 42902 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 31D0B27BC4C; Sat, 24 May 2025 18:14:25 +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=-6.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 B044627BC49 for ; Sat, 24 May 2025 18:14:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uIsRn-0000nG-Sm; Sat, 24 May 2025 13:14:11 -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 1uIsRl-0000mt-5w for guix-patches@gnu.org; Sat, 24 May 2025 13:14:09 -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 1uIsRj-00064V-O9; Sat, 24 May 2025 13:14:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=Imlu4CdBW2wUCfYrPnDGzdbrN4qwm3qVLTEXQWtIBW0=; b=MgS7XZXwx5UmkR9L+TpWUVwT4+2T78+iVvQtP+s+uun3q+XpJ3OPIMjJy9rXdUC4Eed7aATspwskkJH9hzppvFVbVmxOJyExngOfxhyY2otnTVV8Hunar22I3qrn9jIQAv0CsO3gG4Uiy/DUX4RPJTuqDCA0qyqd9a2jbfujw7adikt8ZxcdMzN0bIjglprfZIGiLQENnGGDdcFiNF/PI1edhSGTXWg6qGm/2EtZYyYhrGf57QGAvPX5kDf7WOVLYZYu5dFqWYZEEyucFTchibi1Qqt8WTVSlkhU9ymkA4/lQHDYLCWaPC/JVKsal+ShCaoQ5oHLKw1cEJzQjOQgPA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uIsRe-00021S-F4; Sat, 24 May 2025 13:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78580] [PATCH] pull: allow filtering which channels to pull from the CLI Resent-From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 24 May 2025 17:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78580 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78580@debbugs.gnu.org Cc: Sergio Pastor =?utf-8?b?UMOpcmV6?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17481068247709 (code B ref -1); Sat, 24 May 2025 17:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 May 2025 17:13:44 +0000 Received: from localhost ([127.0.0.1]:34871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uIsRI-000209-GZ for submit@debbugs.gnu.org; Sat, 24 May 2025 13:13:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34238) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uIsRE-0001zn-RR for submit@debbugs.gnu.org; Sat, 24 May 2025 13:13:37 -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 1uIsR8-0000lh-DV for guix-patches@gnu.org; Sat, 24 May 2025 13:13:30 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uIsR6-00060q-G6 for guix-patches@gnu.org; Sat, 24 May 2025 13:13:30 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-443a787bd14so13616855e9.1 for ; Sat, 24 May 2025 10:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748106806; x=1748711606; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Imlu4CdBW2wUCfYrPnDGzdbrN4qwm3qVLTEXQWtIBW0=; b=CQ+T9zHrTQHdnVwu5+ioc4wpVrkAtS7u5XN/iLDFs17+7Y0O6heK/32v6bG6kZPmQF mxfINqWATiXmJCrR3Pru+EP95bEZ7ZTgh3C2PwLDc9u3Uljryzsk75/1s0FKCXtJsR5M 4wmfwWHCB1hmWKHF3uYJHFHRzk30VGAPc8X0D+2/W6ml/iSUll7qoluvhazlrwNKXfm+ 1QYaaTsJZDnImKo19ZZdGTBOnVTflodDS9iCITGlF/ISL6YBpLzcLv1aSUn/jDxVPiT6 yNEhDMpbgYDDhpynOHSLLySDRNry+NKW5cfXs4OR0teB+v3MtR5+kgUhdfwJGtm3mpRH 02nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748106806; x=1748711606; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Imlu4CdBW2wUCfYrPnDGzdbrN4qwm3qVLTEXQWtIBW0=; b=IMXjIfqokAV+Zk9ttbgK85dGqG76uOCOzxV/2UPGsPqSmhoMLykYC9tnBA0AqMjM2l MaQEr01g/L3juHqnaOPR8NNHd9w8yxA2HuogtQ0ZK5oTEIYzoVP03/e4Fu7glnpphJhT 7uERTj31hA1PEW3ztH50qJfX3ONUVlssiHx36y5qScqs18fQutyMChaS1P7T+Jafe6xI Q9HJSh2SxE70+jUbuUo7UU+Y2BAwMfMS6K7UjHC69KdornykWMTpweJwF8aa4hDPAsaH gmlPfpUFKukILJnHicY13EiGPVk4UGdnXtMclVJ1wUll6We9qIbAyLQP3PTgYP+wagfs Tpew== X-Gm-Message-State: AOJu0YxkwIhbkLPEPAV9lG/+jeHJHZ2cKOcbgPLcTxUbcaLo3pp5MdsD w4/5DV3M49ylzT0fEMNrmGRnYTwIs4uT50EpySnJcrr9QbvoC4fol8hF/3wrmg== X-Gm-Gg: ASbGncvMSvbTJWAY72XeOHP1OLl7JaAP5ta9mAZPsrzCHPGwh8T8hHzmcHDzm2sVL3l QgeIcgRSi30eV4WmkjACd4LOuqiH/y4RKIPrtIO7gBOHN6IDbk74h/t0w1ukmhK0gk3pY6ipstg YZewPVSH01cIsF3TxAqjdBnoMVIINm8Q9ygnrpNRFYbZ/AMcd8wH4BnCaZU9sDhYWt0FiN01sCA m/AgIgO6bpW9fofBpr2ZyU5Z44p3w3YyNCUt3aMoCYBhK0S9+S4ErUKblDODR9hEjs+g7UuugUR HOxGcPH6WpkUyWyk7s+hKIrD6MUR8YmXNCDnOVIYuJLYbTpBKtEIG7WqQK+6Aec= X-Google-Smtp-Source: AGHT+IGRBv5mzLz+TaYIC1nSRw+nXQCFkeTb9sZHJGFEjNNNnanSWXXIZceGOmxHAyhjWTt4xpiDJw== X-Received: by 2002:a05:6000:3108:b0:3a3:6eb9:6064 with SMTP id ffacd0b85a97d-3a4c15087demr6723402f8f.17.1748106805857; Sat, 24 May 2025 10:13:25 -0700 (PDT) Received: from localhost ([2a0c:5a85:d10d:400:c3bc:fe9a:3b9b:8351]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442ebd46aa4sm251795235e9.1.2025.05.24.10.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 May 2025 10:13:25 -0700 (PDT) From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Date: Sat, 24 May 2025 19:12:35 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=sergio.pastorperez@gmail.com; helo=mail-wm1-x32e.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 * guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list of channels to pull. Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0 --- guix/scripts/pull.scm | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 76aed0b5cc..61a68b8d70 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -839,21 +839,41 @@ (define (validate-cache-directory-ownership) (define-command (guix-pull . args) (synopsis "pull the latest revision of Guix") - (define (no-arguments arg _) - (leave (G_ "~A: extraneous argument~%") arg)) + (define (filter-channels channels names) + "Filter CHANNELS whose name symbol is present in NAMES list. +If NAMES is an empty list, don't filter anything. Warn when a name is not +available in the channels list." + (if (null? names) + channels + (let ((available-names (map channel-name + channels))) + (for-each (lambda (name) + (unless (member name available-names) + (warning (G_ "Channel '~a' not present in channel list~%") + name))) + names) + (filter (lambda (ch) + (member (channel-name ch) + ;; A channel named guix must always be present. + (cons* 'guix names))) + channels)))) (with-error-handling (with-git-error-handling (let* ((opts (parse-command-line args %options - (list %default-options) - #:argument-handler no-arguments)) + (list %default-options))) (substitutes? (assoc-ref opts 'substitutes?)) (dry-run? (assoc-ref opts 'dry-run?)) (profile (or (assoc-ref opts 'profile) %current-profile)) (current-channels (profile-channels profile)) (validate-pull (assoc-ref opts 'validate-pull)) (authenticate? (assoc-ref opts 'authenticate-channels?)) - (verify-certificate? (assoc-ref opts 'verify-certificate?))) + (verify-certificate? (assoc-ref opts 'verify-certificate?)) + (selected-channels (filter-map + (match-lambda + (('argument . name) (string->symbol name)) + (_ #f)) + opts))) (cond ((assoc-ref opts 'query) (process-query opts profile)) @@ -877,7 +897,8 @@ (define-command (guix-pull . args) (ensure-default-profile) (honor-x509-certificates store) - (let* ((channels (channel-list opts)) + (let* ((channels (filter-channels (channel-list opts) + selected-channels)) (instances (latest-channel-instances store channels #:current-channels