From: zimoun <zimon.toutoune@gmail.com>
To: 38678@debbugs.gnu.org
Cc: zimoun <zimon.toutoune@gmail.com>
Subject: [bug#38678] [PATCH 1/2] graph: Add '--load-path' option.
Date: Thu, 19 Dec 2019 22:13:49 +0100 [thread overview]
Message-ID: <20191219211349.8926-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20191219210958.8807-1-zimon.toutoune@gmail.com>
* 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 | 10 +++++++++-
tests/guix-graph.sh | 27 +++++++++++++++++++++++++--
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 7fa1eca097..02f7cf5b39 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..9bbb867147 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 <ludo@gnu.org>
+;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -35,7 +36,8 @@
#:use-module ((guix scripts build)
#:select (show-transformation-options-help
options->transformation
- %transformation-options))
+ %transformation-options
+ %standard-build-options))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@@ -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 <ludo@gnu.org>
+# Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
#
# 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"<<EOF
+(define-module (foo)
+ #:use-module (guix packages)
+ #:use-module (gnu packages base))
+
+(define-public dummy
+ (package (inherit hello)
+ (name "dummy")
+ (version "42")
+ (synopsis "dummy package")
+ (description "dummy package. Only used for testing purposes.")))
+EOF
+
+
guix graph --version
for package in guile-bootstrap coreutils python
@@ -59,3 +79,6 @@ guix graph git | grep 'label = "openssl'
guix graph git --with-input=openssl=libressl | grep 'label = "libressl'
if guix graph git --with-input=openssl=libressl | grep 'label = "openssl'
then false; else true; fi
+
+# Try --load-path
+guix graph -L $module_dir dummy | grep 'label = "dummy'
--
2.23.0
next prev parent reply other threads:[~2019-12-19 21:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 21:09 [bug#38678] [PATCH 0/2] Add '--load-path' to subcommands zimoun
2019-12-19 21:13 ` zimoun [this message]
2019-12-19 21:14 ` [bug#38678] [PATCH 2/2] size: Add '--load-path' option zimoun
2019-12-19 21:35 ` Pierre Neidhardt
2019-12-19 21:43 ` zimoun
2019-12-19 21:48 ` Pierre Neidhardt
2020-01-08 18:53 ` [bug#38678] [PATCH v2 0/4] Add '--load-path' to subcommands zimoun
2020-01-08 19:12 ` [bug#38678] [PATCH v3] better filter in 'refresh' zimoun
2020-01-08 18:56 ` [bug#38678] [PATCH v2 1/4] graph: Add '--load-path' option zimoun
2020-01-08 18:56 ` [bug#38678] [PATCH v2 2/4] size: " zimoun
2020-01-08 18:56 ` [bug#38678] [PATCH v2 3/4] refresh: " zimoun
2020-01-08 18:56 ` [bug#38678] [PATCH v2 4/4] edit: " zimoun
2020-01-08 19:12 ` [bug#38678] [PATCH v3] refresh: " zimoun
2020-01-08 20:59 ` [bug#38678] what about "guix repl"? zimoun
2020-01-08 21:27 ` Pierre Neidhardt
2020-01-09 13:19 ` zimoun
2020-01-09 13:21 ` [bug#38678] [PATCH 1/2] repl: Add '--load-path' option zimoun
2020-01-09 13:21 ` [bug#38678] [PATCH 2/2] repl: Fix '--help' message zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 1/6] graph: Add '--load-path' option zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 2/6] size: " zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 3/6] refresh: " zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 4/6] edit: " zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 5/6] repl: " zimoun
2020-01-15 17:00 ` [bug#38678] [PATCH v4 6/6] repl: Fix '--help' message zimoun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191219211349.8926-1-zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=38678@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).