misc graph-depends enhancements
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.
Regards,
Yann E. MORIN.
The following changes since commit 22014e038047dfa2a303fecce0a22d1c5811b6a5:
mongoose: bump to version 5.6 (2015-03-23 23:17:32 +0100)
are available in the git repository at:
git://git.busybox.net/~ymorin/git/buildroot yem/graph-depends
for you to fetch changes up to f9b988d14b88cd502a3ae47739597e45882bf1f3:
docs/manual: document new graph-depends options (2015-03-23 23:44:21 +0100)
----------------------------------------------------------------
Yann E. MORIN (4):
support/graph-depends: add option to stop on specific packages support/graph-depends: accepts globs to stop on package support/graph-depends: add option to completely exclude a package docs/manual: document new graph-depends options
docs/manual/common-usage.txt | 8 ++++++++ support/scripts/graph-depends | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/4 support/graph-depends: add option to stop on specific packages
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.
--- support/scripts/graph-depends | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
support/scripts/graph-depends +13 -1
@@ -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)))
Signature · 1 line
1.9.1
PATCH 2/4 support/graph-depends: accepts globs to stop on package
In reply to Yann E. MORIN--- support/scripts/graph-depends | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
support/scripts/graph-depends +5 -2
@@ -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:
Signature · 1 line
1.9.1
PATCH 3/4 support/graph-depends: add option to completely exclude a package
In reply to Yann E. MORINSimilar to --stop-on, but also omits the package from the graph.
--- support/scripts/graph-depends | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
support/scripts/graph-depends +15 -2
@@ -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 {")
Signature · 1 line
1.9.1
PATCH 4/4 docs/manual: document new graph-depends options
In reply to Yann E. MORIN--- docs/manual/common-usage.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
docs/manual/common-usage.txt +8 -0
@@ -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.
Signature · 1 line
1.9.1
PATCH 1/4 support/graph-depends: add option to stop on specific packages
In reply to Yann E. MORINHi Yann, all,
Quoted 19 lines · Yann E. MORIN
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" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Francois Perrad <[email protected]>--- support/scripts/graph-depends | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)support/scripts/graph-depends +0
-0@@ -36,11 +36,14 @@ max_depth = 0 # Whether to draw the transitive dependencies
support/scripts/graph-depends max_depth = 0 · line 45
Quoted 10 lines
support/scripts/graph-depends +3
-1transitive = 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)." \
Nitpicking: the help text should be capitalized, like the others. ;-)
Quoted 30 lines
support/scripts/graph-depends +10
-1+ + " '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
Quoted 4 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Otherwise, you got my:
Regards,
Signature · 1 line
Samuel
PATCH 2/4 support/graph-depends: accepts globs to stop on package
In reply to Yann E. MORINHi Yann, all,
Quoted 28 lines · Yann E. MORIN
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Francois Perrad <[email protected]>--- support/scripts/graph-depends | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)support/scripts/graph-depends +2
-0@@ -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",
support/scripts/graph-depends def print_pkg_deps(depth, pkg): · line 318
Quoted 7 lines
support/scripts/graph-depends +2
-2@@ -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):
Nitpicking: missing space after the coma. ;-)
Quoted 11 lines
support/scripts/graph-depends +1
-1+ return if dict_version.get(pkg) == "virtual" and "virtual" in stop_list: return if max_depth == 0 or depth < max_depth: --1.9.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Otherwise, you got my:
Regards,
Signature · 1 line
Samuel
PATCH 3/4 support/graph-depends: add option to completely exclude a package
In reply to Yann E. MORINYann, all,
Quoted 5 lines · Yann E. MORIN
Similar to --stop-on, but also omits the package from the graph.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Francois Perrad <[email protected]>
Regards,
Signature · 1 line
Samuel
PATCH 4/4 docs/manual: document new graph-depends options
In reply to Yann E. MORINYann, all,
Quoted 3 lines · Yann E. MORIN
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Francois Perrad <[email protected]>
Quoted 26 lines
--- docs/manual/common-usage.txt | 8 ++++++++ 1 file changed, 8 insertions(+)docs/manual/common-usage.txt +8
-1@@ -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
Quoted 4 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Regards,
Signature · 1 line
Samuel