From patchwork Thu Dec 19 21:13:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 16572 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 5171F17959; Thu, 19 Dec 2019 21:14:11 +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 F39D117955 for ; Thu, 19 Dec 2019 21:14:10 +0000 (GMT) Received: from localhost ([::1]:47852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii37a-0001Pp-9h for patchwork@mira.cbaines.net; Thu, 19 Dec 2019 16:14:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40514) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii37U-0001Pj-1G for guix-patches@gnu.org; Thu, 19 Dec 2019 16:14:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii37S-000208-Kj for guix-patches@gnu.org; Thu, 19 Dec 2019 16:14:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39616) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ii37S-0001yw-EB for guix-patches@gnu.org; Thu, 19 Dec 2019 16:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ii37S-00046e-8Z for guix-patches@gnu.org; Thu, 19 Dec 2019 16:14:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38678] [PATCH 1/2] 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: Thu, 19 Dec 2019 21:14:02 +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.157679004115770 (code B ref 38678); Thu, 19 Dec 2019 21:14:02 +0000 Received: (at 38678) by debbugs.gnu.org; 19 Dec 2019 21:14:01 +0000 Received: from localhost ([127.0.0.1]:45589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ii37Q-00046I-TV for submit@debbugs.gnu.org; Thu, 19 Dec 2019 16:14:01 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:32981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ii37O-000463-A2 for 38678@debbugs.gnu.org; Thu, 19 Dec 2019 16:13:58 -0500 Received: by mail-wm1-f52.google.com with SMTP id d139so7953983wmd.0 for <38678@debbugs.gnu.org>; Thu, 19 Dec 2019 13:13:58 -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=SBW9IxtFyPgyxf20ChmkkJnzKqnrkhGjA14XTXC5/uc=; b=cEDy8f4ntRxegcAcXyR7Uwf5PiUu2+0e3umkA/SYGRwxBLeMqas//6I5wHEImfCbdJ 0tlyUUoBKYhtsg7j7BkH6mAlOkzOyJ15UZgoHotddc4DCLYoAlni7stRounC03l5Tc4E LA/G/6pT1x7SSmIbiykbBtoEEKCTqKoBWosM9CYlf4wDtY64RPc07AaCnS8wFp4cKbxj EM+JYMya1drQl8Igtzm2ymvEBHGv80eyTC+FuNTubMMciF10TaEDfk6jvrZysTrXHvHj RoOlN3oyBITt2XVi6QT8rfbyBH7+V0uQq5ZQJpOWuzHIqfVsY2lVGBFBtRq9bd2aXWWg C60w== 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=SBW9IxtFyPgyxf20ChmkkJnzKqnrkhGjA14XTXC5/uc=; b=U0kHeb9nhLa6Cu826GdBpcFZqnF7Z2iI3TKwrNotetLK6UuM0iQ2bv3Q27FfqQRjmb 97FwdpDRQx5H7sofZwdoDrEUvD03Ia0Bsm2uPwahyoJC+nh33nsX1lQQddrz74PmxCKg HPX2s3iyEdd1qvGqm41ZjjGSp7/ZCWY437v81pRnmtFXeI4sx94iT9dzFcieEHlEJT+6 gWOsXbYOiMT3qQVq6XtEwGcxFnSq8GOdfG36f7IDEa0gCy8JaB637i9b6QBdSSJf687I f1u5SE5vezflUTY+Sp5/O0QYGUkMCrD52NDzZaGtncQwixtNKDDMQVu/VR/S1alA8uJq CcCA== X-Gm-Message-State: APjAAAUP++2miDPQC/CGPcKUPEqL/+JZSWSqnCPfyHfQIwR902epP3rd FNvC2ldXYfdfn3jVVnsWt38j572y X-Google-Smtp-Source: APXvYqxp5Rz2ehIY/RN4P/Db4vqd9etDOzA0W3pEHBgnlMGN6ApT1UwCHCDeTsJxT1M91Fl+RTiEhQ== X-Received: by 2002:a05:600c:24d1:: with SMTP id 17mr12097529wmu.136.1576790032064; Thu, 19 Dec 2019 13:13:52 -0800 (PST) Received: from pfiuh02.univ-paris-diderot.fr ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id s1sm7435052wmc.23.2019.12.19.13.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 13:13:51 -0800 (PST) From: zimoun Date: Thu, 19 Dec 2019 22:13:49 +0100 Message-Id: <20191219211349.8926-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 | 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 +;;; Copyright © 2019 Simon Tournier ;;; ;;; 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 +# 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"< X-Patchwork-Id: 16573 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 ADD7217959; Thu, 19 Dec 2019 21:15:10 +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 6A51017955 for ; Thu, 19 Dec 2019 21:15:10 +0000 (GMT) Received: from localhost ([::1]:47862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii38X-0001h2-W8 for patchwork@mira.cbaines.net; Thu, 19 Dec 2019 16:15:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44824) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii38R-0001gh-7F for guix-patches@gnu.org; Thu, 19 Dec 2019 16:15:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii38Q-00076u-1o for guix-patches@gnu.org; Thu, 19 Dec 2019 16:15:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ii38P-00075T-Q8 for guix-patches@gnu.org; Thu, 19 Dec 2019 16:15:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ii38P-00048c-Lf for guix-patches@gnu.org; Thu, 19 Dec 2019 16:15:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38678] [PATCH 2/2] size: 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: Thu, 19 Dec 2019 21:15: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.157679004915822 (code B ref 38678); Thu, 19 Dec 2019 21:15:01 +0000 Received: (at 38678) by debbugs.gnu.org; 19 Dec 2019 21:14:09 +0000 Received: from localhost ([127.0.0.1]:45593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ii37Z-000478-C2 for submit@debbugs.gnu.org; Thu, 19 Dec 2019 16:14:09 -0500 Received: from mail-wm1-f48.google.com ([209.85.128.48]:52745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ii37Y-00046s-0X for 38678@debbugs.gnu.org; Thu, 19 Dec 2019 16:14:08 -0500 Received: by mail-wm1-f48.google.com with SMTP id p9so6884528wmc.2 for <38678@debbugs.gnu.org>; Thu, 19 Dec 2019 13:14:07 -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=2qA7NCtd4nq5hHoyegrHzIOQeV+ICNozfQk4fVH4gLU=; b=ROLNvhaZmyCMzgyN/k5VwURoWx/tCTxwcBlx7GUaoMTNJg7oK6/IjYyG6ng3H0KGNO Te/3C1TJcxrL0bdSTxpq13SYjeWFQVS/ALUoRpba8RWxEVxwNN3j+9XId5ZFqgTHZLUv ezA4ztYPszGqVygdTnu9ggKYU4S6BuTFRtwlvQcs7+DbjXWyBhWkYCs5GrNQxGrqhF9J 5QU08dKANTazTWzg+acl03BlYD7WibCWPyHk1E10To0RJDONJfy6ulREPO5+l9qgxA7/ hHACZQHcdU3sgnuN76X2TwfeALsezp3FKnEkPiFri0liMV1moiR2xGjdSXTKSDi2lR60 iHOw== 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=2qA7NCtd4nq5hHoyegrHzIOQeV+ICNozfQk4fVH4gLU=; b=tZC72hh/NdqHbZLcnRTqjeCU7N+/jSXmEFmlU5ZfKFixvm30OZn4aKrxipiJ1Dm3af FZ1/TLvYxHkuacxiEG62c/DeL+afgm0bMtE7Ee/UQKQHeC4Sgl+OPxTDDbNRi9Ez2k+q 45JmBKJBa8vGk7Wzf2h44s1GADQ7AjfJMpu8bqRX+FbKjSrRyKgbe+s3f1LrJcVORiML UY0yLX6+qQ/j1PZuDOTujF7TRsNXL1/Vld3qvMkAACB1/lAbRAYY3JuNvvfqj1Cjot54 +6IWxKVygyhPtXhtA1iaujF+ccCneHM91WdnTac4ERwu8BlnS92zZTvPm2Pppp12dspV Bw6g== X-Gm-Message-State: APjAAAUq5sCrLFzV2YXtKO6knov+fbBnCJGWvIv/Y70cJcCpRaY0/Cd1 Y3ml+DYS+HamfQmOm4u1CflNZhNh X-Google-Smtp-Source: APXvYqy8jgUfG45umbpjausgsd+namTnhNnbq9thndLTySwT5TTr1gKTgDjjHZKTQSUEihZOwoo5wQ== X-Received: by 2002:a1c:62c1:: with SMTP id w184mr12691435wmb.150.1576790042198; Thu, 19 Dec 2019 13:14:02 -0800 (PST) Received: from pfiuh02.univ-paris-diderot.fr ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id i16sm7657803wmb.36.2019.12.19.13.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 13:14:01 -0800 (PST) From: zimoun Date: Thu, 19 Dec 2019 22:14:00 +0100 Message-Id: <20191219211400.8978-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/size.scm (%option): Add '--load-path' option. * doc/guix.texi: Document it. --- doc/guix.texi | 8 +++++++- guix/scripts/size.scm | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 02f7cf5b39..c0fa6a3cab 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -69,7 +69,6 @@ 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 @@ -9837,6 +9836,13 @@ the case, @command{guix size} fails as it tries to load it. @itemx -s @var{system} Consider packages for @var{system}---e.g., @code{x86_64-linux}. +@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 @node Invoking guix graph diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index f549ce05b8..2446b84587 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.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. ;;; @@ -19,6 +20,7 @@ (define-module (guix scripts size) #:use-module (guix ui) #:use-module (guix scripts) + #:use-module (guix scripts build) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix combinators) @@ -242,6 +244,9 @@ Report the size of PACKAGE and its dependencies.\n")) -m, --map-file=FILE write to FILE a graphical map of disk usage")) (newline) (display (G_ " + -L, --load-path=DIR prepend DIR to the package module search path")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) @@ -273,6 +278,9 @@ Report the size of PACKAGE and its dependencies.\n")) (option '(#\m "map-file") #t #f (lambda (opt name arg result) (alist-cons 'map-file arg result))) + (find (lambda (option) + (member "load-path" (option-names option))) + %standard-build-options) (option '(#\h "help") #f #f (lambda args (show-help)