diff mbox

[03/16,v3] doc/asciidoc: add possibility to define document dependencies

Message ID 8b101d01b6a1c1aaadde0649c82fba5db2c511f1.1468750623.git.yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN July 17, 2016, 10:34 a.m. UTC
Currently, a document can not have dependencies, except for the purely
internal ones (like checking asciidoc version, and presence of dblatex).

For our own manual, this will come in handy when we introduce a
generated kconfig snippet, so we can actually make the manual depend on
that snippet being generated first.

For external documents, it can be used to depend on host-packages if
need be (e.g. a custom host packages that generates specific media files
included in the manual).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Samuel Martin <s.martin49@gmail.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
---
 docs/manual/adding-packages-asciidoc.txt | 3 +++
 package/doc-asciidoc.mk                  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Romain Naour Aug. 6, 2016, 3:02 p.m. UTC | #1
Hi Yann,

Le 17/07/2016 à 12:34, Yann E. MORIN a écrit :
> Currently, a document can not have dependencies, except for the purely
> internal ones (like checking asciidoc version, and presence of dblatex).
> 
> For our own manual, this will come in handy when we introduce a
> generated kconfig snippet, so we can actually make the manual depend on
> that snippet being generated first.
> 
> For external documents, it can be used to depend on host-packages if
> need be (e.g. a custom host packages that generates specific media files
> included in the manual).

Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Samuel Martin <s.martin49@gmail.com>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> ---
>  docs/manual/adding-packages-asciidoc.txt | 3 +++
>  package/doc-asciidoc.mk                  | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/manual/adding-packages-asciidoc.txt b/docs/manual/adding-packages-asciidoc.txt
> index 6e21786..0c10fd1 100644
> --- a/docs/manual/adding-packages-asciidoc.txt
> +++ b/docs/manual/adding-packages-asciidoc.txt
> @@ -63,6 +63,9 @@ information is (assuming the document name is +foo+) :
>    to one or more directories containing so-called resources (like CSS or
>    images). By default, empty.
>  
> +* +FOO_DEPENDENCIES+, optional, the list of packages (most probably,
> +  host-packages) that must be built before building this document.
> +
>  There are also additional hooks (see xref:hooks[] for general information
>  on hooks), that a document may set to define extra actions to be done at
>  various steps:
> diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
> index 6ab5ad2..ede6ed1 100644
> --- a/package/doc-asciidoc.mk
> +++ b/package/doc-asciidoc.mk
> @@ -140,7 +140,7 @@ endef
>  ################################################################################
>  define ASCIIDOC
>  # Single line, because splitting a foreach is not easy...
> -$(1)-check-dependencies: asciidoc-check-dependencies
> +$(1)-check-dependencies: asciidoc-check-dependencies $$($(2)_DEPENDENCIES)
>  	$$(Q)$$(foreach hook,$$($(2)_CHECK_DEPENDENCIES_HOOKS),$$(call $$(hook))$$(sep))
>  
>  # Single line, because splitting a foreach is not easy...
>
Thomas Petazzoni Aug. 27, 2016, 2:14 p.m. UTC | #2
Hello,

On Sun, 17 Jul 2016 12:34:23 +0200, Yann E. MORIN wrote:

> diff --git a/docs/manual/adding-packages-asciidoc.txt b/docs/manual/adding-packages-asciidoc.txt
> index 6e21786..0c10fd1 100644
> --- a/docs/manual/adding-packages-asciidoc.txt
> +++ b/docs/manual/adding-packages-asciidoc.txt
> @@ -63,6 +63,9 @@ information is (assuming the document name is +foo+) :
>    to one or more directories containing so-called resources (like CSS or
>    images). By default, empty.
>  
> +* +FOO_DEPENDENCIES+, optional, the list of packages (most probably,
> +  host-packages) that must be built before building this document.
> +
>  There are also additional hooks (see xref:hooks[] for general information
>  on hooks), that a document may set to define extra actions to be done at
>  various steps:
> diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
> index 6ab5ad2..ede6ed1 100644
> --- a/package/doc-asciidoc.mk
> +++ b/package/doc-asciidoc.mk
> @@ -140,7 +140,7 @@ endef
>  ################################################################################
>  define ASCIIDOC
>  # Single line, because splitting a foreach is not easy...
> -$(1)-check-dependencies: asciidoc-check-dependencies
> +$(1)-check-dependencies: asciidoc-check-dependencies $$($(2)_DEPENDENCIES)

My concern is that $(2)_DEPENDENCIES has nothing to do with *checking*
dependencies, so it's a bit weird to see this added to a target called
<something>-check-dependencies.

Could you refresh me on how this $(1)-check-dependencies target is
used? I had a quick look at the code around and couldn't remember, and
wanted to look at some other patches in your series.

Thanks,

Thomas
Yann E. MORIN Aug. 27, 2016, 2:42 p.m. UTC | #3
Thomas, All,

On 2016-08-27 16:14 +0200, Thomas Petazzoni spake thusly:
> On Sun, 17 Jul 2016 12:34:23 +0200, Yann E. MORIN wrote:
> 
> > diff --git a/docs/manual/adding-packages-asciidoc.txt b/docs/manual/adding-packages-asciidoc.txt
> > index 6e21786..0c10fd1 100644
> > --- a/docs/manual/adding-packages-asciidoc.txt
> > +++ b/docs/manual/adding-packages-asciidoc.txt
> > @@ -63,6 +63,9 @@ information is (assuming the document name is +foo+) :
> >    to one or more directories containing so-called resources (like CSS or
> >    images). By default, empty.
> >  
> > +* +FOO_DEPENDENCIES+, optional, the list of packages (most probably,
> > +  host-packages) that must be built before building this document.
> > +
> >  There are also additional hooks (see xref:hooks[] for general information
> >  on hooks), that a document may set to define extra actions to be done at
> >  various steps:
> > diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
> > index 6ab5ad2..ede6ed1 100644
> > --- a/package/doc-asciidoc.mk
> > +++ b/package/doc-asciidoc.mk
> > @@ -140,7 +140,7 @@ endef
> >  ################################################################################
> >  define ASCIIDOC
> >  # Single line, because splitting a foreach is not easy...
> > -$(1)-check-dependencies: asciidoc-check-dependencies
> > +$(1)-check-dependencies: asciidoc-check-dependencies $$($(2)_DEPENDENCIES)
> 
> My concern is that $(2)_DEPENDENCIES has nothing to do with *checking*
> dependencies, so it's a bit weird to see this added to a target called
> <something>-check-dependencies.

Indeed, that's not the best solution.

It ensures oredering, for sure, and it ensures it is done only once for
the document, even if multiple formats are rquested.

> Could you refresh me on how this $(1)-check-dependencies target is
> used? I had a quick look at the code around and couldn't remember, and
> wanted to look at some other patches in your series.

The $(1)-check-depednencies rule is defined outside of the ASCIIDOC_INNER
macro, in the ASCIIDOC macro, so that we do not redefine it for every
formats.

The dependency on $(1)-check-dependencies is however set in the
INNER_MACRO, as a dependency of the output file $(1).$(6) .

I can see at making that cleaner, but we'll probably have to define
another rule for that. Let's see what I can come up with...

Regards,
Yann E. MORIN.
Thomas Petazzoni Aug. 27, 2016, 7:58 p.m. UTC | #4
Hello,

On Sun, 17 Jul 2016 12:34:23 +0200, Yann E. MORIN wrote:
> Currently, a document can not have dependencies, except for the purely
> internal ones (like checking asciidoc version, and presence of dblatex).
> 
> For our own manual, this will come in handy when we introduce a
> generated kconfig snippet, so we can actually make the manual depend on
> that snippet being generated first.
> 
> For external documents, it can be used to depend on host-packages if
> need be (e.g. a custom host packages that generates specific media files
> included in the manual).
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Samuel Martin <s.martin49@gmail.com>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> ---
>  docs/manual/adding-packages-asciidoc.txt | 3 +++
>  package/doc-asciidoc.mk                  | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)

Applied to next, thanks.

Thomas
diff mbox

Patch

diff --git a/docs/manual/adding-packages-asciidoc.txt b/docs/manual/adding-packages-asciidoc.txt
index 6e21786..0c10fd1 100644
--- a/docs/manual/adding-packages-asciidoc.txt
+++ b/docs/manual/adding-packages-asciidoc.txt
@@ -63,6 +63,9 @@  information is (assuming the document name is +foo+) :
   to one or more directories containing so-called resources (like CSS or
   images). By default, empty.
 
+* +FOO_DEPENDENCIES+, optional, the list of packages (most probably,
+  host-packages) that must be built before building this document.
+
 There are also additional hooks (see xref:hooks[] for general information
 on hooks), that a document may set to define extra actions to be done at
 various steps:
diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
index 6ab5ad2..ede6ed1 100644
--- a/package/doc-asciidoc.mk
+++ b/package/doc-asciidoc.mk
@@ -140,7 +140,7 @@  endef
 ################################################################################
 define ASCIIDOC
 # Single line, because splitting a foreach is not easy...
-$(1)-check-dependencies: asciidoc-check-dependencies
+$(1)-check-dependencies: asciidoc-check-dependencies $$($(2)_DEPENDENCIES)
 	$$(Q)$$(foreach hook,$$($(2)_CHECK_DEPENDENCIES_HOOKS),$$(call $$(hook))$$(sep))
 
 # Single line, because splitting a foreach is not easy...