Skip to contentSkip to conversation

manual: add prerequisites for graph generation

PATCH New Fabio Porcedda 3 participants 8 messages Jun 13, 2014 – Jun 17, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 manual: add prerequisites for graph generation

Add "graphviz" and "python-matplotlib" as prerequisites for graph generation.

---
 docs/manual/prerequisite.txt | 4 ++++
 1 file changed, 4 insertions(+)
docs/manual/prerequisite.txt +4 -0
index c5d5442..ffe86dd 100644
@@ -77,3 +77,7 @@ development context (further details: refer to xref:download-infra[]).
 ** +w3m+
 ** +python+ with the +argparse+ module (automatically present in 2.7+ and 3.2+)
 ** +dblatex+ (required for the pdf manual only)
+
+* Graph generation tools:
+** +graphviz+
+** +python-matplotlib+ to use 'graph-build'
Signature · 1 line
2.0.0
#1 lore raw

PATCH 2/2 Makefile: test if "dot" exists in graph-build and <pkg>-graph-depends

Because the "dot" command availability was checked only for the "graph-depends" target so move the check to the "graph-prerequisites" target to be able to check the "dot" command availability for all the graph generation targets.

Cc Thomas Petazzoni <[email protected]>
Cc Yann E. MORIN <[email protected]>
---
 Makefile               | 8 ++++++--
 package/pkg-generic.mk | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
Makefile +6 -2
index 86acbbf..3e395b5 100644
@@ -658,7 +658,11 @@ legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
 show-targets:
 	@echo $(HOST_DEPS) $(TARGETS_HOST_DEPS) $(TARGETS) $(TARGETS_ROOTFS)
 
-graph-build: $(O)/build/build-time.log
+graph-prerequisites:
+	@dot -? >/dev/null 2>&1 || \
+		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)
+
+graph-build: $(O)/build/build-time.log graph-prerequisites
 	@install -d $(O)/graphs
 	$(foreach o,name build duration,./support/scripts/graph-build-time \
 					--type=histogram --order=$(o) --input=$(<) \
@@ -669,7 +673,7 @@ graph-build: $(O)/build/build-time.log
 				   --output=$(O)/graphs/build.pie-$(t).$(BR_GRAPH_OUT) \
 				   $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
 
-graph-depends:
+graph-depends: graph-prerequisites
 	@dot -? >/dev/null 2>&1 || \
 		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)
 	@$(INSTALL) -d $(O)/graphs
package/pkg-generic.mk +1 -1
index ccd7f3b..752392d 100644
@@ -531,7 +531,7 @@ endif
 $(1)-show-depends:
 			@echo $$($(2)_FINAL_DEPENDENCIES)
 
-$(1)-graph-depends:
+$(1)-graph-depends: graph-prerequisites
 			@$(INSTALL) -d $(O)/graphs
 			@cd "$(CONFIG_DIR)"; \
 			$(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR2_GRAPH_DEPS_OPTS) \
Signature · 1 line
2.0.0
#2 lore raw

PATCH 2/2 Makefile: test if "dot" exists in graph-build and <pkg>-graph-depends

Fabio, All,

On 2014-06-13 19:06 +0200, Fabio Porcedda spake thusly:

Quoted 18 lines

Because the "dot" command availability was checked only for the "graph-depends" target so move the check to the "graph-prerequisites" target to be able to check the "dot" command availability for all the graph generation targets.

Cc Thomas Petazzoni <[email protected]>
Cc Yann E. MORIN <[email protected]>
---
 Makefile               | 8 ++++++--
 package/pkg-generic.mk | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
Makefile +0 -0
index 86acbbf..3e395b5 100644

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 663

Quoted 7 lines
Makefile +3 -1
@@ -658,7 +658,11 @@ legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
 show-targets:
 	@echo $(HOST_DEPS) $(TARGETS_HOST_DEPS) $(TARGETS) $(TARGETS_ROOTFS)
 
-graph-build: $(O)/build/build-time.log
+graph-prerequisites:
+	@dot -? >/dev/null 2>&1 || \
+		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)

While at it, the usual convention for this construct it to not use a sub-shell, but use:

    thing-to-test || {echo MESSAGE >&2; exit 1;}

Yes, the last semi-colon is needed.

Because some shells might not corectly error out when a sub-shell exits with a non-zero error code (ie. it was the case in a previous version of bash.)

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 665

Quoted 1 line
Makefile +1 -0
+graph-build: $(O)/build/build-time.log graph-prerequisites

graph-build does not use 'dot', it uses matplotlib internally, so should probably not depend on graph-prerequisites.

Makefile graph-build: $(O)/build/build-time.log · line 678

Quoted 11 lines
Makefile +1 -1
 	@install -d $(O)/graphs
 	$(foreach o,name build duration,./support/scripts/graph-build-time \
 					--type=histogram --order=$(o) --input=$(<) \
@@ -669,7 +673,7 @@ graph-build: $(O)/build/build-time.log
 				   --output=$(O)/graphs/build.pie-$(t).$(BR_GRAPH_OUT) \
 				   $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
 
-graph-depends:
+graph-depends: graph-prerequisites
 	@dot -? >/dev/null 2>&1 || \
 		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)

Then you should probably remove the check here, no?

Regards,
Yann E. MORIN.

Quoted 17 lines
Makefile +0 -0
 	@$(INSTALL) -d $(O)/graphs
package/pkg-generic.mk +1 -1
index ccd7f3b..752392d 100644
@@ -531,7 +531,7 @@ endif
 $(1)-show-depends:
 			@echo $$($(2)_FINAL_DEPENDENCIES)
 
-$(1)-graph-depends:
+$(1)-graph-depends: graph-prerequisites
 			@$(INSTALL) -d $(O)/graphs
 			@cd "$(CONFIG_DIR)"; \
 			$(TOPDIR)/support/scripts/graph-depends -p $(1) $(BR2_GRAPH_DEPS_OPTS) \
Signature · 1 line
2.0.0
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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 2/2 Makefile: test if "dot" exists in graph-build and <pkg>-graph-depends

Quoted 31 lines · Yann E. MORIN

Fabio, All,

On 2014-06-13 19:06 +0200, Fabio Porcedda spake thusly:

Quoted 18 lines

Because the "dot" command availability was checked only for the "graph-depends" target so move the check to the "graph-prerequisites" target to be able to check the "dot" command availability for all the graph generation targets.

Cc Thomas Petazzoni <[email protected]>
Cc Yann E. MORIN <[email protected]>
---
 Makefile               | 8 ++++++--
 package/pkg-generic.mk | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
Makefile +0 -0
index 86acbbf..3e395b5 100644

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 663

Quoted 7 lines
Makefile +3 -1
@@ -658,7 +658,11 @@ legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
 show-targets:
      @echo $(HOST_DEPS) $(TARGETS_HOST_DEPS) $(TARGETS) $(TARGETS_ROOTFS)
 
-graph-build: $(O)/build/build-time.log
+graph-prerequisites:
+     @dot -? >/dev/null 2>&1 || \
+             (echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)

While at it, the usual convention for this construct it to not use a sub-shell, but use:

Quoted 7 lines
    thing-to-test || {echo MESSAGE >&2; exit 1;}

Yes, the last semi-colon is needed.

Because some shells might not corectly error out when a sub-shell exits with a non-zero error code (ie. it was the case in a previous version of bash.)

Thanks, fixed.

Quoted 4 lines

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 665

Quoted 1 line
Makefile +1 -0
+graph-build: $(O)/build/build-time.log graph-prerequisites

graph-build does not use 'dot', it uses matplotlib internally, so should probably not depend on graph-prerequisites.

Thanks, fixed.

Quoted 7 lines
Quoted 7 lines
Makefile +0 -0
      @install -d $(O)/graphs
      $(foreach o,name build duration,./support/scripts/graph-build-time \
                                      --type=histogram --order=$(o) --input=$(<) \
@@ -669,7 +673,7 @@ graph-build: $(O)/build/build-time.log
                                 --output=$(O)/graphs/build.pie-$(t).$(BR_GRAPH_OUT) \
                                 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
 
Quoted 6 lines

Makefile graph-build: $(O)/build/build-time.log · line 678

Quoted 4 lines
Makefile +1 -1
-graph-depends:
+graph-depends: graph-prerequisites
      @dot -? >/dev/null 2>&1 || \
              (echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)

Then you should probably remove the check here, no?

Thanks, fixed.

<snip>

Best regards

Signature · 1 line
Fabio Porcedda
#4 lore raw

PATCH 2/2 Makefile: test if "dot" exists in graph-build and <pkg>-graph-depends

In reply to Fabio Porcedda

Dear Fabio Porcedda,

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 665

Quoted 6 lines · Fabio Porcedda
Makefile +5 -1
-graph-build: $(O)/build/build-time.log
+graph-prerequisites:
+	@dot -? >/dev/null 2>&1 || \
+		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)
+
+graph-build: $(O)/build/build-time.log graph-prerequisites

This is wrong: graph-build does not need the dot program, it's just a Python script that uses matplotlib.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 2/2 Makefile: test if "dot" exists in graph-build and <pkg>-graph-depends

Quoted 4 lines · Thomas Petazzoni

Dear Fabio Porcedda,

On Fri, 13 Jun 2014 19:06:48 +0200, Fabio Porcedda wrote:

Quoted 9 lines

Makefile legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \ · line 665

Quoted 6 lines
Makefile +5 -1
-graph-build: $(O)/build/build-time.log
+graph-prerequisites:
+     @dot -? >/dev/null 2>&1 || \
+             (echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1)
+
+graph-build: $(O)/build/build-time.log graph-prerequisites

This is wrong: graph-build does not need the dot program, it's just a Python script that uses matplotlib.

Thanks, fixed.

Best regards

Signature · 1 line
Fabio Porcedda
#6 lore raw

PATCH 1/2 manual: add prerequisites for graph generation

In reply to Fabio Porcedda

Fabio, All,

On 2014-06-13 19:06 +0200, Fabio Porcedda spake thusly:

Quoted 16 lines

Add "graphviz" and "python-matplotlib" as prerequisites for graph generation.

---
 docs/manual/prerequisite.txt | 4 ++++
 1 file changed, 4 insertions(+)
docs/manual/prerequisite.txt +0 -0
index c5d5442..ffe86dd 100644

docs/manual/prerequisite.txt development context (further details: refer to xref:download-infra[]). · line 82

Quoted 6 lines
docs/manual/prerequisite.txt +3 -0
@@ -77,3 +77,7 @@ development context (further details: refer to xref:download-infra[]).
 ** +w3m+
 ** +python+ with the +argparse+ module (automatically present in 2.7+ and 3.2+)
 ** +dblatex+ (required for the pdf manual only)
+
+* Graph generation tools:
+** +graphviz+

graphviz is only for the graph-depends.

Regards,
Yann E. MORIN.

Quoted 4 lines
docs/manual/prerequisite.txt +1 -0
+** +python-matplotlib+ to use 'graph-build'
Signature · 1 line
2.0.0
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.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/2 manual: add prerequisites for graph generation

Quoted 14 lines · Yann E. MORIN

Fabio, All,

On 2014-06-13 19:06 +0200, Fabio Porcedda spake thusly:

Quoted 11 lines

Add "graphviz" and "python-matplotlib" as prerequisites for graph generation.

---
 docs/manual/prerequisite.txt | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 13 lines

docs/manual/prerequisite.txt development context (further details: refer to xref:download-infra[]). · line 82

Quoted 11 lines
docs/manual/prerequisite.txt +3 -0
index c5d5442..ffe86dd 100644
@@ -77,3 +77,7 @@ development context (further details: refer to xref:download-infra[]).
 ** +w3m+
 ** +python+ with the +argparse+ module (automatically present in 2.7+ and 3.2+)
 ** +dblatex+ (required for the pdf manual only)
+
+* Graph generation tools:
+** +graphviz+

graphviz is only for the graph-depends.

Thanks, fixed.

Best regards

Signature · 1 line
Fabio Porcedda