From patchwork Wed Jun 4 21:23:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Sergio_Pastor_P=C3=A9rez?= X-Patchwork-Id: 43013 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 91EC427BC4A; Wed, 4 Jun 2025 22:25:43 +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 4954627BC49 for ; Wed, 4 Jun 2025 22:25:41 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMvby-0006NX-La; Wed, 04 Jun 2025 17:25:26 -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 1uMvbx-0006NJ-3W for guix-patches@gnu.org; Wed, 04 Jun 2025 17:25:25 -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 1uMvbh-0005aq-OF; Wed, 04 Jun 2025 17:25:17 -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=pZoEaOC04vQm1LwlXFMcFJIrWRkJ8g/iaLVNkkoCVyQ=; b=aeLJzCPtnbdZ6aUD78V9kSBmGewfYmHV6ZYOMQmzMLAPhwJaUzuvz6sc9onBHO214EaKbNSBbLYxk1QI9e7o2l2fW+rDtIcHZS67eeOf0WYGmxBJlLpUcbcMELb6AfO0Y/eKx4FiRrOPboyxSg1PJLqs6MPCgH2WhJPF8sMcl+0W1YdBIozx0i3E5Ya1RCNdvmqAETPHLsr+eI7t1V5DHSw6gDrtfgQT+BRwKtfEPE3fuYDlru2iP4FwElawfhJZbvXyFwq09YHVwZHqRuLMPOc22+eSy/yQc1e6xnAG4kzLTlvcnqfBfOwKGoll93EmfnUae/Dj/cvFJFbuAGM40Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uMvba-00052S-VA; Wed, 04 Jun 2025 17:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78580] [PATCH v5] 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, ludo@gnu.org, guix@cbaines.net, gabriel@erlikon.ch, dev@jpoiret.xyz, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Wed, 04 Jun 2025 21:25: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 , Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Gabriel Wicki , Josselin Poiret , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Sergio Pastor =?utf-8?b?UMOpcmV6?= , Sergey Trofimov , Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Gabriel Wicki , Josselin Poiret , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 78580-submit@debbugs.gnu.org id=B78580.174907224719141 (code B ref 78580); Wed, 04 Jun 2025 21:25:02 +0000 Received: (at 78580) by debbugs.gnu.org; 4 Jun 2025 21:24:07 +0000 Received: from localhost ([127.0.0.1]:53775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uMvaf-0004yb-Nz for submit@debbugs.gnu.org; Wed, 04 Jun 2025 17:24:07 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:42020) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uMvac-0004xP-Dm for 78580@debbugs.gnu.org; Wed, 04 Jun 2025 17:24:03 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3a4fd1ba177so274738f8f.0 for <78580@debbugs.gnu.org>; Wed, 04 Jun 2025 14:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749072235; x=1749677035; 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=pZoEaOC04vQm1LwlXFMcFJIrWRkJ8g/iaLVNkkoCVyQ=; b=CZ2dulgok0adwS1DLNNP+xNpPRLmaT1AuyBJ4psE7L22dh5bpYVhs5TkvnwD/pLvTa B53p7aWPDoYOK7f1n4gwQMyyRqZeJgGaKOcTAaH46JhjxjGeSYf5wZllAINDOoqSean/ /TAXx9HI4XmYVTdCB0joD84rqRNi+sUK7IbnOg06BG7Kf+MB+DebS2qcJQNit99WyLbf c2XCdizlC3zocD31qzwj8TomJn/bf9xRB9PfLXr2HuDAj6/kN1wV4MGyKVxPqHTADlM9 MmzKKtbeJGUynNNkeWdw//5qSHjgQ1HnZ2KFHx6y7ECepUmaPOtcmqazksJb7PocsBUg XcfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749072235; x=1749677035; 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=pZoEaOC04vQm1LwlXFMcFJIrWRkJ8g/iaLVNkkoCVyQ=; b=UCk9pr8SemaMU4rkClSNrpnqM/BlOGJvCKNdho4tK+i8IdSzR8Gs4amcaU2mQ5BRJr 3KRlMifUXVR5Y8O/7XQK73c0eeI38zMFvUCtN1L5PTrAaxsfItzI/K6/dxA+kZs46byW S9WKqNx2pa85zDiBrZ2I3uZdk7oykVHRNiP49r4jVtcBJtJrmNSDCDInRTVo2VOSPcsH wgz7w44ZtDQzNLX6RtLNNbBGLmeGIw2eAmPizp47ik8x4O1ULHrogNfAkt2VyR+P0Xr/ lIOWqmD6ZUF2Jwksqof9MutZG0/C32KjR1Wc28QTfoD8MQQ5OUeN/ci8pAlw1z7jaRoE /HxQ== X-Gm-Message-State: AOJu0YwNmP2nrJZwaf8ScrlLoowI3sd65Txohw3A75fJX1YBVeA13/Ou /iOII4otpSbtfsnVxZBF76NT0VzVm6nXwOsXiY4M2Wm2BH1offnabDiCvfh1nA== X-Gm-Gg: ASbGncv0MkR13GMURpbduF15vqURqqdVcF7P31tEIhN8nC/McDyBnLkfhIN6aXEj7em OX/Ikn0xjpebR7BTpO+pIOA1ZYceGXbGAF3ZWBGzg7LI8HJtUjHNRRxbF6Pqu7SvtR7JYr8rgIc UuZC/8dK3yVU15qTBXZ0tIlthcrvSlSuiTDFUWMchVNHf8SRjb2RPM4le8NdQa0HKQUMvHCgTkq +byKqjhPOr9XMFGpeLdglM3WSXQJSBAXvDo54BjtOLcXXwfkBu5xIqZQAFrC7aH7X6Osn77fbsu du16htYNUQHQHojK3aH/aQf43oTkmnYAdAdHuAoNUVnhVyE7P5uqb1rfgtpWpm7LnQo/zqdGHg= = X-Google-Smtp-Source: AGHT+IGs2cHdNLD27Hc0IvB9uQZreD6UuH6DU2MKaddS04z31VdFj9MaA0svazwxlLMjUtusHPOoHA== X-Received: by 2002:a05:6000:18a5:b0:3a4:eee4:cdec with SMTP id ffacd0b85a97d-3a526dc53f4mr840413f8f.6.1749072235298; Wed, 04 Jun 2025 14:23:55 -0700 (PDT) Received: from localhost ([2a0c:5a85:d10d:400:c3bc:fe9a:3b9b:8351]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-451f9924a4csm2888055e9.39.2025.06.04.14.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jun 2025 14:23:54 -0700 (PDT) From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Date: Wed, 4 Jun 2025 23:23:32 +0200 Message-ID: <6585e1648c9bf6f468d3c161c81406597e13327c.1749072212.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. * doc/guix.texi (guix pull): Document new command syntax and behavior for filtering pulled channels by name. Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0 --- doc/guix.texi | 18 ++++++++++++++-- guix/scripts/pull.scm | 50 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 10 deletions(-) base-commit: ed5988f0d2cf14e3cc35a32e6ad91d7cbf535e2f diff --git a/doc/guix.texi b/doc/guix.texi index 5fefba3634..b6d7461f34 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4656,8 +4656,22 @@ 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. + +For example, given a list of channels with names A B C: + +@example +guix pull A B +@end example + +would update channels A and B while keeping C unchanged. @table @code @item --url=@var{url} diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 76aed0b5cc..3d8e613171 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2013-2015, 2017-2024 Ludovic Courtès ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice +;;; Copyright © 2025 Sergio Pastor Pérez ;;; ;;; This file is part of GNU Guix. ;;; @@ -81,8 +82,8 @@ (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, possibly limited to CHANNELS.\n")) (display (G_ " -C, --channels=FILE deploy the channels defined in FILE")) (display (G_ " @@ -839,21 +840,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)) + ;; Unpin CHANNELS whose name symbol is present in the NAMES list. If NAMES + ;; is an empty list, do not filter anything. Warn if a name is not available + ;; in the channels list. + (define (unpin-channels channels current-channels names) + (if (null? names) + channels + (let ((available-names (map channel-name + channels)) + (selected-channels (filter (lambda (channel) + (member (channel-name channel) + names)) + channels))) + (for-each (lambda (name) + (unless (member name available-names) + (warning (G_ "channel '~a~' selected but missing from channel list~%") + name))) + names) + + (map (lambda (channel) + (let ((selected-channel (find (lambda (ch) + (eq? (channel-name ch) + (channel-name channel))) + 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 + channel))) + 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 +909,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