From patchwork Sat May 24 21:22:01 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: 42909 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 0352527BC4A; Sat, 24 May 2025 22:24:32 +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 72DF727BC49 for ; Sat, 24 May 2025 22:24:30 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uIwLg-0002kO-Ss; Sat, 24 May 2025 17:24:08 -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 1uIwLf-0002kA-9k for guix-patches@gnu.org; Sat, 24 May 2025 17:24: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 1uIwLd-0007tB-RE; Sat, 24 May 2025 17:24:05 -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:In-Reply-To:References:Subject; bh=aawEU7QOFC+tmxP6JQHDDyu9x1YmCTSQcVdYtZJof98=; b=VrNYTUU0LTzWLdr7ssLhMHM9E48Mlasefsx50WQH+r4Z6BL69qo+QZsNxqGAYXuKoJ7lAWZqff32klGbHeoRQBjL4gz4HV1pDnAkX1ZKFWN4eI5X8Dkq1Tie4Jms/ErxZNFihdWn4CZJ6s9d9Cf+EeWdSEB5H1kAhZ9reTOaENRcuM4beQkj88Hv60hwzgezNSZdV5cLr5yMhiOo5IvxqqVspgN/+DQzwu9J1ikD5W/ytfVHQSP69BQ9wGKDvyN0MDwmUIivHhMZlt1PblrRsPJCGDaVHrjrEIwfVL+oKTu0ZPNPjnCumQzC9EKDrutBfVhMCZ08mla3zRF6/g+c7A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uIwLa-00005V-Dc; Sat, 24 May 2025 17:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78580] [PATCH v2] pull: allow filtering which channels to pull from the CLI References: In-Reply-To: Resent-From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Original-Sender: "Debbugs-submit" Resent-CC: sergio.pastorperez@gmail.com, guix@cbaines.net, gabriel@erlikon.ch, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 24 May 2025 21:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78580 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78580@debbugs.gnu.org Cc: Sergio Pastor =?utf-8?b?UMOpcmV6?= , Sergio Pastor =?utf-8?b?UMOpcmV6?= , Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Sergio Pastor =?utf-8?b?UMOpcmV6?= , Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 78580-submit@debbugs.gnu.org id=B78580.174812178732560 (code B ref 78580); Sat, 24 May 2025 21:24:02 +0000 Received: (at 78580) by debbugs.gnu.org; 24 May 2025 21:23:07 +0000 Received: from localhost ([127.0.0.1]:36868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uIwKg-0008T5-Jj for submit@debbugs.gnu.org; Sat, 24 May 2025 17:23:07 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52712) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uIwKe-0008Ry-8e for 78580@debbugs.gnu.org; Sat, 24 May 2025 17:23:04 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-442d146a1aaso11757185e9.1 for <78580@debbugs.gnu.org>; Sat, 24 May 2025 14:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748121777; x=1748726577; darn=debbugs.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=aawEU7QOFC+tmxP6JQHDDyu9x1YmCTSQcVdYtZJof98=; b=kdbaUaRQBIfv7TmcjRtV3nmStY9E7PTf6NMzZPvwCno/QZGA2eqDgKzw4R7ZEjXfX/ LkbM8GTSXuIlqIpfbMPWsGa7vI5TpDm2rGc6etU4hJT5jXL8RibG4utUTa/GblDKuU+9 mzLFeJ2plAsIy4UhZd0QsbK/9M4bnIrkOJ2tyDpoVMgVNxsAZYUfe7V2oKu9KjW6abZG UcLc7BvXkfU2SDooKJDBhF+2QCwZ1NBx1IgbasQBCrCnjYvevKTAUMM4Dg/sMTdV3am8 7v+kYGlletxzoJCuDJvWWigzjPVXdMVCiLfkt1FjU2cicOJOO2xBkx6YKh0TXzPEFBy6 Go5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748121777; x=1748726577; 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=aawEU7QOFC+tmxP6JQHDDyu9x1YmCTSQcVdYtZJof98=; b=pN9/ZY3pUFH3Y5zgc5B9yQOz/8w48pIvL5KdzfnYKhN8bvsfDwATWbFJCoNwW1BTLD 7BBywjj8mEvMJ1YtBUqNrK3PVnmY1aVTWjUYEOoiYJRaGOrybzZ84CrOWwrzR7zPHFyZ INfI8jF0VHFPtkzWmVKJ0ShJ5QZjJ3XpXnhpG3wT7fDcjp5hDAczIF4iasuWVsey0mYx 1GKzBPtIbjJm4Pqg0RdXp43I0nPKyvBXST1/Tv5EglVgKVgfYJ1sfcosQcUiTEPwXv8Q KpO9d1eBDNvYGknb6egZGZEn72iOrP1czg2n7wN3ef0JmJISptL/emK57M0sKLMp72xO XSRw== X-Gm-Message-State: AOJu0Yxu/w6uwgh8JyKGR+xsV67z+wrdyDNd+SUEgaCD1GMtU9i1XyU4 GHCHg2LBwn9uG5lvz+NRE6cQmtJZp8030eqwFgj9d7f4oDTC32/VXwdt8MTN5A== X-Gm-Gg: ASbGncu5ymFe0lXt5fYYu4lxkxknK4Oq/OqDJVhdFpqCRJznD9KAqPvg057GcFpNQBi lAhA6YmL87B71PHCj7+1eJ6pYNVqqSBgdHBzNeuvo32kn08Or7qnRZ2o4ktVu0qzf19WcHTQ6ZM x3XQZZNOIm9YrZ/K879sLNa3P1e8+T4VHdq5E2I6lKbNGahPcnSYRg2RcH0RrO1UsZXA9aswqg6 9/WfYI2wIDgzRoWkqkhdTW2E6WmTuu+DV9lEh5Lis+0Bj8F7EIUBNNnrEU4FavzcHwujGwFgu7Q 92x5bbHcC/+qUbh74CweMOOeQAMU8mKYVD+qsOfstgJcRTuJTOmjT5jK6o3wo+Xo0niquw8bNQ= = X-Google-Smtp-Source: AGHT+IEVWdwJL/B6PXawvAK0HAr4O75Rtv+demGOJF7gPH9rT6mSAmRJ7ZiQb0jQiTUmgAqUTH+Tdw== X-Received: by 2002:a05:600c:1385:b0:43d:3df:42d8 with SMTP id 5b1f17b1804b1-44c93da7c08mr28789665e9.6.1748121777338; Sat, 24 May 2025 14:22:57 -0700 (PDT) Received: from localhost ([2a0c:5a85:d10d:400:c3bc:fe9a:3b9b:8351]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a35ca4d263sm30140420f8f.3.2025.05.24.14.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 May 2025 14:22:56 -0700 (PDT) From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Date: Sat, 24 May 2025 23:22:01 +0200 Message-ID: <24f41b12012dc5551391f516b8dc3088563db9b5.1748121721.git.sergio.pastorperez@gmail.com> X-Mailer: git-send-email 2.49.0 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 * guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list of channels to pull. Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0 --- doc/guix.texi | 11 +++++++++-- guix/scripts/pull.scm | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 10 deletions(-) base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d diff --git a/doc/guix.texi b/doc/guix.texi index e4e2b853f1..e3de7ce47b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4656,8 +4656,15 @@ Invoking guix pull deleting /var/guix/profiles/per-user/charlie/current-guix-1-link @end example -The @command{guix pull} command is usually invoked with no arguments, -but it supports the following options: +The general syntax is: + +@example +guix pull [@var{options}] [@var{CHANNELS}@dots{}] +@end example + +The optional @var{channels} argument filters the list of pulled channels +to those whose names match the given list. The channel named @dfn{guix} +is always pulled. @table @code @item --url=@var{url} diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 76aed0b5cc..677df965bb 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -81,8 +81,13 @@ (define %default-options (validate-pull . ,ensure-forward-channel-update))) (define (show-help) - (display (G_ "Usage: guix pull [OPTION]... -Download and deploy the latest version of Guix.\n")) + (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...] +Download and deploy the latest version of Guix. + +If CHANNELS are specified, pull only from channels with those names (e.g.: +'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix' +channels as defined in your channel configuration). +The channel named 'guix' is always pulled.\n")) (display (G_ " -C, --channels=FILE deploy the channels defined in FILE")) (display (G_ " @@ -839,21 +844,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 +902,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