All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
@ 2014-05-06 22:44 Yann E. MORIN
  2014-05-09  9:52 ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2014-05-06 22:44 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

Currently, all the dependencies of a package are drawn on the dependency
graph, including transitive dependencies (e.g. A->B->C and A->C).

Very big graphs, with lots of packages with lots of dependencies, the
dependency graph can be very dense, and transitive dependencies are
cluttering the graph.

In some cases, only getting the "build-order" dependencies is enough (e.g.
to see what impact a package rebuild would have).

Add a new environment variable to disable drawing transitive dependencies.

Basically, it would turn this graph:

    pkg1 ---> pkg2 ---> pkg3 -------------------.
         |\__________/                 \         \
         |\____________________         \         \
         |                     \         \         \
          `-> pkg4 ---> pkg5 ---> pkg6 ---> pkg7 ---> pkg8
                    \__________/

into that graph:

    pkg1 ---> pkg2 ---> pkg3 -----------.
         |                               \
          `-> pkg4 ---> pkg5 ---> pkg6 ---> pkg7 ---> pkg8

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>

---
Note: some graphs showing the results are there:
    http://ymorin.is-a-geek.org/download/tmp/graphs/
---
 Makefile                      |  9 +++++++--
 package/pkg-generic.mk        |  2 +-
 support/scripts/graph-depends | 45 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2f18aab..5c71cd7 100644
--- a/Makefile
+++ b/Makefile
@@ -150,7 +150,12 @@ endif
 # Need that early, before we scan packages
 # Avoids doing the $(or...) everytime
 BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
-BR_GRAPH_DEPTH := $(or $(BR2_GRAPH_DEPTH),0)
+BR_GRAPH_DEPS_OPTS := --depth $(or $(BR2_GRAPH_DEPTH),0)
+ifeq ($(BR2_GRAPH_NO_TRANSITIVE),)
+BR_GRAPH_DEPS_OPTS += --transitive
+else
+BR_GRAPH_DEPS_OPTS += --no-transitive
+endif
 
 BUILD_DIR := $(BASE_DIR)/build
 BINARIES_DIR := $(BASE_DIR)/images
@@ -674,7 +679,7 @@ graph-build: $(O)/build/build-time.log
 graph-depends:
 	@$(INSTALL) -d $(O)/graphs
 	@cd "$(CONFIG_DIR)"; \
-	$(TOPDIR)/support/scripts/graph-depends -d $(BR_GRAPH_DEPTH) \
+	$(TOPDIR)/support/scripts/graph-depends $(BR_GRAPH_DEPS_OPTS) \
 	|tee $(O)/graphs/$(@).dot \
 	|dot -T$(BR_GRAPH_OUT) -o $(O)/graphs/$(@).$(BR_GRAPH_OUT)
 
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index cf02210..6b53746 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -495,7 +495,7 @@ $(1)-show-depends:
 $(1)-graph-depends:
 			@$(INSTALL) -d $(O)/graphs
 			@cd "$(CONFIG_DIR)"; \
-			$(TOPDIR)/support/scripts/graph-depends -p $(1) -d $(BR_GRAPH_DEPTH) \
+			$(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR_GRAPH_DEPS_OPTS) \
 			|tee $(O)/graphs/$$(@).dot \
 			|dot -T$(BR_GRAPH_OUT) -o $(O)/graphs/$$(@).$(BR_GRAPH_OUT)
 
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index e2a5e1e..4195646 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -40,6 +40,9 @@ parser.add_argument("--package", '-p', metavar="PACKAGE",
                     help="Graph the dependencies of PACKAGE")
 parser.add_argument("--depth", '-d', metavar="DEPTH",
                     help="Limit the dependency graph to DEPTH levels")
+parser.add_argument("--transitive", dest="transitive", action='store_true')
+parser.add_argument("--no-transitive", dest="transitive", action='store_false')
+parser.set_defaults(transitive=True)
 args = parser.parse_args()
 
 if args.package is None:
@@ -51,6 +54,8 @@ else:
 if args.depth is not None:
     max_depth = int(args.depth)
 
+transitive = args.transitive
+
 allpkgs = []
 
 # Execute the "make show-targets" command to get the list of the main
@@ -220,6 +225,46 @@ for dep in dependencies:
         dict_deps[dep[0]] = []
     dict_deps[dep[0]].append(dep[1])
 
+# This function return True if pkg is a dependency (direct or
+# transitive) of pkg2, dependencies being listed in the deps
+# dictionary.
+def is_dep(pkg,pkg2,deps):
+    if deps.has_key(pkg2):
+        for p in deps[pkg2]:
+            if pkg == p:
+                return True
+            if is_dep(pkg,p,deps):
+                return True
+    return False
+
+# This function eliminates transitive dependencies; for example, given
+# these dependency chain: A->{B,C} and B->{C}, the A->{C} dependency is
+# already covered by B->{C}, so C is a transitive dependency of A, via B.
+# The functions does:
+#   - for each package 'pkg' (for which we have a dependency list):
+#     - for each dependency d[i] of that package
+#       - if d[i] is a dependency of any of the other dependency d[j]
+#         - do not keep d[i]
+#       - otherwise keep d[i] 
+def remove_transitive_deps(deps):
+    new_dict_deps = {}
+    for pkg in deps.keys():
+        d = deps[pkg]
+        new_dict_deps[pkg] = []
+        for i in range(len(d)):
+            add_me = True
+            for j in range(len(d)):
+                if j==i:
+                    continue
+                if is_dep(d[i],d[j],deps):
+                    add_me = False
+            if add_me:
+                new_dict_deps[pkg].append(d[i])
+    return new_dict_deps
+
+if not transitive:
+    dict_deps = remove_transitive_deps(dict_deps)
+
 # Print the attributes of a node: label and fill-color
 def print_attrs(pkg):
     if pkg == 'all':
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-06 22:44 [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph Yann E. MORIN
@ 2014-05-09  9:52 ` Yann E. MORIN
  2014-05-09 10:00   ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2014-05-09  9:52 UTC (permalink / raw)
  To: buildroot

All,

On 2014-05-07 00:44 +0200, Yann E. MORIN spake thusly:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> Currently, all the dependencies of a package are drawn on the dependency
> graph, including transitive dependencies (e.g. A->B->C and A->C).
> 
> Very big graphs, with lots of packages with lots of dependencies, the
> dependency graph can be very dense, and transitive dependencies are
> cluttering the graph.
> 
> In some cases, only getting the "build-order" dependencies is enough (e.g.
> to see what impact a package rebuild would have).
> 
> Add a new environment variable to disable drawing transitive dependencies.

I've marked it as Changes Requested in PAtchwork, since I have a cleaner
patch to come soon, with other cleanups in the graph-depends script.

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] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09  9:52 ` Yann E. MORIN
@ 2014-05-09 10:00   ` Peter Korsgaard
  2014-05-09 10:20     ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2014-05-09 10:00 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 > All,
 > On 2014-05-07 00:44 +0200, Yann E. MORIN spake thusly:
 >> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 >> 
 >> Currently, all the dependencies of a package are drawn on the dependency
 >> graph, including transitive dependencies (e.g. A->B->C and A->C).
 >> 
 >> Very big graphs, with lots of packages with lots of dependencies, the
 >> dependency graph can be very dense, and transitive dependencies are
 >> cluttering the graph.
 >> 
 >> In some cases, only getting the "build-order" dependencies is enough (e.g.
 >> to see what impact a package rebuild would have).
 >> 
 >> Add a new environment variable to disable drawing transitive dependencies.

 > I've marked it as Changes Requested in PAtchwork, since I have a cleaner
 > patch to come soon, with other cleanups in the graph-depends script.

Thanks. Like I mentioned on IRC I do like the looks of the graphs, but
I'm not really happy with the use of environment variables to control
it, as it isn't intuitive.

Perhaps we should simply have kconfig options for these things?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 10:00   ` Peter Korsgaard
@ 2014-05-09 10:20     ` Yann E. MORIN
  2014-05-09 11:16       ` Samuel Martin
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2014-05-09 10:20 UTC (permalink / raw)
  To: buildroot

Peter, All,

On 2014-05-09 12:00 +0200, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>  > On 2014-05-07 00:44 +0200, Yann E. MORIN spake thusly:
>  >> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  >> 
>  >> Currently, all the dependencies of a package are drawn on the dependency
>  >> graph, including transitive dependencies (e.g. A->B->C and A->C).
>  >> 
>  >> Very big graphs, with lots of packages with lots of dependencies, the
>  >> dependency graph can be very dense, and transitive dependencies are
>  >> cluttering the graph.
>  >> 
>  >> In some cases, only getting the "build-order" dependencies is enough (e.g.
>  >> to see what impact a package rebuild would have).
>  >> 
>  >> Add a new environment variable to disable drawing transitive dependencies.
> 
>  > I've marked it as Changes Requested in PAtchwork, since I have a cleaner
>  > patch to come soon, with other cleanups in the graph-depends script.
> 
> Thanks. Like I mentioned on IRC I do like the looks of the graphs, but
> I'm not really happy with the use of environment variables to control
> it, as it isn't intuitive.
> 
> Perhaps we should simply have kconfig options for these things?

As I said on IRC, I doubt this would be usefull, For example:

  - for depth: someone might want a 3-level deep graph for some package,
    and a 4-level deep graph for another,

  - for transitive deps: someone would like the complete dependencies
    graphed for some package, and only the 'build-order' deps for some
    another.

This means the user would have to go back to the menuconfig between each
graph, and this could not be made automatic (eg. called from within a
script that generates the graphs for the documentation of the project.)

What we could do, however, would be something like:

    make BR2_GRAPH_OPTS='--depth 4 --no-transitive' graph-depends

(the existing BR2_GRPAH_DEPS would disapear).

Thoughts?

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] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 10:20     ` Yann E. MORIN
@ 2014-05-09 11:16       ` Samuel Martin
  2014-05-09 13:34         ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Martin @ 2014-05-09 11:16 UTC (permalink / raw)
  To: buildroot

Hi Yann, Peter, all

On Fri, May 9, 2014 at 12:20 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Peter, All,
>
> On 2014-05-09 12:00 +0200, Peter Korsgaard spake thusly:
>> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>>  > On 2014-05-07 00:44 +0200, Yann E. MORIN spake thusly:
>>  >> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
>>  >>
>>  >> Currently, all the dependencies of a package are drawn on the dependency
>>  >> graph, including transitive dependencies (e.g. A->B->C and A->C).
>>  >>
>>  >> Very big graphs, with lots of packages with lots of dependencies, the
>>  >> dependency graph can be very dense, and transitive dependencies are
>>  >> cluttering the graph.
>>  >>
>>  >> In some cases, only getting the "build-order" dependencies is enough (e.g.
>>  >> to see what impact a package rebuild would have).
>>  >>
>>  >> Add a new environment variable to disable drawing transitive dependencies.
>>
>>  > I've marked it as Changes Requested in PAtchwork, since I have a cleaner
>>  > patch to come soon, with other cleanups in the graph-depends script.
>>
>> Thanks. Like I mentioned on IRC I do like the looks of the graphs, but
>> I'm not really happy with the use of environment variables to control
>> it, as it isn't intuitive.

I'm not a big fan of env. vars. either.

>>
>> Perhaps we should simply have kconfig options for these things?
>
> As I said on IRC, I doubt this would be usefull, For example:
>
>   - for depth: someone might want a 3-level deep graph for some package,
>     and a 4-level deep graph for another,
>
>   - for transitive deps: someone would like the complete dependencies
>     graphed for some package, and only the 'build-order' deps for some
>     another.
>
> This means the user would have to go back to the menuconfig between each
> graph, and this could not be made automatic (eg. called from within a
> script that generates the graphs for the documentation of the project.)
>
> What we could do, however, would be something like:
>
>     make BR2_GRAPH_OPTS='--depth 4 --no-transitive' graph-depends
>
> (the existing BR2_GRPAH_DEPS would disapear).
>
> Thoughts?

An alternaitve solution could be using a config file; Python has some
packages for this [1] ;-).
This way, the config file could be initialized with what is set in the
menuconfig, so used as defaults.
If some options are passed on the command line, they will override
these defaults.
If someone wants to do something more fancy and automatic, then one
just could update the config file.

[1] https://docs.python.org/2.7/library/configparser.html

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 11:16       ` Samuel Martin
@ 2014-05-09 13:34         ` Yann E. MORIN
  2014-05-09 14:09           ` Samuel Martin
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2014-05-09 13:34 UTC (permalink / raw)
  To: buildroot

Samuel, All,

On 2014-05-09 13:16 +0200, Samuel Martin spake thusly:
> > On 2014-05-09 12:00 +0200, Peter Korsgaard spake thusly:
[--SNIP--]
> >> Thanks. Like I mentioned on IRC I do like the looks of the graphs, but
> >> I'm not really happy with the use of environment variables to control
> >> it, as it isn't intuitive.
> 
> I'm not a big fan of env. vars. either.
[--SNIP--]
> An alternaitve solution could be using a config file; Python has some
> packages for this [1] ;-).
> This way, the config file could be initialized with what is set in the
> menuconfig, so used as defaults.
> If some options are passed on the command line, they will override
> these defaults.
> If someone wants to do something more fancy and automatic, then one
> just could update the config file.

Well, this does not solve the issue at hand: how do we pass options on
the command line in the first place?

We added 'graph-depends' and 'PKG-graph-depends' (and 'graph-build'
too) as make targets so it was easier for users to generate the graphs
rather than directly call the scripts (since the scripts could even
reside in another dir when building out-of-tree, and it would be more
complex to reach for the scripts).

Adding a config file would not help much either: modifying the config
file can't easily be automated, which is all the point in being able to
pass extra args when generating the graphs.

There are people out there using a bunch of graphs to include in their
projects' documentations, in an automated way.

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] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 13:34         ` Yann E. MORIN
@ 2014-05-09 14:09           ` Samuel Martin
  2014-05-09 14:38             ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Martin @ 2014-05-09 14:09 UTC (permalink / raw)
  To: buildroot

Yann, all,

On Fri, May 9, 2014 at 3:34 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Samuel, All,
>
> On 2014-05-09 13:16 +0200, Samuel Martin spake thusly:
>> > On 2014-05-09 12:00 +0200, Peter Korsgaard spake thusly:
> [--SNIP--]
>> >> Thanks. Like I mentioned on IRC I do like the looks of the graphs, but
>> >> I'm not really happy with the use of environment variables to control
>> >> it, as it isn't intuitive.
>>
>> I'm not a big fan of env. vars. either.
> [--SNIP--]
>> An alternaitve solution could be using a config file; Python has some
>> packages for this [1] ;-).
>> This way, the config file could be initialized with what is set in the
>> menuconfig, so used as defaults.
>> If some options are passed on the command line, they will override
>> these defaults.
>> If someone wants to do something more fancy and automatic, then one
>> just could update the config file.
>
> Well, this does not solve the issue at hand: how do we pass options on
> the command line in the first place?
>
> We added 'graph-depends' and 'PKG-graph-depends' (and 'graph-build'
> too) as make targets so it was easier for users to generate the graphs
> rather than directly call the scripts (since the scripts could even
> reside in another dir when building out-of-tree, and it would be more
> complex to reach for the scripts).

Arf! I forgot this.

In this case, I would do:
- to get the default graph:
  make foo-graph-depends
- to get a customized graph:
  make foo-graph-depends BR2_GRAPH_DEPS_OPTS="..."

And I'd expect to find some help somewhere in the doc to know what are
the supported options, or how to get the graph-depends help, so via
the manual or in the help message of the BR2_GRAPH_DEPS_OPTS kconfig
entry.

So, in the end, the call to graph-depends script would just be:
  $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS)
or:
  $(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR2_GRAPH_DEPS_OPTS)

No black magics with the args... just keep it simple ;-)
"Buildroot is a simple, efficient and easy-to-use tool" (not from me,
from http://buildroot.org/ :-])

my 2 cents

>
> Adding a config file would not help much either: modifying the config
> file can't easily be automated, which is all the point in being able to
> pass extra args when generating the graphs.

right.

Regards,


-- 
Samuel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 14:09           ` Samuel Martin
@ 2014-05-09 14:38             ` Yann E. MORIN
  2014-05-09 15:07               ` Samuel Martin
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2014-05-09 14:38 UTC (permalink / raw)
  To: buildroot

Samuel, All,

On 2014-05-09 16:09 +0200, Samuel Martin spake thusly:
> On Fri, May 9, 2014 at 3:34 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > too) as make targets so it was easier for users to generate the graphs
> > rather than directly call the scripts (since the scripts could even
> > reside in another dir when building out-of-tree, and it would be more
> > complex to reach for the scripts).
> 
> Arf! I forgot this.
> 
> In this case, I would do:
> - to get the default graph:
>   make foo-graph-depends
> - to get a customized graph:
>   make foo-graph-depends BR2_GRAPH_DEPS_OPTS="..."

A single variable is not enough, since we have options:

  - for support/scripts/graph-depends: maximum depth, transitive deps or
    not

  - the 'dot' utilities: draw top-down or left-right, and so on...

So either greaph-depends has to understand a subset (or all) of dot's
options (Eeek!), or we offer two variables.

> And I'd expect to find some help somewhere in the doc to know what are
> the supported options,

Already in the manual, section 3.5, "Daily use" and sub-sections:

    3.5.7. Graphing the dependencies between packages
    http://buildroot.net/downloads/manual/manual.html#_graphing_the_dependencies_between_packages

    3.5.8. Graphing the build duration
    http://buildroot.net/downloads/manual/manual.html#_graphing_the_build_duration

    3.5.5. Environment variables
    http://buildroot.net/downloads/manual/manual.html#env-vars

> or how to get the graph-depends help, so via
> the manual or in the help message of the BR2_GRAPH_DEPS_OPTS kconfig
> entry.

We already document the mere existence of graph-build, graph-depends and
PKG-graph-depends inthe output of make help:

    <package>-graph-depends    - generate graph of the dependency tree
                                 for package
    graph-build            - generate graphs of the build times
    graph-depends          - generate graph of the dependency tree

But the variables are only documented in the manual (see above.)

> So, in the end, the call to graph-depends script would just be:
>   $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS)
> or:
>   $(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR2_GRAPH_DEPS_OPTS)

Not really, it currently is (roughly):

    $(TOPDIR)/support/scripts/graph-depends -d $(DEPTH) \
    |tee $(O)/graphs/$(@).dot \
    |dot $(DOT_OPTS) -o$(O)/graphs/$(@).$(BR_GRAPH_OUT)

support/scripts/graph-depends /only/ generates a dot program, not the
graph itself.

> No black magics with the args... just keep it simple ;-)
> "Buildroot is a simple, efficient and easy-to-use tool" (not from me,
> from http://buildroot.org/ :-])

Yes, but all the alternate solutions are ending being more complex that
mere environment variables.

Grantes, I do not like the environment variables much, since it is easy
to forget them on a subsequent make. That's why my series (I still have
to post it) gets rid of as many variables as possible.

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] 9+ messages in thread

* [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph
  2014-05-09 14:38             ` Yann E. MORIN
@ 2014-05-09 15:07               ` Samuel Martin
  0 siblings, 0 replies; 9+ messages in thread
From: Samuel Martin @ 2014-05-09 15:07 UTC (permalink / raw)
  To: buildroot

On Fri, May 9, 2014 at 4:38 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Samuel, All,
>
> On 2014-05-09 16:09 +0200, Samuel Martin spake thusly:
>> On Fri, May 9, 2014 at 3:34 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> > too) as make targets so it was easier for users to generate the graphs
>> > rather than directly call the scripts (since the scripts could even
>> > reside in another dir when building out-of-tree, and it would be more
>> > complex to reach for the scripts).
>>
>> Arf! I forgot this.
>>
>> In this case, I would do:
>> - to get the default graph:
>>   make foo-graph-depends
>> - to get a customized graph:
>>   make foo-graph-depends BR2_GRAPH_DEPS_OPTS="..."
>
> A single variable is not enough, since we have options:
>
>   - for support/scripts/graph-depends: maximum depth, transitive deps or
>     not
>
>   - the 'dot' utilities: draw top-down or left-right, and so on...
>
> So either greaph-depends has to understand a subset (or all) of dot's
> options (Eeek!), or we offer two variables.
>
>> And I'd expect to find some help somewhere in the doc to know what are
>> the supported options,
>
> Already in the manual, section 3.5, "Daily use" and sub-sections:
>
>     3.5.7. Graphing the dependencies between packages
>     http://buildroot.net/downloads/manual/manual.html#_graphing_the_dependencies_between_packages
>
>     3.5.8. Graphing the build duration
>     http://buildroot.net/downloads/manual/manual.html#_graphing_the_build_duration
>
>     3.5.5. Environment variables
>     http://buildroot.net/downloads/manual/manual.html#env-vars
>
>> or how to get the graph-depends help, so via
>> the manual or in the help message of the BR2_GRAPH_DEPS_OPTS kconfig
>> entry.
>
> We already document the mere existence of graph-build, graph-depends and
> PKG-graph-depends inthe output of make help:
>
>     <package>-graph-depends    - generate graph of the dependency tree
>                                  for package
>     graph-build            - generate graphs of the build times
>     graph-depends          - generate graph of the dependency tree
>
> But the variables are only documented in the manual (see above.)
>
>> So, in the end, the call to graph-depends script would just be:
>>   $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS)
>> or:
>>   $(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR2_GRAPH_DEPS_OPTS)
>
> Not really, it currently is (roughly):
>
>     $(TOPDIR)/support/scripts/graph-depends -d $(DEPTH) \
>     |tee $(O)/graphs/$(@).dot \
>     |dot $(DOT_OPTS) -o$(O)/graphs/$(@).$(BR_GRAPH_OUT)
>
> support/scripts/graph-depends /only/ generates a dot program, not the
> graph itself.

/me thinking at the same time i'm writing...

It's a bit weird to me to have to pass dot options... but it's dot
that generate the graph, so I see 2 options:
- in all cases, I think it's better to have a choice to select the
output format;
- option 1) BR2_GRAPH_DEPS_OPTS accepts dot options after "--", so the
graph-depends script should call itself the dot program;
- option 2) BR2_GRAPH_DEPS_OPTS is for graph-depends only, and we add
a 3rd kconfig entry for dot option.

Wild thought: do we check for the presence of dot program?


-- 
Samuel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-05-09 15:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 22:44 [Buildroot] [PATCH] graphs: add option to remove transitive dependencies in dependency graph Yann E. MORIN
2014-05-09  9:52 ` Yann E. MORIN
2014-05-09 10:00   ` Peter Korsgaard
2014-05-09 10:20     ` Yann E. MORIN
2014-05-09 11:16       ` Samuel Martin
2014-05-09 13:34         ` Yann E. MORIN
2014-05-09 14:09           ` Samuel Martin
2014-05-09 14:38             ` Yann E. MORIN
2014-05-09 15:07               ` Samuel Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.