From patchwork Sun May 25 08:20:17 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: 42913 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 88C4927BC4C; Sun, 25 May 2025 09:21:33 +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 D4D5D27BC49 for ; Sun, 25 May 2025 09:21:32 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uJ6bi-0004qs-HF; Sun, 25 May 2025 04:21:22 -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 1uJ6bd-0004qZ-OA for guix-patches@gnu.org; Sun, 25 May 2025 04:21:18 -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 1uJ6bV-0001en-P1; Sun, 25 May 2025 04:21:16 -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=JvcG4Jt6cMIGek6CbOx41UmNOZ9Qk+85DJUfY4oKVsM=; b=B7IASu+x3dIytqspySlKaNxa5EhiKsRZnt/YGm3XQC0g6SUX1PmBO7mQ2nPEUoFRt2iiyU9gDUgCy416j+kFmAEQn6KRahE7jVgQRwghOsR3KrSo1BxRHecREvXmmeabeJNeqmqlR/Bw6PrOPlYFMx3Wm8e2OoAfh9XGj1pmRbdluC1bIbyAL7z66o5CylJLEPH1VwUTazZXguSEuxZz8McNyg+fBDVmTON4q/M3P0DYu6TFezkd87frvqsvwPZB84VdUnC5j0yFdUvufJen1gtcA0EYBhrwJlHcZKpHWqhl0nonM6jEKSbuVAIVsF3ysV/iOYmVb3T/+6bTOH71YQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uJ6bO-00015q-1N; Sun, 25 May 2025 04:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78580] [PATCH v3] 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 08:21:01 +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.17481612594174 (code B ref 78580); Sun, 25 May 2025 08:21:01 +0000 Received: (at 78580) by debbugs.gnu.org; 25 May 2025 08:20:59 +0000 Received: from localhost ([127.0.0.1]:42052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uJ6bK-00015G-L2 for submit@debbugs.gnu.org; Sun, 25 May 2025 04:20:59 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:44437) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uJ6bI-00014q-Eo for 78580@debbugs.gnu.org; Sun, 25 May 2025 04:20:57 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3a4d33f971aso324837f8f.1 for <78580@debbugs.gnu.org>; Sun, 25 May 2025 01:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748161250; x=1748766050; 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=JvcG4Jt6cMIGek6CbOx41UmNOZ9Qk+85DJUfY4oKVsM=; b=DCx0hR4wxVL562BSNvZrLiOSNmjruiH4484TuyeynfrJaT2ewn5AoJb/CsNrQB2yKW 1plMVUKnhuovAvq8dnwLkgJ20EZ5/xkJxRHVgq4Al77qVyjK3tvscZQSD9XcbrKPU9dq iCKOVK7mAp7DfiFUs0YfhS3g/wXD+iEGGUdT2TuFnzyVemyVIkoVYpUr1trdqEgUeyGM sv1ukzy93cO9RkVrh9ojR/dpjXvO0eg+45qBZswqUtih1XdW2oXh8NwV/kLgsc46U5Jd BR7Hl9W66Jfp+yjW5P6mWuXXqcBEObY67HZhd+4su2D5Q5P/kmVnu2dfaxtrgufGWKEq XsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748161250; x=1748766050; 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=JvcG4Jt6cMIGek6CbOx41UmNOZ9Qk+85DJUfY4oKVsM=; b=icpdTUgVQ5Lf1K/f1IxN+FYNVr8BKyG+bBFC2cU5pz8TOxtZu5Q7XehxKq7tVIoN/V GtzIT50k2/gp+uiO4Kf1vUyQeGpicJ3OcbtD8ltSf0hesKvxJ1H2KAZeq98h2phExsqY b2mrRn9MocmUckwoIwXNVuugOHMFvifsYVStx3jYi7e9lY/ibeMSiIHOcSg4b8TfZ0kB ZkozIayvZB0pqP1Ya5XZl+RkC7lzJRxmMmGiGfBJIZZwfsiQDUwVwrEl6XatPLcqCdvc LKxU4xwdjeuGH5PEdQuiPBEfJrmhrTx9c42ihiyrEn45SrokA18xYJ4YFzbtg8bJoaNp gd9g== X-Gm-Message-State: AOJu0YyXHsGqxvUJGz4MOLM4z5YPaVq1AgWst4NxysdVMGEBo8gK8w1R L9zCRUTepohNpXJPGeeaReOmGfBig3hAEXETy+4ashfw5gXS3BAEy2WicEf/P0Ce X-Gm-Gg: ASbGncuf3OicaFFK5qHbueND58D6/YqoZ4kiMT1nvmMUKkFbMXiBaGGbmkNDWqj4g08 rvOmraczJZr7ETJPwqCIoEBHHwgg9IDORbtFj6rfInJf6BlWKKn5YhIy75wdyMJBEQrKmwnRWab AljQ4VUaTNflf262KEyN3aYf8sYq8J/vZYdGoVrDhSLTCYitWL63A91u3hX5Fxvk+yDSS86PoO3 sKWtoxdpa4YArWiybS61OD7olhN7JGhiM9DU4T3E2jeJDaRU0Tc1LtVunoq6EBDxBk2+YgQ16OZ Tlx2scL7xQFhXw2iyF9dYx/3lyZh9W8vrRK5phfCP5AzB93CA/JLIu5mub8FmVbMRZ6daCt9Mg= = X-Google-Smtp-Source: AGHT+IG1ekIwOSexz2NwNEZzwcGiGPXI+fRFALTbVbmeO6Ku4KEQTqzo9fFztQaFnEFZMnE4Q88y6g== X-Received: by 2002:a05:6000:2f88:b0:3a4:d0c7:312b with SMTP id ffacd0b85a97d-3a4d0c73a6emr2689866f8f.26.1748161249614; Sun, 25 May 2025 01:20:49 -0700 (PDT) Received: from localhost ([2a0c:5a85:d10d:400:c3bc:fe9a:3b9b:8351]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442ffaa75cfsm191064265e9.1.2025.05.25.01.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 May 2025 01:20:49 -0700 (PDT) From: Sergio Pastor =?utf-8?b?UMOpcmV6?= Date: Sun, 25 May 2025 10:20:17 +0200 Message-ID: <73fbe44376bf6ce0957da5069cb5f27ef4fb9839.1748161217.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 | 52 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 52 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..8da7ec7ac4 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,51 @@ (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 current-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) + (let ((program (car (command-line))) + (current-guix (find (lambda (ch) + (eq? (channel-name ch) 'guix)) + current-channels)) + (selected-channels (filter (lambda (ch) + (member (channel-name ch) + names)) + channels))) + ;; The guix channel must always be present. + (if (member 'guix names) + ;; If the guix channel is selected, let it pull. + selected-channels + ;; If the guix channel is not, pin it. + (cons* current-guix + selected-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 +911,9 @@ (define-command (guix-pull . args) (ensure-default-profile) (honor-x509-certificates store) - (let* ((channels (channel-list opts)) + (let* ((channels (filter-channels (channel-list opts) + current-channels + selected-channels)) (instances (latest-channel-instances store channels #:current-channels