Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 4/6 v2] support/graph-depends: add option to specify output file
Date: Sun, 7 Feb 2016 00:00:56 +0100	[thread overview]
Message-ID: <20160207000056.07f4e385@free-electrons.com> (raw)
In-Reply-To: <6b52c47dc2907744732cc2da7ee6f22c2b384836.1453651102.git.yann.morin.1998@free.fr>

Dear Yann E. MORIN,

On Sun, 24 Jan 2016 17:02:39 +0100, Yann E. MORIN wrote:

> diff --git a/Makefile b/Makefile
> index 17c181b..20927de 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -721,8 +721,10 @@ graph-depends: graph-depends-requirements
>  	@$(INSTALL) -d $(GRAPHS_DIR)
>  	@cd "$(CONFIG_DIR)"; \
>  	$(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
> -	|tee $(GRAPHS_DIR)/$(@).dot \
> -	|dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT)
> +		-o $(GRAPHS_DIR)/$(@).dot
> +	dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) \
> +		-o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT) \
> +		<$(GRAPHS_DIR)/$(@).dot

I don't think the < redirect to feed the .dot file to the dot program
is needed. You can simply pass the .dot file path as argument IIRC.

> +			$$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \
> +				-p $(1) -o $$(GRAPHS_DIR)/$$(@).dot
> +			dot $$(BR2_GRAPH_DOT_OPTS) -T$$(BR_GRAPH_OUT) \
> +				-o $$(GRAPHS_DIR)/$$(@).$$(BR_GRAPH_OUT) \
> +				<$$(GRAPHS_DIR)/$$(@).dot

Same comment.

>  parser = argparse.ArgumentParser(description="Graph packages dependencies")
> +parser.add_argument("--output", "-o", metavar="DOT_FILE", dest="dotfile",
> +                    help="File in which to generate the dot program")

Why do you call the dot file a "program" ? Is this really part of the
normal terminology for Graphviz/dot ?

>  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,
> @@ -60,6 +62,11 @@ parser.add_argument("--no-transitive", dest="transitive", action='store_false',
>                      help="Draw (do not draw) transitive dependencies")
>  args = parser.parse_args()
>  
> +if args.dotfile is None:
> +    outfile = sys.stdout
> +else:
> +    outfile = open(args.dotfile, "wb")

This is really nitpicking, but why use args.dotfile and then outfile?
It would be better to use consistent naming here, i.e either
args.dotfile/dotfile or args.outfile/outfile, but not a mix.

Otherwise looks good, and is indeed a good idea. Note that pedantically
speaking, the graph-depends change could have been made separately from
the Makefile change, since your graph-depends change ensures that the
behavior doesn't change when the -o option is not passed.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2016-02-06 23:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 16:02 [Buildroot] [pull request v2] Detect and fix circular dependencies Yann E. MORIN
2016-01-24 16:02 ` [Buildroot] [PATCH 1/6 v2] package/libgtk2: break a circular dependency Yann E. MORIN
2016-02-06 22:46   ` Thomas Petazzoni
2016-02-06 22:53     ` Yann E. MORIN
2016-02-06 23:02       ` Thomas Petazzoni
2016-01-24 16:02 ` [Buildroot] [PATCH 2/6 v2] package/libgtk3: " Yann E. MORIN
2016-01-24 16:02 ` [Buildroot] [PATCH 3/6 v2] support/graph-depends: detect circular dependencies Yann E. MORIN
2016-01-24 16:02 ` [Buildroot] [PATCH 4/6 v2] support/graph-depends: add option to specify output file Yann E. MORIN
2016-02-06 23:00   ` Thomas Petazzoni [this message]
2016-01-24 16:02 ` [Buildroot] [PATCH 5/6 v2] support/graph-depends: teach it to only check dependencies Yann E. MORIN
2016-01-24 16:02 ` [Buildroot] [PATCH 6/6 v2] core: add a make target to check the dependencies Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160207000056.07f4e385@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox