From patchwork Thu Apr 27 15:04:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Redivo X-Patchwork-Id: 756075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wDKxV53MJz9sNJ for ; Fri, 28 Apr 2017 01:05:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1A19882321; Thu, 27 Apr 2017 15:05:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OztKmlMGUnHV; Thu, 27 Apr 2017 15:04:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id BCB09823A0; Thu, 27 Apr 2017 15:04:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 3B0401C11C3 for ; Thu, 27 Apr 2017 15:04:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3636E8956D for ; Thu, 27 Apr 2017 15:04:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nsOI8RdoTNnj for ; Thu, 27 Apr 2017 15:04:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 9FBA6892F6 for ; Thu, 27 Apr 2017 15:04:51 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id CB4BF16808E7; Thu, 27 Apr 2017 12:04:48 -0300 (BRT) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id BF39916808B1; Thu, 27 Apr 2017 12:04:48 -0300 (BRT) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nsFB58LxpUz1; Thu, 27 Apr 2017 12:04:48 -0300 (BRT) Received: from PEDELD169.datacom.net (pedeld169.datacom.net [10.0.120.75]) by mail.datacom.ind.br (Postfix) with ESMTPSA id AE715168082A; Thu, 27 Apr 2017 12:04:48 -0300 (BRT) From: George Redivo To: buildroot@buildroot.org Date: Thu, 27 Apr 2017 12:04:18 -0300 Message-Id: <1493305458-15309-1-git-send-email-george.redivo@datacom.ind.br> X-Mailer: git-send-email 1.9.1 Cc: Thomas Petazzoni , George Redivo Subject: [Buildroot] [PATCH 1/1] Create 'make -show-rrdepends' command X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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. Signed-off-by: George Redivo --- Makefile | 1 + package/pkg-generic.mk | 10 ++++++++++ support/scripts/graph-depends | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 919d589..61943d8 100644 --- a/Makefile +++ b/Makefile @@ -996,6 +996,7 @@ help: @echo ' -build - Build up to the build step' @echo ' -show-depends - List packages on which depends' @echo ' -show-rdepends - List packages which have as a dependency' + @echo ' -show-rrdepends - List, recursivelly, packages which have as a dependency' @echo ' -graph-depends - Generate a graph of '\''s dependencies' @echo ' -graph-rdepends - Generate a graph of '\''s reverse dependencies' @echo ' -dirclean - Remove build directory' diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 3b26e6b..c0f83b6 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -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)) diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends index b258c56..f6fec09 100755 --- a/support/scripts/graph-depends +++ b/support/scripts/graph-depends @@ -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")