* [Buildroot] [PATCH 1/4 v2] support/graph-depends: add option to stop on specific packages
2015-03-24 22:16 [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Yann E. MORIN
@ 2015-03-24 22:16 ` Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 2/4 v2] support/graph-depends: accepts globs to stop on package Yann E. MORIN
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2015-03-24 22:16 UTC (permalink / raw)
To: buildroot
Add a new option to graph-depends, that users can set to stop the graph
on a specific (set of) package(s).
This accepts any actual package name, or the 'virtual' keyword to stop
on virtual packages.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Francois Perrad <fperrad@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
---
Changes v1 -> v2:
- capitalise help (Samuel)
---
support/scripts/graph-depends | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index 5b9b195..93844c7 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -36,11 +36,14 @@ max_depth = 0
# Whether to draw the transitive dependencies
transitive = True
-parser = argparse.ArgumentParser(description="Graph pacakges dependencies")
+parser = argparse.ArgumentParser(description="Graph packages dependencies")
parser.add_argument("--package", '-p', metavar="PACKAGE",
help="Graph the dependencies of PACKAGE")
parser.add_argument("--depth", '-d', metavar="DEPTH", dest="depth", type=int, default=0,
help="Limit the dependency graph to DEPTH levels; 0 means no limit.")
+parser.add_argument("--stop-on", "-s", metavar="PACKAGE", dest="stop_list", action="append",
+ help="Do not graph past this package (can be given multiple times)." \
+ + " 'virtual' to stop on virtual packages.")
parser.add_argument("--colours", "-c", metavar="COLOR_LIST", dest="colours",
default="lightblue,grey,gainsboro",
help="Comma-separated list of the three colours to use" \
@@ -61,6 +64,11 @@ else:
max_depth = args.depth
+if args.stop_list is None:
+ stop_list = []
+else:
+ stop_list = args.stop_list
+
transitive = args.transitive
# Get the colours: we need exactly three colours,
@@ -304,6 +312,10 @@ def print_pkg_deps(depth, pkg):
print_attrs(pkg)
if pkg not in dict_deps:
return
+ if pkg in stop_list:
+ return
+ if dict_version.get(pkg) == "virtual" and "virtual" in stop_list:
+ return
if max_depth == 0 or depth < max_depth:
for d in dict_deps[pkg]:
print("%s -> %s" % (pkg_node_name(pkg), pkg_node_name(d)))
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 2/4 v2] support/graph-depends: accepts globs to stop on package
2015-03-24 22:16 [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 1/4 v2] support/graph-depends: add option to stop on specific packages Yann E. MORIN
@ 2015-03-24 22:16 ` Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 3/4 v2] support/graph-depends: add option to completely exclude a package Yann E. MORIN
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2015-03-24 22:16 UTC (permalink / raw)
To: buildroot
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Francois Perrad <fperrad@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
---
Changes v1 -> v2:
- code format (Samuel)
---
support/scripts/graph-depends | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index 93844c7..b0202e6 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -24,6 +24,7 @@
import sys
import subprocess
import argparse
+from fnmatch import fnmatch
# Modes of operation:
MODE_FULL = 1 # draw full dependency graph for all selected packages
@@ -43,6 +44,7 @@ parser.add_argument("--depth", '-d', metavar="DEPTH", dest="depth", type=int, de
help="Limit the dependency graph to DEPTH levels; 0 means no limit.")
parser.add_argument("--stop-on", "-s", metavar="PACKAGE", dest="stop_list", action="append",
help="Do not graph past this package (can be given multiple times)." \
+ + " Can be a package name or a glob, or" \
+ " 'virtual' to stop on virtual packages.")
parser.add_argument("--colours", "-c", metavar="COLOR_LIST", dest="colours",
default="lightblue,grey,gainsboro",
@@ -312,8 +314,9 @@ def print_pkg_deps(depth, pkg):
print_attrs(pkg)
if pkg not in dict_deps:
return
- if pkg in stop_list:
- return
+ for p in stop_list:
+ if fnmatch(pkg, p):
+ return
if dict_version.get(pkg) == "virtual" and "virtual" in stop_list:
return
if max_depth == 0 or depth < max_depth:
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 3/4 v2] support/graph-depends: add option to completely exclude a package
2015-03-24 22:16 [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 1/4 v2] support/graph-depends: add option to stop on specific packages Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 2/4 v2] support/graph-depends: accepts globs to stop on package Yann E. MORIN
@ 2015-03-24 22:16 ` Yann E. MORIN
2015-03-24 22:16 ` [Buildroot] [PATCH 4/4 v2] docs/manual: document new graph-depends options Yann E. MORIN
2015-03-31 22:02 ` [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Thomas Petazzoni
4 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2015-03-24 22:16 UTC (permalink / raw)
To: buildroot
Similar to --stop-on, but also omits the package from the graph.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Francois Perrad <fperrad@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
---
support/scripts/graph-depends | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index b0202e6..c1fc042 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -46,6 +46,8 @@ parser.add_argument("--stop-on", "-s", metavar="PACKAGE", dest="stop_list", acti
help="Do not graph past this package (can be given multiple times)." \
+ " Can be a package name or a glob, or" \
+ " 'virtual' to stop on virtual packages.")
+parser.add_argument("--exclude", "-x", metavar="PACKAGE", dest="exclude_list", action="append",
+ help="Like --stop-on, but do not add PACKAGE to the graph.")
parser.add_argument("--colours", "-c", metavar="COLOR_LIST", dest="colours",
default="lightblue,grey,gainsboro",
help="Comma-separated list of the three colours to use" \
@@ -71,6 +73,11 @@ if args.stop_list is None:
else:
stop_list = args.stop_list
+if args.exclude_list is None:
+ exclude_list = []
+else:
+ exclude_list = args.exclude_list
+
transitive = args.transitive
# Get the colours: we need exactly three colours,
@@ -321,8 +328,14 @@ def print_pkg_deps(depth, pkg):
return
if max_depth == 0 or depth < max_depth:
for d in dict_deps[pkg]:
- print("%s -> %s" % (pkg_node_name(pkg), pkg_node_name(d)))
- print_pkg_deps(depth+1, d)
+ add = True
+ for p in exclude_list:
+ if fnmatch(d,p):
+ add = False
+ break
+ if add:
+ print("%s -> %s" % (pkg_node_name(pkg), pkg_node_name(d)))
+ print_pkg_deps(depth+1, d)
# Start printing the graph data
print("digraph G {")
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 4/4 v2] docs/manual: document new graph-depends options
2015-03-24 22:16 [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Yann E. MORIN
` (2 preceding siblings ...)
2015-03-24 22:16 ` [Buildroot] [PATCH 3/4 v2] support/graph-depends: add option to completely exclude a package Yann E. MORIN
@ 2015-03-24 22:16 ` Yann E. MORIN
2015-03-31 22:02 ` [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Thomas Petazzoni
4 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2015-03-24 22:16 UTC (permalink / raw)
To: buildroot
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Francois Perrad <fperrad@gmail.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
---
docs/manual/common-usage.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/docs/manual/common-usage.txt b/docs/manual/common-usage.txt
index 89cd9fe..5b27b1f 100644
--- a/docs/manual/common-usage.txt
+++ b/docs/manual/common-usage.txt
@@ -208,6 +208,14 @@ The +graph-depends+ behaviour can be controlled by setting options in the
* +--depth N+, +-d N+, to limit the dependency depth to +N+ levels. The
default, +0+, means no limit.
+* +--stop-on PKG+, +-s PKG+, to stop the graph on the package +PKG+.
+ +PKG+ can be an actual package name, a glob, or the keyword 'virtual'
+ (to stop on virtual packages). The package is still present on the
+ graph, but its dependencies are not.
+
+* +--exclude PKG+, +-x PKG+, like +--stop-on+, but also omits +PKG+ from
+ the graph.
+
* +--transitive+, +--no-transitive+, to draw (or not) the transitive
dependencies. The default is to not draw transitive dependencies.
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends)
2015-03-24 22:16 [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Yann E. MORIN
` (3 preceding siblings ...)
2015-03-24 22:16 ` [Buildroot] [PATCH 4/4 v2] docs/manual: document new graph-depends options Yann E. MORIN
@ 2015-03-31 22:02 ` Thomas Petazzoni
2015-03-31 22:20 ` Yann E. MORIN
4 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2015-03-31 22:02 UTC (permalink / raw)
To: buildroot
Dear Yann E. MORIN,
On Tue, 24 Mar 2015 23:16:47 +0100, Yann E. MORIN wrote:
> Hello All!
>
> This series introduces a few enhancements to graph-depends, with two new
> options:
> - --stop-on/-s PKG: to stop graphing on package PKG;
> - --exclude/-x PKG: like --stop-on, but also omit PKG from the graph.
>
> PKG can be one of an actual package name, a glob or the keyword
> 'virtual' (to stop on / exclude virtual packages). Stoping on, or
> excluding host packages can easily be done by using the glob 'host-*'
>
> Note: I did not introduce the keyword 'host' because 'host' is an
> existing package, and even though we do not package it so far, it
> would have clashed, should we eventually have it.
Series applied, thanks.
One thing that bothered me a bit is that --stop-on supports the keyword
'virtual', but not --exclude.
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends)
2015-03-31 22:02 ` [Buildroot] [PATCH 0/4 v2] misc graph-depends enhancements (branch yem/graph-depends) Thomas Petazzoni
@ 2015-03-31 22:20 ` Yann E. MORIN
0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2015-03-31 22:20 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2015-04-01 00:02 +0200, Thomas Petazzoni spake thusly:
> On Tue, 24 Mar 2015 23:16:47 +0100, Yann E. MORIN wrote:
> > This series introduces a few enhancements to graph-depends, with two new
> > options:
> > - --stop-on/-s PKG: to stop graphing on package PKG;
> > - --exclude/-x PKG: like --stop-on, but also omit PKG from the graph.
[--SNIP--]
> One thing that bothered me a bit is that --stop-on supports the keyword
> 'virtual', but not --exclude.
Right, I'll fix that.
Thanks! :-)
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread