From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id MO04Hebz3WSZKwAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 12:18:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qAocHebz3WSjEQEAauVa8A (envelope-from ) for ; Thu, 17 Aug 2023 12:18:14 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6C35759528 for ; Thu, 17 Aug 2023 12:18:13 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HEi0M28h; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692267494; a=rsa-sha256; cv=none; b=aX7fOm3qCfM/UvaEiVIciqL7/xXpoQz/TWXRsI1rRM62Cie8C0XbTn6Wk+oPGUmiL+90EA A2Qy4XkPdiXbcfz4M+Lbu+XENmbXT5WEUINg+IthdwyUDS/kE9mw1ReOIC02xPrwY2xKqb kp3nRAZub9AIzdOXPL1kzR8cni27YQy6lKW05unoZcPf01F8UGvY1wW+hLCfuWgxTXFRO4 bf8Ucb0YC/bJXdfh1ZKNmk3vPoSUmNRPjY8fHjXZAToJwh4t4gNGFZiC3G3p3WONA/6XTP UtpPhvUJ97HlIq/+Tkacyp1Int3bvAdmnk7lPXzoEdn1Qryn3KRfDx2fEMLFyQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HEi0M28h; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692267494; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=UsNaWrHkHvq2DGiBtv4CJgFaBdffIekK95+sMIK99tg=; b=apBUEWPhhV0yUjS9FzGGWPwBtllyUbn9DBZD/xkZu4BcIGv8smwKq2GV5ZG0LfvsZHwVVG FNINO6O4nK54tggEXsFst871OfHzOMTyd2+hNqdLlq65Yvqz9UMWI1cLvzDBkYgoT85lBh yErggQUiVvOFnKg5eZl+vXyQDqoYECmA5q9AMnK0310vVqsCzCsxJcau0X0U8HTumWflmC Bh5OUTebhu7XTrpN4xnjErUvxzJjZJ6XfKxl9FvSWFQrxbxXSyaYr5q6N2w7GaMubZcBax Msm6q4c9gX/Ubu/ZAv5JGbEP5Aa8zmHKRl3DF9VEGewsf9Ba5sx0sr8i9I/Aww== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWa4u-00069e-Kt; Thu, 17 Aug 2023 06:18: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 1qWa4t-000690-40 for guix-patches@gnu.org; Thu, 17 Aug 2023 06:18: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 1qWa4s-0003T0-4G; Thu, 17 Aug 2023 06:18:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWa4n-0001CY-Oi; Thu, 17 Aug 2023 06:18:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65229] [PATCH v2 2/2] pull, time-machine: Add '-q' to ignore channel files. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 10:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65229 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65229@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Simon Tournier , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 65229-submit@debbugs.gnu.org id=B65229.16922674734598 (code B ref 65229); Thu, 17 Aug 2023 10:18:01 +0000 Received: (at 65229) by debbugs.gnu.org; 17 Aug 2023 10:17:53 +0000 Received: from localhost ([127.0.0.1]:42811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWa4e-0001C4-C2 for submit@debbugs.gnu.org; Thu, 17 Aug 2023 06:17:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWa4b-0001Bl-Rh for 65229@debbugs.gnu.org; Thu, 17 Aug 2023 06:17:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWa4W-0003J8-Lt; Thu, 17 Aug 2023 06:17:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=UsNaWrHkHvq2DGiBtv4CJgFaBdffIekK95+sMIK99tg=; b=HEi0M28h/AksKaR012nv aPYIC961Njxdqh4nwWeWdG0QzUaHzRAgYFog2XWkyMNzeigPu5JfJ/Svw4OnOaweDkZLeASacdqmQ 0fZ3YSF2LupU3F2Epq699NAjEDjMHgnBW5HlvrUWcE0CAfejs1aDG2+qPqHofGRNUG7xJL+PmW9Ly smnrDp+YvPhEaW8HYs12lMSEQcfgtIcjh5U7AYxzKF1HscCpf5homnfEFgACOzkWrZkWn/9HNOcLL kJcjPfSiwjT/qyNKOLTfHiT8HUl+PQBD1YwzFxQilVUcbMkkA7FRGm88MDORg9YMGMgFw0WCYn142 MdD83YKHchGMUw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 17 Aug 2023 12:17:29 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <875y5eyrl0.fsf@gnu.org> References: <875y5eyrl0.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 6C35759528 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -1.39 X-Spam-Score: -1.39 X-TUID: Xm4zOpS4DEZS From: Ludovic Courtès This also fixes . * guix/scripts/pull.scm (show-help, %options): Add '-q'. (channel-list): Honor it. * guix/scripts/time-machine.scm (show-help, %options): Add '-q'. * doc/guix.texi (Invoking guix pull, Invoking guix time-machine): Document it. Reported-by: Simon Tournier --- doc/guix.texi | 47 +++++++++++++++++++++++++++-------- guix/scripts/pull.scm | 15 +++++++++-- guix/scripts/time-machine.scm | 8 +++++- 3 files changed, 57 insertions(+), 13 deletions(-) Changes since v1: • Add ‘--no-channel-files’. • Join the two ‘time-machine’ examples, the one without ‘-q’ and the one with ‘-q’ (I realized there was already one example without ‘-q’ so I figured it was easier to clarify ‘channels.scm’ handling upfront). • Document the <(echo %default-channels) trick. Let me know what you think! Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 633d62bd98..2d54b92fa5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4802,9 +4802,11 @@ Invoking guix pull @item the @option{--channels} option; @item -the user's @file{~/.config/guix/channels.scm} file; +the user's @file{~/.config/guix/channels.scm} file, unless @option{-q} +is passed; @item -the system-wide @file{/etc/guix/channels.scm} file; +the system-wide @file{/etc/guix/channels.scm} file, unless @option{-q} +is passed; @item the built-in default channels specified in the @code{%default-channels} variable. @@ -4906,6 +4908,11 @@ Invoking guix pull evaluates to a list of channel objects. @xref{Channels}, for more information. +@item --no-channel-files +@itemx -q +Inhibit loading of the user and system channel files, +@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}. + @cindex channel news @item --news @itemx -N @@ -5051,7 +5058,9 @@ Invoking guix time-machine environment -C --ad-hoc guile -- guile @end example -The command above fetches Guix@tie{}1.2.0 and runs its @command{guix +The command above fetches Guix@tie{}1.2.0 (and possibly other channels +specified by your @file{channels.scm} configuration files---see +below) and runs its @command{guix environment} command to spawn an environment in a container running @command{guile} (@command{guix environment} has since been subsumed by @command{guix shell}; @pxref{Invoking guix shell}). It's like driving a @@ -5061,6 +5070,21 @@ Invoking guix time-machine large number of packages; the result is cached though and subsequent commands targeting the same commit are almost instantaneous. +As for @command{guix pull}, in the absence of any options, +@command{time-machine} fetches the latest commits of the channels +specified in @file{~/.config/guix/channels.scm}, +@file{/etc/guix/channels.scm}, or the default channels; the @option{-q} +option lets you ignore these configuration files. The command: + +@example +guix time-machine -q -- build hello +@end example + +will thus build the package @code{hello} as defined in the main branch +of Guix, without any additional channel, which is in general a newer +revision of Guix than you have installed. Time travel works in both +directions! + @quotation Note The history of Guix is immutable and @command{guix time-machine} provides the exact same software as they are in a specific Guix @@ -5093,18 +5117,21 @@ Invoking guix time-machine Read the list of channels from @var{file}. @var{file} must contain Scheme code that evaluates to a list of channel objects. @xref{Channels} for more information. -@end table -As for @command{guix pull}, the absence of any options means that the -latest commit on the master branch will be used. The command +@item --no-channel-files +@itemx -q +Inhibit loading of the user and system channel files, +@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}. + +Thus, @command{guix time-machine -q} is equivalent to the following Bash +command, using the ``process substitution'' syntax (@pxref{Process +Substitution,,, bash, The GNU Bash Reference Manual}): @example -guix time-machine -- build hello +guix time-machine -C <(echo %default-channels) @dots{} @end example -will thus build the package @code{hello} as defined in the master branch, -which is in general a newer revision of Guix than you have installed. -Time travel works in both directions! +@end table Note that @command{guix time-machine} can trigger builds of channels and their dependencies, and these are controlled by the standard build diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index ecd264d3fa..3a8dd6ea01 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -84,6 +84,9 @@ (define (show-help) Download and deploy the latest version of Guix.\n")) (display (G_ " -C, --channels=FILE deploy the channels defined in FILE")) + (display (G_ " + -q, --no-channel-files + inhibit loading of user and system 'channels.scm'")) (display (G_ " --url=URL download \"guix\" channel from the Git repository at URL")) (display (G_ " @@ -133,6 +136,9 @@ (define %options (cons* (option '(#\C "channels") #t #f (lambda (opt name arg result) (alist-cons 'channel-file arg result))) + (option '(#\q "no-channel-files") #f #f + (lambda (opt name arg result) + (alist-cons 'ignore-channel-files? #t result))) (option '(#\l "list-generations") #f #t (lambda (opt name arg result) (cons `(query list-generations ,arg) @@ -735,6 +741,9 @@ (define (channel-list opts) (define file (assoc-ref opts 'channel-file)) + (define ignore-channel-files? + (assoc-ref opts 'ignore-channel-files?)) + (define default-file (string-append (config-directory) "/channels.scm")) @@ -750,9 +759,11 @@ (define (channel-list opts) (define channels (cond (file (load-channels file)) - ((file-exists? default-file) + ((and (not ignore-channel-files?) + (file-exists? default-file)) (load-channels default-file)) - ((file-exists? global-file) + ((and (not ignore-channel-files?) + (file-exists? global-file)) (load-channels global-file)) (else %default-channels))) diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm index d7c71ef705..fa12e6f170 100644 --- a/guix/scripts/time-machine.scm +++ b/guix/scripts/time-machine.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Konrad Hinsen -;;; Copyright © 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2019, 2020, 2021, 2023 Ludovic Courtès ;;; Copyright © 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. @@ -51,6 +51,9 @@ (define (show-help) Execute COMMAND ARGS... in an older version of Guix.\n")) (display (G_ " -C, --channels=FILE deploy the channels defined in FILE")) + (display (G_ " + -q, --no-channel-files + inhibit loading of user and system 'channels.scm'")) (display (G_ " --url=URL use the Git repository at URL")) (display (G_ " @@ -75,6 +78,9 @@ (define %options (cons* (option '(#\C "channels") #t #f (lambda (opt name arg result) (alist-cons 'channel-file arg result))) + (option '(#\q "no-channel-files") #f #f + (lambda (opt name arg result) + (alist-cons 'ignore-channel-files? #t result))) (option '("url") #t #f (lambda (opt name arg result) (alist-cons 'repository-url arg -- 2.41.0