Create 'make <pkt>-show-rrdepends' command
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
The created command shows, recursively, the reverse depends of a package,
it means that the command shows not only the direct dependants (which is done by 'show-rdepends'), but also all indirect dependents.
To do this it was necessary to create a new parameter '--flat-list', or '-f', to graph-depends.
This parameter instructs the script to just print the name of package instead of the .dot syntax.
--- Makefile | 1 + package/pkg-generic.mk | 10 ++++++++++ support/scripts/graph-depends | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)
Makefile +1 -0
@@ -996,6 +996,7 @@ help: @echo ' <pkg>-build - Build <pkg> up to the build step' @echo ' <pkg>-show-depends - List packages on which <pkg> depends' @echo ' <pkg>-show-rdepends - List packages which have <pkg> as a dependency' + @echo ' <pkg>-show-rrdepends - List, recursivelly, packages which have <pkg> as a dependency' @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies' @echo ' <pkg>-graph-rdepends - Generate a graph of <pkg>'\''s reverse dependencies' @echo ' <pkg>-dirclean - Remove <pkg> build directory'
package/pkg-generic.mk +10 -0
@@ -353,6 +353,13 @@ define pkg-graph-depends $$(GRAPHS_DIR)/$$(@).dot endef +define pkg-rrdepends + @$$(INSTALL) -d $$(GRAPHS_DIR) + @cd "$$(CONFIG_DIR)"; \ + $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \ + -p $(1) --reverse -f +endef + ################################################################################ # inner-generic-package -- generates the make targets needed to build a # generic package
@@ -737,6 +744,9 @@ $(1)-show-depends: $(1)-show-rdepends: @echo $$($(2)_RDEPENDENCIES) +$(1)-show-rrdepends: + $(call pkg-rrdepends,$(1)) + $(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES)) $$(info $(1))
support/scripts/graph-depends +12 -4
@@ -69,6 +69,8 @@ parser.add_argument("--direct", dest="direct", action='store_true', default=True help="Draw direct dependencies (the default)") parser.add_argument("--reverse", dest="direct", action='store_false', help="Draw reverse dependencies") +parser.add_argument("--flat-list", '-f', dest="flat_list", action='store_true', default=False, + help="Do not draw, just print a flat list output.") args = parser.parse_args() check_only = args.check_only
@@ -361,7 +363,10 @@ def print_pkg_deps(depth, pkg): if pkg in done_deps: return done_deps.append(pkg) - print_attrs(pkg) + if args.flat_list: + outfile.write("%s\n" % (pkg)) + else: + print_attrs(pkg) if pkg not in dict_deps: return for p in stop_list:
@@ -385,13 +390,16 @@ def print_pkg_deps(depth, pkg): add = False break if add: - outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) + if not args.flat_list: + outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) print_pkg_deps(depth+1, d) # Start printing the graph data -outfile.write("digraph G {\n") +if not args.flat_list: + outfile.write("digraph G {\n") done_deps = [] print_pkg_deps(0, rootpkg) -outfile.write("}\n") +if not args.flat_list: + outfile.write("}\n")
Signature · 1 line
1.9.1
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
Hi George,
Quoted 4 lines · George Redivo
The created command shows, recursively, the reverse depends of a package,
it means that the command shows not only the direct dependants (which is done by 'show-rdepends'), but also all indirect dependents.
Could you explain a bit more what the use case is you are trying to solve?
Quoted 4 lines
To do this it was necessary to create a new parameter '--flat-list', or '-f', to graph-depends.
This parameter instructs the script to just print the name of package instead of the .dot syntax.
See below for a better alternative.
Quoted 39 lines
Signed-off-by George Redivo <[email protected]>--- Makefile | 1 + package/pkg-generic.mk | 10 ++++++++++ support/scripts/graph-depends | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)Makefile +1
-0@@ -996,6 +996,7 @@ help: @echo ' <pkg>-build - Build <pkg> up to the build step' @echo ' <pkg>-show-depends - List packages on which <pkg> depends' @echo ' <pkg>-show-rdepends - List packages which have <pkg> as a dependency' + @echo ' <pkg>-show-rrdepends - List, recursivelly, packages which have <pkg> as a dependency' @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies' @echo ' <pkg>-graph-rdepends - Generate a graph of <pkg>'\''s reverse dependencies' @echo ' <pkg>-dirclean - Remove <pkg> build directory'package/pkg-generic.mk +7
-0@@ -353,6 +353,13 @@ define pkg-graph-depends $$(GRAPHS_DIR)/$$(@).dot endef +define pkg-rrdepends + @$$(INSTALL) -d $$(GRAPHS_DIR) + @cd "$$(CONFIG_DIR)"; \ + $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \ + -p $(1) --reverse -f +endef + ################################################################################ # inner-generic-package -- generates the make targets needed to build a # generic package
package/pkg-generic.mk $(1)-show-depends: · line 748
Quoted 5 lines
package/pkg-generic.mk +2
-0@@ -737,6 +744,9 @@ $(1)-show-depends: $(1)-show-rdepends: @echo $$($(2)_RDEPENDENCIES) +$(1)-show-rrdepends: + $(call pkg-rrdepends,$(1))
It is better to use the approach like for show-build-order, i.e.:
$(1)-show-rrdepends: $$(patsubst %,%-rrdepends,$$($(2)_FINAL_ALL_DEPENDENCIES))
@printf '%s' $$($(2)_RDEPENDENCIES)
However, I would much prefer to rewrite graph-depends completely so it works in
a single pass, and have just pkg-show-depends that works recursively like above. Then any filterling like depth or just a single package or reverting the arrows can be done by the graph-depends script itself. That would work a whole lot faster, and in addition would allow us to remove a lot of those annoying extra rules inside inner-generic-package (cfr. my rant recently).
But that is of course a much bigger change, so for the time being I'm OK with
adding this rrdepends.
Regards,
Arnout
Quoted 50 lines
package/pkg-generic.mk +1
-0+ $(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES)) $$(info $(1))support/scripts/graph-depends +12
-4@@ -69,6 +69,8 @@ parser.add_argument("--direct", dest="direct", action='store_true', default=True help="Draw direct dependencies (the default)") parser.add_argument("--reverse", dest="direct", action='store_false', help="Draw reverse dependencies") +parser.add_argument("--flat-list", '-f', dest="flat_list", action='store_true', default=False, + help="Do not draw, just print a flat list output.") args = parser.parse_args() check_only = args.check_only@@ -361,7 +363,10 @@ def print_pkg_deps(depth, pkg): if pkg in done_deps: return done_deps.append(pkg) - print_attrs(pkg) + if args.flat_list: + outfile.write("%s\n" % (pkg)) + else: + print_attrs(pkg) if pkg not in dict_deps: return for p in stop_list:@@ -385,13 +390,16 @@ def print_pkg_deps(depth, pkg): add = False break if add: - outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) + if not args.flat_list: + outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) print_pkg_deps(depth+1, d) # Start printing the graph data -outfile.write("digraph G {\n") +if not args.flat_list: + outfile.write("digraph G {\n") done_deps = [] print_pkg_deps(0, rootpkg) -outfile.write("}\n") +if not args.flat_list: + outfile.write("}\n")
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
Hi Arnout,
Sometimes I want to recompile all reverse-dependant packages, including indirect dependents. So if I have the list of these packages, it's pretty easy to recompile them.
Using the approach you suggested some packages are repeatedly printed.
Suppose the package A depends on packages B and C, and both B and C depends on package D.
When I run show-rrdepends over D, I want to see "B C A", but with your proposed approach the output will be "B A C A" because It does not handle the already printed packages. However the graph-depends script handle this case and that's one of the reasons I implemented it in this script.
George Redivo
DATACOM
Ethernet Switches
Rua Am?rica, 1000 - Eldorado do Sul, RS
Ramal: 3444
george.redivo at datacom.ind.br
www.datacom.ind.br
----- Original Message -----
From: "Arnout Vandecappelle" <[email protected]>
To: "DATACOM" <[email protected]>, buildroot at buildroot.org
Cc: "Thomas Petazzoni" <[email protected]>
Sent: Friday, April 28, 2017 6:25:04 PM
Subject: Re: [Buildroot] [PATCH 1/1] Create 'make <pkt>-show-rrdepends' command
Hi George,
Quoted 4 lines · George Redivo
The created command shows, recursively, the reverse depends of a package,
it means that the command shows not only the direct dependants (which is done by 'show-rdepends'), but also all indirect dependents.
Could you explain a bit more what the use case is you are trying to solve?
Quoted 4 lines
To do this it was necessary to create a new parameter '--flat-list', or '-f', to graph-depends.
This parameter instructs the script to just print the name of package instead of the .dot syntax.
See below for a better alternative.
Quoted 39 lines
Signed-off-by George Redivo <[email protected]>--- Makefile | 1 + package/pkg-generic.mk | 10 ++++++++++ support/scripts/graph-depends | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)Makefile +1
-0@@ -996,6 +996,7 @@ help: @echo ' <pkg>-build - Build <pkg> up to the build step' @echo ' <pkg>-show-depends - List packages on which <pkg> depends' @echo ' <pkg>-show-rdepends - List packages which have <pkg> as a dependency' + @echo ' <pkg>-show-rrdepends - List, recursivelly, packages which have <pkg> as a dependency' @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies' @echo ' <pkg>-graph-rdepends - Generate a graph of <pkg>'\''s reverse dependencies' @echo ' <pkg>-dirclean - Remove <pkg> build directory'package/pkg-generic.mk +7
-0@@ -353,6 +353,13 @@ define pkg-graph-depends $$(GRAPHS_DIR)/$$(@).dot endef +define pkg-rrdepends + @$$(INSTALL) -d $$(GRAPHS_DIR) + @cd "$$(CONFIG_DIR)"; \ + $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \ + -p $(1) --reverse -f +endef + ################################################################################ # inner-generic-package -- generates the make targets needed to build a # generic package
package/pkg-generic.mk $(1)-show-depends: · line 748
Quoted 5 lines
package/pkg-generic.mk +2
-0@@ -737,6 +744,9 @@ $(1)-show-depends: $(1)-show-rdepends: @echo $$($(2)_RDEPENDENCIES) +$(1)-show-rrdepends: + $(call pkg-rrdepends,$(1))
It is better to use the approach like for show-build-order, i.e.:
$(1)-show-rrdepends: $$(patsubst %,%-rrdepends,$$($(2)_FINAL_ALL_DEPENDENCIES))
@printf '%s' $$($(2)_RDEPENDENCIES)
However, I would much prefer to rewrite graph-depends completely so it works in
a single pass, and have just pkg-show-depends that works recursively like above. Then any filterling like depth or just a single package or reverting the arrows can be done by the graph-depends script itself. That would work a whole lot faster, and in addition would allow us to remove a lot of those annoying extra rules inside inner-generic-package (cfr. my rant recently).
But that is of course a much bigger change, so for the time being I'm OK with
adding this rrdepends.
Regards,
Arnout
Quoted 50 lines
package/pkg-generic.mk +1
-0+ $(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES)) $$(info $(1))support/scripts/graph-depends +12
-4@@ -69,6 +69,8 @@ parser.add_argument("--direct", dest="direct", action='store_true', default=True help="Draw direct dependencies (the default)") parser.add_argument("--reverse", dest="direct", action='store_false', help="Draw reverse dependencies") +parser.add_argument("--flat-list", '-f', dest="flat_list", action='store_true', default=False, + help="Do not draw, just print a flat list output.") args = parser.parse_args() check_only = args.check_only@@ -361,7 +363,10 @@ def print_pkg_deps(depth, pkg): if pkg in done_deps: return done_deps.append(pkg) - print_attrs(pkg) + if args.flat_list: + outfile.write("%s\n" % (pkg)) + else: + print_attrs(pkg) if pkg not in dict_deps: return for p in stop_list:@@ -385,13 +390,16 @@ def print_pkg_deps(depth, pkg): add = False break if add: - outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) + if not args.flat_list: + outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir)) print_pkg_deps(depth+1, d) # Start printing the graph data -outfile.write("digraph G {\n") +if not args.flat_list: + outfile.write("digraph G {\n") done_deps = [] print_pkg_deps(0, rootpkg) -outfile.write("}\n") +if not args.flat_list: + outfile.write("}\n")
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
In reply to George RedivoFrom: George Redivo <[email protected]>
Hello,
Looks like this https://patchwork.ozlabs.org/patch/756075/ was accepted by Arnout but was left behind. Could we have it applied, please?
---
Carlos Santos (Casantos) - DATACOM, P&D
Rua Am?rica, 1000 - Eldorado do Sul, RS, Brasil - 92990-000
casantos at datacom.ind.br +55 51 3933.3000 ext. 3627
http://www.datacom.ind.br
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
Quoted 6 lines · Carlos Santos
From: George Redivo <[email protected]>
Hello,
Looks like this https://patchwork.ozlabs.org/patch/756075/ was accepted by Arnout but was left behind. Could we have it applied, please?
I didn't exactly "accept" this patch. I thought the implementation was
acceptable, but I wasn't entirely sure the use case was important enough to warrant the additional complexity.
If I understand the use case correctly, what you want is that you have changed
something in package A, so you want to rebuild package A and all its recursive dependencies. For that, a recursive dirclean is probably more appropriate:
$(1)-dirclean-recursive: $(1)-dirclean $$(patsubst %,%-dirclean-recursive,$$($(2)_FINAL_ALL_DEPENDENCIES))
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
Hello all
----- Mensagem original -----
Quoted 18 lines
De: "Arnout Vandecappelle" <[email protected]>
Para: "Carlos Santos" <[email protected]>, buildroot at buildroot.org
Cc: "George Redivo" <[email protected]>
Enviadas: Quarta-feira, 4 de outubro de 2017 13:18:32
Assunto: Re: [Buildroot] [PATCH] Create 'make <pkt>-show-rrdepends' commandQuoted 6 lines · Carlos Santos
From: George Redivo <[email protected]>
Hello,
Looks like this https://patchwork.ozlabs.org/patch/756075/ was accepted by Arnout but was left behind. Could we have it applied, please?
I didn't exactly "accept" this patch. I thought the implementation was acceptable, but I wasn't entirely sure the use case was important enough to warrant the additional complexity.
Quoted 7 lines
If I understand the use case correctly, what you want is that you have changed something in package A, so you want to rebuild package A and all its recursive dependencies. For that, a recursive dirclean is probably more appropriate:
$(1)-dirclean-recursive: $(1)-dirclean $$(patsubst %,%-dirclean-recursive,$$($(2)_FINAL_ALL_DEPENDENCIES))
Not exactly the same i guess, i think this will rebuild package A and all its dependencies (we are going "down" on dependencies).
The point of this script is to rebuild package A and all those who depends on it (we are going "up" on dependencies).
Based on previous work done on the reverse-dependencies (make <pkg>-show-rdepends), this has been turned in recursive-reverse-dependencies.
Signature · 5 lines
Dr. Henrique Marks henrique.marks at datacom.ind.br R. Am?rica, 1000 - Eldorado do Sul - RS CEP: 92990-000 - Brasil Fone: +55 51 3933 3000 - Ramal 3466
PATCH 1/1 Create 'make <pkt>-show-rrdepends' command
Quoted 29 lines · Henrique Marks
Hello all
----- Mensagem original -----
Quoted 18 lines
De: "Arnout Vandecappelle" <[email protected]>
Para: "Carlos Santos" <[email protected]>, buildroot at buildroot.org
Cc: "George Redivo" <[email protected]>
Enviadas: Quarta-feira, 4 de outubro de 2017 13:18:32
Assunto: Re: [Buildroot] [PATCH] Create 'make <pkt>-show-rrdepends' commandQuoted 6 lines · Carlos Santos
From: George Redivo <[email protected]>
Hello,
Looks like this https://patchwork.ozlabs.org/patch/756075/ was accepted by Arnout but was left behind. Could we have it applied, please?
I didn't exactly "accept" this patch. I thought the implementation was acceptable, but I wasn't entirely sure the use case was important enough to warrant the additional complexity.
Quoted 7 lines
If I understand the use case correctly, what you want is that you have changed something in package A, so you want to rebuild package A and all its recursive dependencies. For that, a recursive dirclean is probably more appropriate:
$(1)-dirclean-recursive: $(1)-dirclean $$(patsubst %,%-dirclean-recursive,$$($(2)_FINAL_ALL_DEPENDENCIES))
Quoted 5 lines
Not exactly the same i guess, i think this will rebuild package A and all its dependencies (we are going "down" on dependencies).
The point of this script is to rebuild package A and all those who depends on it (we are going "up" on dependencies).
Based on previous work done on the reverse-dependencies (make <pkg>-show-rdepends), this has been turned in recursive-reverse-dependencies.
Ah right of course, I was getting confused by the double r (reverse-reverse,
but of course it means recursive-reverse...).
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF