From patchwork Wed Jan 8 18:56:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 19705 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 4CDBC17A33; Wed, 8 Jan 2020 18:57:13 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id F1547179BD for ; Wed, 8 Jan 2020 18:57:12 +0000 (GMT) Received: from localhost ([::1]:48082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipGW0-0000Kw-4i for patchwork@mira.cbaines.net; Wed, 08 Jan 2020 13:57:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50750) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipGVr-0000IR-7Y for guix-patches@gnu.org; Wed, 08 Jan 2020 13:57:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipGVp-0002kr-Tv for guix-patches@gnu.org; Wed, 08 Jan 2020 13:57:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipGVp-0002kV-Mv for guix-patches@gnu.org; Wed, 08 Jan 2020 13:57:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ipGVp-0006W3-Mz for guix-patches@gnu.org; Wed, 08 Jan 2020 13:57:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38678] [PATCH v2 1/4] graph: Add '--load-path' option. References: <20191219210958.8807-1-zimon.toutoune@gmail.com> In-Reply-To: <20191219210958.8807-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Jan 2020 18:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38678 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38678@debbugs.gnu.org Cc: zimoun Received: via spool by 38678-submit@debbugs.gnu.org id=B38678.157850979724981 (code B ref 38678); Wed, 08 Jan 2020 18:57:01 +0000 Received: (at 38678) by debbugs.gnu.org; 8 Jan 2020 18:56:37 +0000 Received: from localhost ([127.0.0.1]:51301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipGVR-0006Up-0C for submit@debbugs.gnu.org; Wed, 08 Jan 2020 13:56:37 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]:38861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipGVO-0006UW-TK for 38678@debbugs.gnu.org; Wed, 08 Jan 2020 13:56:35 -0500 Received: by mail-wr1-f49.google.com with SMTP id y17so4580835wrh.5 for <38678@debbugs.gnu.org>; Wed, 08 Jan 2020 10:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lp4TqDehn+cWlBfHvMSB1Hl/vwIVCRSiN5iOcZ0H4+U=; b=UEa8RYAXBTTHxDFSTNy3DbCJDr6pBkzcooKuSxo9id1pj+6gd8rHekhYRQgW1hoOjA /qo4xg5Qwyu9y7nriIHdh1pCxsJvRpamGjoyquyeDuvBH6xN+m+woGyOlLBmKtsY9rPe xnLLzVTqXMPb0KAy0viNJoAz5ZKg3d+egpCH69Y15MHDcP5DxjeVUUBqZ0NnNFclXmOp OgRnfUP1C51x3jsf5AIfokJuINp0ERhIBRpblunQ1yQm+4PvrpFExZqsuHaNtN1DPhBv Rz6QwZDI3xRkX8rhhVDccND34wnhem2V5RXcGH60GgbGeOg0nir3gS3P27RxqeLsDjFW gemQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lp4TqDehn+cWlBfHvMSB1Hl/vwIVCRSiN5iOcZ0H4+U=; b=YLla9zKWNmxpbh9vdLcuoWWDsFA7eWmAgipFFU8tqCf5G7o2hF+A7uYUkL/drGg4vZ B1A4Qh0//eq/XXxdJVawOrgCsuNC+UXx3Go28rHhp4z/0b6UisU4vOLoj49++ceVNIYR JWfnJqnG8cWj+Nildo3YGpxmlsb8Tu2nahswb7Ufsy+6csJ57im5knQ/NmHcRkt2moaL ptIX5tobp3UgY3a54IeTUJyTZAmMBqagv/izQ/XPl+5rgLV15uqkwYJteqwGSQqZm9MK gCm612tFpDTe9htQpOIi8Cu5rawPk3n3LwguzOBWgG8ZCsrQcmaOk2DnopkqHR243fru LE3w== X-Gm-Message-State: APjAAAVuorhd3ZmnTTtKahYUyxaHylrw1VhLc/xRWil+Ohb+yNhJwSZM d36KwWbnUNPNRZxpvZa9YypLFzuQ X-Google-Smtp-Source: APXvYqyZ8TgGvIk19jdbkVpQhEQYkmGbM5qUP2oZhq5Vbkz2g1yVzIr1ZmLidwP7tB9d3MLJfPH+XQ== X-Received: by 2002:a5d:6901:: with SMTP id t1mr5906255wru.94.1578509788705; Wed, 08 Jan 2020 10:56:28 -0800 (PST) Received: from pfiuh02.univ-paris-diderot.fr ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id l19sm34889wmj.12.2020.01.08.10.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 10:56:28 -0800 (PST) From: zimoun Date: Wed, 8 Jan 2020 19:56:21 +0100 Message-Id: <20200108185624.8609-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/graph.scm (%option): Add '--load-path' option. * doc/guix.texi: Document it. * tests/guix-graph.sh: Test it. --- doc/guix.texi | 9 +++++++++ guix/scripts/graph.scm | 8 ++++++++ tests/guix-graph.sh | 27 +++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index bb0ef17ddd..37218eb847 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -69,6 +69,7 @@ Copyright @copyright{} 2019 Jakob L. Kreuze@* Copyright @copyright{} 2019 Kyle Andrews@* Copyright @copyright{} 2019 Alex Griffin@* Copyright @copyright{} 2019 Guillaume Le Vaillant@* +Copyright @copyright{} 2019 Simon Tournier@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -10037,6 +10038,14 @@ Display the graph for @var{system}---e.g., @code{i686-linux}. The package dependency graph is largely architecture-independent, but there are some architecture-dependent bits that this option allows you to visualize. + +@item --load-path=@var{directory} +@itemx -L @var{directory} +Add @var{directory} to the front of the package module search path +(@pxref{Package Modules}). + +This allows users to define their own packages and make them visible to +the command-line tools. @end table On top of that, @command{guix graph} supports all the usual package diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm index 7558cb1e85..53f407b2fc 100644 --- a/guix/scripts/graph.scm +++ b/guix/scripts/graph.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2019 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -35,6 +36,7 @@ #:use-module ((guix scripts build) #:select (show-transformation-options-help options->transformation + %standard-build-options %transformation-options)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -473,6 +475,9 @@ package modules, while attempting to retain user package modules." (lambda (opt name arg result) (alist-cons 'system arg (alist-delete 'system result eq?)))) + (find (lambda (option) + (member "load-path" (option-names option))) + %standard-build-options) (option '(#\h "help") #f #f (lambda args (show-help) @@ -501,6 +506,9 @@ Emit a representation of the dependency graph of PACKAGE...\n")) (display (G_ " -s, --system=SYSTEM consider the graph for SYSTEM--e.g., \"i686-linux\"")) (newline) + (display (G_ " + -L, --load-path=DIR prepend DIR to the package module search path")) + (newline) (show-transformation-options-help) (newline) (display (G_ " diff --git a/tests/guix-graph.sh b/tests/guix-graph.sh index 2d4b3fac3f..4c37b61b38 100644 --- a/tests/guix-graph.sh +++ b/tests/guix-graph.sh @@ -1,5 +1,6 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2015, 2016, 2019 Ludovic Courtès +# Copyright © 2019 Simon Tournier # # This file is part of GNU Guix. # @@ -20,10 +21,29 @@ # Test the 'guix graph' command-line utility. # -tmpfile1="t-guix-graph1-$$" -tmpfile2="t-guix-graph2-$$" +module_dir="t-guix-graph-$$" +mkdir "$module_dir" +trap "rm -rf $module_dir" EXIT + +tmpfile1="$module_dir/t-guix-graph1-$$" +tmpfile2="$module_dir/t-guix-graph2-$$" trap 'rm -f "$tmpfile1" "$tmpfile2"' EXIT + +cat > "$module_dir/foo.scm"<