From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MJYPB33AO2e+GAEAe85BDQ:P1 (envelope-from ) for ; Mon, 18 Nov 2024 22:32:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id MJYPB33AO2e+GAEAe85BDQ (envelope-from ) for ; Mon, 18 Nov 2024 23:32:29 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=TSPvSKnt; dkim=fail ("headers rsa verify failed") header.d=zancanaro.id.au header.s=k1 header.b=GWwEdzRz; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=zancanaro.id.au (policy=none); 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731969149; a=rsa-sha256; cv=none; b=GOg6r2zK/HQQ7Az/ekWanBJnAqp2pmIXDblNPwzoI4I1CBr1lwxvnGsFATq/cs1tgFBeKq v7XvzjJIADWSaMSfMQX3ca4npklpHTpZIE0jGNUTEppjQSL/gLX9bvw12z/4c6eEjfTDRu jWyWaqyP0wKspTLwVnGHaN41de93vcxyUek7XtX49vn/Tk6yOFY5f5iBYts2DNj5UT4bpq e8OWdWmJfzsmsyHT6+aocCrHBmmWZ3AzUvlXfIicu37J85LEa9A+UKUtejrnW5zYnFRG9I HJQ2th/Im74ByBtOv+LEXcbetLswBYrtYcRssgnRqCJ3Dl8j5xKhADZRLHLvyw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=TSPvSKnt; dkim=fail ("headers rsa verify failed") header.d=zancanaro.id.au header.s=k1 header.b=GWwEdzRz; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=zancanaro.id.au (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731969149; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Vhrp4Krewb2kkOi42o0mrt2OOUKtcqejlGmj7U1iq1o=; b=B3HW9qZzMWDVqcRo/1H3qHA3GR6EFYE9fXSirCfiKFxWJ/BiJKT/ClEt878V6WLKFowW9X OQTofFlzzXiAIPB5oJcaDFeWixNRGZLXMXfxKm1FVRECwCxgmjrM0TgH9/IEAgjfnCRCOj BojllBg8dcRiP8U2wkiI2iIHlbog0PmSd8EDUyVO0PKSbF0+rFReTj9iHS8sT1D1l7WN+9 gP+zs+np/EnqyY4H3HzQtSsIer3YWkF1FQKF2A7f5RAuIQk1LFbZatrLYBLTLfIFYS947p KK9LLGqDBpL2kX1Rau9Zy2qqXbH070gpDthzq1nAb0/lABnUZrRc5yX7RpU0Vg== 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 91EBE63755 for ; Mon, 18 Nov 2024 23:32:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDAHw-0000F3-9S; Mon, 18 Nov 2024 17:32:08 -0500 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 1tDAHt-0000DD-NG for guix-patches@gnu.org; Mon, 18 Nov 2024 17:32:06 -0500 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 1tDAHs-0000qV-2s; Mon, 18 Nov 2024 17:32:05 -0500 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:Subject; bh=Vhrp4Krewb2kkOi42o0mrt2OOUKtcqejlGmj7U1iq1o=; b=TSPvSKntlifCXLCT7X6GMkLwI8EvuCjBXB/7nCf7uVRfB5TGMs5Ji15Zf6pl0zaip2OP3ZKPB/P+R7fyXOseik2kGAIotiACe3NcIr5i3g6jGydqXe7byeKsf8SySyg/LuW/6q2Yesa04jWaS3NalQiZx9rkr21B+H5FVPIBNDThnTNFLqlO/7Ep6ljh50cKM35V5kmV5/3WnqWitiismWW6VH1mmeW7URRRd1tiT7XA+przWLYwxaafMuhfgB0GhHs1WXGclVQQZUBaw53bOHmAIheDLD7KxcVthRJdnYQ9ZYW12113QEz5hCRwCr0oJrJLOFZ02y0J0kq4HHOPRQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tDAHq-0006ZQ-JU; Mon, 18 Nov 2024 17:32:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74425] [PATCH] ui: Include channels in load path before searching for commands. Resent-From: Carlo Zancanaro Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 18 Nov 2024 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74425 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74425@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.173196911225233 (code B ref -1); Mon, 18 Nov 2024 22:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Nov 2024 22:31:52 +0000 Received: from localhost ([127.0.0.1]:39521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDAHf-0006Yv-FN for submit@debbugs.gnu.org; Mon, 18 Nov 2024 17:31:51 -0500 Received: from lists.gnu.org ([209.51.188.17]:59936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDAHd-0006Yk-2O for submit@debbugs.gnu.org; Mon, 18 Nov 2024 17:31:49 -0500 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 1tDAHY-0000Bh-Lh for guix-patches@gnu.org; Mon, 18 Nov 2024 17:31:46 -0500 Received: from voltorb.zancanaro.id.au ([45.77.50.64]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDAHV-0000oD-JW; Mon, 18 Nov 2024 17:31:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=Vhrp4Krewb2kkOi 42o0mrt2OOUKtcqejlGmj7U1iq1o=; h=date:subject:cc:to:from; d=zancanaro.id.au; b=GWwEdzRzOdFvMTwCJVSXDk1HATODB6IW9sILlx2OubQXdoUpr zaDAm5osVECqngy357w1DXE7NUk67kNLWNZq3OvIQRKvIBsJ2OMdz1T94oI5piB9DCdjkT e/6IMqrAK85PXiViivunrdjj+k9COZSJiy11ZInO6cm7+dOTCWpk= Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id bf58f6aa (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 18 Nov 2024 22:30:49 +0000 (UTC) From: Carlo Zancanaro Date: Tue, 19 Nov 2024 09:26:37 +1100 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=45.77.50.64; envelope-from=carlo@zancanaro.id.au; helo=voltorb.zancanaro.id.au X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-Spam-Score: 0.51 X-Spam-Score: 0.51 X-Migadu-Queue-Id: 91EBE63755 X-Migadu-Scanner: mx12.migadu.com X-TUID: 7q/avE54CZ2Q * guix/ui.scm (extension-directories): Add channel directories to load path, compiled load path, and returned list of directories. Co-authored-by: Ludovic Courtès Change-Id: I3063cbf7164a065b2c6c2a5c6473df79ce8cbe9b --- This patch allows extensions in channels to be found by the Guix CLI. Most notably, this means that a script can define commands by defining an appropriate (guix scripts X) module, with a guix-X function. This is a slight modification to a diff that Ludovic sent through IRC. I've tested that it works when I use "guix time-machine". Guix is able to find a command that I define in a channel. I haven't specifically tested that it finds commands when run through "guix pull", but I have tested that this change does not break "guix pull". guix/ui.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 447550635c..a702b6f3f8 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2018 Steve Sprang ;;; Copyright © 2022 Taiju HIGASHI ;;; Copyright © 2022 Liliana Marie Prikler +;;; Copyright © 2024 Carlo Zancanaro ;;; ;;; This file is part of GNU Guix. ;;; @@ -73,6 +74,7 @@ (define-module (guix ui) ;import in user interfaces only #:use-module (srfi srfi-31) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (srfi srfi-71) #:autoload (ice-9 ftw) (scandir) #:use-module (ice-9 match) #:use-module (ice-9 format) @@ -2192,9 +2194,16 @@ (define* (command-files #:optional directory) (define (extension-directories) "Return the list of directories containing Guix extensions." - (filter file-exists? - (parse-path - (getenv "GUIX_EXTENSIONS_PATH")))) + (define package-path-entries + ;; We need to resolve this lazily, because even using an #:autoload is too + ;; much and breaks compilation during "guix pull". + (module-ref (resolve-module `(guix describe)) + (symbol-append 'package-path-entries))) + (let ((scm-path go-path (package-path-entries))) + (set! %load-path (append %load-path scm-path)) + (set! %load-compiled-path (append %load-compiled-path go-path)) + (filter file-exists? + (parse-path (getenv "GUIX_EXTENSIONS_PATH") scm-path)))) (define (commands) "Return the list of commands, alphabetically sorted." base-commit: 23cbbe6860782c5d4a0ba599ea1cda0642e91661 -- 2.46.0