From patchwork Sun May 25 10:55:02 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: 42914 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 A7F5427BC4C; Sun, 25 May 2025 11:56:36 +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 B693527BC49 for ; Sun, 25 May 2025 11:56:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uJ91X-0007fO-Jo; Sun, 25 May 2025 06:56: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 1uJ91W-0007fE-QU for guix-patches@gnu.org; Sun, 25 May 2025 06:56:10 -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 1uJ91W-0006I9-3e; Sun, 25 May 2025 06:56:10 -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=d2jI/z4ZOJ7Q93sTYP4LtgBa44D13W9PthHb6d2uGD8=; b=QKs0SFxkTW2PR4+5NKS5OiXR8jR01HPjGiaGqT0HbauLBwsllRn9UeR1Wv1YHjIbZCXJcuDCjWll58reyxahwdrJPtR7kO6TIWNjWlenBOFiNxtk2rueVaAB8azlyWeYpSqoZewxyKfms7oiH+XnbHKJo1Nw8FoO5xpTqOPRZHJYEeiF2zs9MTs/jWGavBMbX7ZNAkiyTNI4o4fWuZEOP2dEHrrwg+2rinEEg2cwpPYkfL/NtDez2cns7T6hWFGcQ+Dguegrvm3btkwjr8lZcCu9XCTA9qMtTW89fGRY3gOGAn8RkIzcl9zKyscViBKDw/Z3HBuA8FfOS0SwGImsBQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uJ91O-0005ll-H0; Sun, 25 May 2025 06:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78580] [PATCH v4] 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, sarg@sarg.org.ru, 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: Sun, 25 May 2025 10:56: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?= , Sergey Trofimov , 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?= , Sergey Trofimov , 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.174817052522007 (code B ref 78580); Sun, 25 May 2025 10:56:02 +0000 Received: (at 78580) by debbugs.gnu.org; 25 May 2025 10:55:25 +0000 Received: from localhost ([127.0.0.1]:43353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uJ90m-0005iq-Mh for submit@debbugs.gnu.org; Sun, 25 May 2025 06:55:25 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:61884) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uJ90k-0005iD-6f for 78580@debbugs.gnu.org; Sun, 25 May 2025 06:55:23 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-442ccf0e1b3so19853725e9.3 for <78580@debbugs.gnu.org>; Sun, 25 May 2025 03:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748170515; x=1748775315; 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=d2jI/z4ZOJ7Q93sTYP4LtgBa44D13W9PthHb6d2uGD8=; b=RhRuyhDqCOQ/skAKVdU5I8nP3an3bCpmY7NkdNn2HgDsmeULHw1kDUdFOinMG2RRvU aFkA+w9wyHh0fvJBDnZmNFs30Eb/r+DEqNP144eq//Jpw9G+KU4PlTQ0b3TntKJwt4oV COag5zK631ltpiai0ACC5OVhDGJz4oDD1PtbORt3WRjVgBigWfQViPqVg8LpewX9+kzh Ru1J8M09ag7OYTWayZdH0Qkznyw2viZ/BDXEQSSL1Jw6gdRJOXcUgkx/4jDC89I1QHnl 2MVpwxwy4wxwUlarWjdFsV/NrDnyv2pN0zBk2yU8zSdrh+tYhoS6URUXJKnkXpaeEBlJ 0UjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748170515; x=1748775315; 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=d2jI/z4ZOJ7Q93sTYP4LtgBa44D13W9PthHb6d2uGD8=; b=aRAImjz2GOMqfqbBCeoxup7dacRZM+vIixrbBGbTzyKTI5rRdIz8vG/g670shYGKMO yP51piOeb06dPiuqOOwmpUxBzWMo7SLo6/y7IpSYwFxBDSc/v0OpEMD8D0Nx4DTj53Eb VlxC6I/G4IUQSaLHKMIOygFYboT77NQtzpiN6fc3GC+6epOZiU5UPBHASJ5X1TcRn7pa QQDG3tKbQ7h2VBk7VfAF7vqpWguAApkhvoVx1a6z45Dt2ZHaGBdqJRSSKmcuIOjoLieE yqhtL71Dboh8q2u1+cG4dzFaTYoexiOBELAYcmN7CPTIQewp/5jaq8e8pkkjr8TpKqAS 9BOQ== X-Gm-Message-State: AOJu0YxHS6kXKHKF4bbW7i+INp02fae+nHZUnF45VcTw486kFRF2dLiX zkLB6f4tyi0gWImUE6VpDl/pbOwheoU58dtWsDfGU2XOKNlqMT6w6szUUiwxbWBo X-Gm-Gg: ASbGnctZxkVFk2rsCchxmhQVmUqTx6VGSJ7fEBRTAAAVBT6KSgRO4aFyO/zq2g2Zwgp KjvXbKgXMDu7mJD5pum0wWjyGvpMb5+B7/KJ52CoEi9QRalvMy6moY47V+NPzCwqnmfP5BS9g/c DfxCuDI5XcTHoS4hwM7v00g+VQZ+8a/LG7ixKAtEqq9HZB8tpSjwKIdQpE9CHRpPHS1Ck7XN4tl h44ziAXn9qkRodS4eW0JJ8vHM82x/jHdaYKAkpKvDpxa30bB+CoNwTIZ2CTZTl360+cRDNbmUio nFvEk/eHcVTRIpyxp31qZAlL8y/OAHNQSeaUtUN6EeeH+rQ+XK5iy6fVJKdXg/o= X-Google-Smtp-Source: AGHT+IGfW9yioJx92jedSLOmVnbI+KIMdoSl204MskMBAE1xk79Q0lye/B59fOQ4A+imN+fi6cv3Xg== X-Received: by 2002:a05:600c:4e0a:b0:43c:f895:cb4e with SMTP id 5b1f17b1804b1-44c91dd158bmr49831945e9.17.1748170514623; Sun, 25 May 2025 03:55:14 -0700 (PDT) Received: from localhost ([2a0c:5a85:d10d:400:c3bc:fe9a:3b9b:8351]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-447f18251c7sm203889115e9.3.2025.05.25.03.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 May 2025 03:55:14 -0700 (PDT) From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Date: Sun, 25 May 2025 12:55:02 +0200 Message-ID: <47f6b899454a44acc2570a57b5fa6caaf8a47706.1748170502.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 | 10 ++++++-- guix/scripts/pull.scm | 53 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 10 deletions(-) base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d diff --git a/doc/guix.texi b/doc/guix.texi index e4e2b853f1..26f16cfa7a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4656,8 +4656,14 @@ 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. @table @code @item --url=@var{url} diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 76aed0b5cc..fc6809d68c 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -81,8 +81,12 @@ (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).\n")) (display (G_ " -C, --channels=FILE deploy the channels defined in FILE")) (display (G_ " @@ -839,21 +843,52 @@ (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 (unpin-channels channels current-channels names) + "Unpin 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)) + (selected-channels (filter (lambda (ch) + (member (channel-name ch) + names)) + channels))) + (for-each (lambda (name) + (unless (member name available-names) + (warning (G_ "Channel '~a' not present in channel list~%") + name))) + names) + + (map (lambda (cur-ch) + (let ((selected-channel (find (lambda (ch) + (eq? (channel-name ch) + (channel-name cur-ch))) + selected-channels))) + ;; If the user selected this channel. Follow channel file + ;; specification. Otherwise, leave the channel pinned as + ;; defined by the current profile. + (or selected-channel + cur-ch))) + current-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 +912,9 @@ (define-command (guix-pull . args) (ensure-default-profile) (honor-x509-certificates store) - (let* ((channels (channel-list opts)) + (let* ((channels (unpin-channels (channel-list opts) + current-channels + selected-channels)) (instances (latest-channel-instances store channels #:current-channels