All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
@ 2016-07-27 18:02 Matt Weber
  2016-07-27 19:21 ` Peter Korsgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Weber @ 2016-07-27 18:02 UTC (permalink / raw)
  To: buildroot

From: Atul Singh <atul.singh.mandla@rockwellcollins.com>

One of the "features" of a2x is that the '-r|--resource' flag imports
resources relative to the [SOURCE_FILE], not the CWD. The current
implementation tries to import resources from the destination dir $(@D),
which works fine for out-of-tree builds because $(@D) is an absolute
path, however in-tree builds treat $(@D) as a relative path, which breaks
because a2x treats $(@D) relative to SOURCE_FILE.

Use the make command $(abspath names...) to convert the dest dir to an
absolute path before passing it as a resource.

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Signed-off-by: Atul Singh Mandla <atul.singh.mandla@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>

---
v1 -> v2
[Yann
 - Removed extra spaces before the $$(foreach and --resource
 - Updated commit message to be $(@D) vs $(D)

v2 -> v3
[Matt
 - Fixed my rebase and resent patch
---
 package/doc-asciidoc.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/doc-asciidoc.mk b/package/doc-asciidoc.mk
index 6ab5ad2..4f765b8 100644
--- a/package/doc-asciidoc.mk
+++ b/package/doc-asciidoc.mk
@@ -117,7 +117,8 @@ $$(O)/docs/$(1)/$(1).$(6): $$($(2)_SOURCES) \
 	$$(Q)$$(call MESSAGE,"Generating $(7) $(1)...")
 	$$(Q)mkdir -p $$(@D)
 	$$(Q)a2x $(8) -f $(4) -d book -L \
-		$$(foreach r,$$($(2)_RESOURCES),-r $$(r)) -r $$(@D) \
+		$$(foreach r,$$($(2)_RESOURCES) $$(@D), \
+			--resource="$$(abspath $$(r))") \
 		$$($(2)_$(4)_A2X_OPTS) \
 		--asciidoc-opts="$$($(2)_$(4)_ASCIIDOC_OPTS)" \
 		$$(BUILD_DIR)/docs/$(1)/$(1).txt
-- 
1.9.1

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

* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
  2016-07-27 18:02 [Buildroot] [PATCH v3] asciidoc: use absolute path for resources Matt Weber
@ 2016-07-27 19:21 ` Peter Korsgaard
  2016-07-28 13:04   ` Matthew Weber
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2016-07-27 19:21 UTC (permalink / raw)
  To: buildroot

>>>>> "Matt" == Matt Weber <matthew.weber@rockwellcollins.com> writes:

 > From: Atul Singh <atul.singh.mandla@rockwellcollins.com>
 > One of the "features" of a2x is that the '-r|--resource' flag imports
 > resources relative to the [SOURCE_FILE], not the CWD. The current
 > implementation tries to import resources from the destination dir $(@D),
 > which works fine for out-of-tree builds because $(@D) is an absolute
 > path, however in-tree builds treat $(@D) as a relative path, which breaks
 > because a2x treats $(@D) relative to SOURCE_FILE.

 > Use the make command $(abspath names...) to convert the dest dir to an
 > absolute path before passing it as a resource.

 > Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

 > Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
 > Signed-off-by: Atul Singh Mandla <atul.singh.mandla@rockwellcollins.com>
 > Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>

Committed, thanks.

Like Yann, I also cannot reproduce any errors without it. How do you
trigger it?

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
  2016-07-27 19:21 ` Peter Korsgaard
@ 2016-07-28 13:04   ` Matthew Weber
  2016-07-28 19:29     ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Weber @ 2016-07-28 13:04 UTC (permalink / raw)
  To: buildroot

All,

On Wed, Jul 27, 2016 at 2:21 PM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Matt" == Matt Weber <matthew.weber@rockwellcollins.com> writes:
>
>  > From: Atul Singh <atul.singh.mandla@rockwellcollins.com>
>  > One of the "features" of a2x is that the '-r|--resource' flag imports
>  > resources relative to the [SOURCE_FILE], not the CWD. The current
>  > implementation tries to import resources from the destination dir $(@D),
>  > which works fine for out-of-tree builds because $(@D) is an absolute
>  > path, however in-tree builds treat $(@D) as a relative path, which breaks
>  > because a2x treats $(@D) relative to SOURCE_FILE.
>
>  > Use the make command $(abspath names...) to convert the dest dir to an
>  > absolute path before passing it as a resource.
>
>  > Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
>  > Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
>  > Signed-off-by: Atul Singh Mandla <atul.singh.mandla@rockwellcollins.com>
>  > Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
>
> Committed, thanks.
>
> Like Yann, I also cannot reproduce any errors without it. How do you
> trigger it?

(Courtesy of Brandon, CC'd)

You can see the issue by running "make V=1 manual". Normally you'll
see the following

...
>>>   Generating split HTML manual...
mkdir -p output/docs/manual
a2x  --xsltproc-opts "--stringparam toc.section.depth 1" -f chunked -d
book -L -r /home/foobar/projects/asciidoc-upstream/buildroot-main/docs/images
-r output/docs/manual  --destination-dir="output/docs/manual"
--asciidoc-opts=""
/home/foobar/projects/asciidoc-upstream/buildroot-main/output/build/docs/manual/manual.txt

The issue is with the flag "-r output/docs/manual" which uses a
relative path. However only generated files are stored there, which
isn't a problem with the current Buildroot as it doesn't use any. The
issue appears when you use generated files like a graphviz element
because the generated graph is stored in that directory.

You can recreate the bug by applying this patch

From: Brandon Maier <brandon.maier@rockwellcollins.com>
Date: Wed, 27 Jul 2016 17:05:43 -0500
Subject: [PATCH] Example graph to show asciidoc bug

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
 docs/manual/introduction.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/manual/introduction.txt b/docs/manual/introduction.txt
index 476aa81..2297efd 100644
--- a/docs/manual/introduction.txt
+++ b/docs/manual/introduction.txt
@@ -24,3 +24,20 @@ comes with default configurations for several
boards available
 off-the-shelf. Besides this, a number of third-party projects are based on,
 or develop their BSP footnote:[BSP: Board Support Package] or
 SDK footnote:[SDK: Software Development Kit] on top of Buildroot.
+
+["graphviz", "sample2.png"]
+---------------------------------------------------------------------
+digraph automata_0 {
+  size ="8.5, 11";
+  node [shape = circle];
+  0 [ style = filled, color=lightgrey ];
+  2 [ shape = doublecircle ];
+  0 -> 2 [ label = "a " ];
+  0 -> 1 [ label = "other " ];
+  1 -> 2 [ label = "a " ];
+  1 -> 1 [ label = "other " ];
+  2 -> 2 [ label = "a " ];
+  2 -> 1 [ label = "other " ];
+  "Machine: a" [ shape = plaintext ];
+}
+---------------------------------------------------------------------
--
1.9.1



-- 
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.

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

* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
  2016-07-28 13:04   ` Matthew Weber
@ 2016-07-28 19:29     ` Yann E. MORIN
  2016-07-28 19:44       ` Brandon Maier
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2016-07-28 19:29 UTC (permalink / raw)
  To: buildroot

Matthew, All,

On 2016-07-28 08:04 -0500, Matthew Weber spake thusly:
> On Wed, Jul 27, 2016 at 2:21 PM, Peter Korsgaard <peter@korsgaard.com> wrote:
> >>>>>> "Matt" == Matt Weber <matthew.weber@rockwellcollins.com> writes:
> >  > From: Atul Singh <atul.singh.mandla@rockwellcollins.com>
> >  > One of the "features" of a2x is that the '-r|--resource' flag imports
> >  > resources relative to the [SOURCE_FILE], not the CWD. The current
> >  > implementation tries to import resources from the destination dir $(@D),
> >  > which works fine for out-of-tree builds because $(@D) is an absolute
> >  > path, however in-tree builds treat $(@D) as a relative path, which breaks
> >  > because a2x treats $(@D) relative to SOURCE_FILE.
[--SNIP--]
> > Like Yann, I also cannot reproduce any errors without it. How do you
> > trigger it?
> You can see the issue by running "make V=1 manual". Normally you'll
> see the following
> 
> ...
> >>>   Generating split HTML manual...
> mkdir -p output/docs/manual
> a2x  --xsltproc-opts "--stringparam toc.section.depth 1" -f chunked -d
> book -L -r /home/foobar/projects/asciidoc-upstream/buildroot-main/docs/images
> -r output/docs/manual  --destination-dir="output/docs/manual"
> --asciidoc-opts=""
> /home/foobar/projects/asciidoc-upstream/buildroot-main/output/build/docs/manual/manual.txt
> 
> The issue is with the flag "-r output/docs/manual" which uses a
> relative path. However only generated files are stored there, which
> isn't a problem with the current Buildroot as it doesn't use any. The
> issue appears when you use generated files like a graphviz element
> because the generated graph is stored in that directory.
> 
> You can recreate the bug by applying this patch
> 
> From: Brandon Maier <brandon.maier@rockwellcollins.com>
> Date: Wed, 27 Jul 2016 17:05:43 -0500
> Subject: [PATCH] Example graph to show asciidoc bug
> 
> Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
> ---
>  docs/manual/introduction.txt | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/docs/manual/introduction.txt b/docs/manual/introduction.txt
> index 476aa81..2297efd 100644
> --- a/docs/manual/introduction.txt
> +++ b/docs/manual/introduction.txt
> @@ -24,3 +24,20 @@ comes with default configurations for several
> boards available
>  off-the-shelf. Besides this, a number of third-party projects are based on,
>  or develop their BSP footnote:[BSP: Board Support Package] or
>  SDK footnote:[SDK: Software Development Kit] on top of Buildroot.
> +
> +["graphviz", "sample2.png"]
> +---------------------------------------------------------------------
> +digraph automata_0 {
> +  size ="8.5, 11";
> +  node [shape = circle];
> +  0 [ style = filled, color=lightgrey ];
> +  2 [ shape = doublecircle ];
> +  0 -> 2 [ label = "a " ];
> +  0 -> 1 [ label = "other " ];
> +  1 -> 2 [ label = "a " ];
> +  1 -> 1 [ label = "other " ];
> +  2 -> 2 [ label = "a " ];
> +  2 -> 1 [ label = "other " ];
> +  "Machine: a" [ shape = plaintext ];
> +}
> +---------------------------------------------------------------------

Thanks for this example. However, the generated manual does include the
graph of that state machine.

    $ git checkout 9d4a1a7^  # 9d4a1a7 is your commit
    $ make manual-html
    [--SNIP--]
    $ ls -l output/docs/manual/sample2.png docs/manual/sample2.png
    ls: cannot access 'docs/manual/sample2.png': No such file or directory
    -rw-r--r-- 1 ymorin ymorin 17K Jul 28 21:25 output/docs/manual/sample2.png
    $ mkdir ../O
    $ make O=$(cd ../O; pwd) manual-html
    [--SNIP--]
    $ ls -l ../O/docs/manual/sample2.png docs/manual/sample2.png
    ls: cannot access 'docs/manual/sample2.png': No such file or directory
    -rw-r--r-- 1 ymorin ymorin 16512 Jul 28 21:26 ../O/docs/manual/sample2.png

Both in-tree and out-of-tree manuals have the state machine, and the
graph *is* generated in the output dir, not the source dir.

Did I miss something?

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

* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
  2016-07-28 19:29     ` Yann E. MORIN
@ 2016-07-28 19:44       ` Brandon Maier
  2016-07-28 19:52         ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Brandon Maier @ 2016-07-28 19:44 UTC (permalink / raw)
  To: buildroot

The bug crops up when generating the chunked/split-HTML manual. Try the
"manual" target instead of "manual-html".

On Thu, Jul 28, 2016 at 2:29 PM, Yann E. MORIN <yann.morin.1998@free.fr>
wrote:

> Matthew, All,
>
> On 2016-07-28 08:04 -0500, Matthew Weber spake thusly:
> > On Wed, Jul 27, 2016 at 2:21 PM, Peter Korsgaard <peter@korsgaard.com>
> wrote:
> > >>>>>> "Matt" == Matt Weber <matthew.weber@rockwellcollins.com> writes:
> > >  > From: Atul Singh <atul.singh.mandla@rockwellcollins.com>
> > >  > One of the "features" of a2x is that the '-r|--resource' flag
> imports
> > >  > resources relative to the [SOURCE_FILE], not the CWD. The current
> > >  > implementation tries to import resources from the destination dir
> $(@D),
> > >  > which works fine for out-of-tree builds because $(@D) is an absolute
> > >  > path, however in-tree builds treat $(@D) as a relative path, which
> breaks
> > >  > because a2x treats $(@D) relative to SOURCE_FILE.
> [--SNIP--]
> > > Like Yann, I also cannot reproduce any errors without it. How do you
> > > trigger it?
> > You can see the issue by running "make V=1 manual". Normally you'll
> > see the following
> >
> > ...
> > >>>   Generating split HTML manual...
> > mkdir -p output/docs/manual
> > a2x  --xsltproc-opts "--stringparam toc.section.depth 1" -f chunked -d
> > book -L -r
> /home/foobar/projects/asciidoc-upstream/buildroot-main/docs/images
> > -r output/docs/manual  --destination-dir="output/docs/manual"
> > --asciidoc-opts=""
> >
> /home/foobar/projects/asciidoc-upstream/buildroot-main/output/build/docs/manual/manual.txt
> >
> > The issue is with the flag "-r output/docs/manual" which uses a
> > relative path. However only generated files are stored there, which
> > isn't a problem with the current Buildroot as it doesn't use any. The
> > issue appears when you use generated files like a graphviz element
> > because the generated graph is stored in that directory.
> >
> > You can recreate the bug by applying this patch
> >
> > From: Brandon Maier <brandon.maier@rockwellcollins.com>
> > Date: Wed, 27 Jul 2016 17:05:43 -0500
> > Subject: [PATCH] Example graph to show asciidoc bug
> >
> > Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
> > ---
> >  docs/manual/introduction.txt | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/docs/manual/introduction.txt b/docs/manual/introduction.txt
> > index 476aa81..2297efd 100644
> > --- a/docs/manual/introduction.txt
> > +++ b/docs/manual/introduction.txt
> > @@ -24,3 +24,20 @@ comes with default configurations for several
> > boards available
> >  off-the-shelf. Besides this, a number of third-party projects are based
> on,
> >  or develop their BSP footnote:[BSP: Board Support Package] or
> >  SDK footnote:[SDK: Software Development Kit] on top of Buildroot.
> > +
> > +["graphviz", "sample2.png"]
> > +---------------------------------------------------------------------
> > +digraph automata_0 {
> > +  size ="8.5, 11";
> > +  node [shape = circle];
> > +  0 [ style = filled, color=lightgrey ];
> > +  2 [ shape = doublecircle ];
> > +  0 -> 2 [ label = "a " ];
> > +  0 -> 1 [ label = "other " ];
> > +  1 -> 2 [ label = "a " ];
> > +  1 -> 1 [ label = "other " ];
> > +  2 -> 2 [ label = "a " ];
> > +  2 -> 1 [ label = "other " ];
> > +  "Machine: a" [ shape = plaintext ];
> > +}
> > +---------------------------------------------------------------------
>
> Thanks for this example. However, the generated manual does include the
> graph of that state machine.
>
>     $ git checkout 9d4a1a7^  # 9d4a1a7 is your commit
>     $ make manual-html
>     [--SNIP--]
>     $ ls -l output/docs/manual/sample2.png docs/manual/sample2.png
>     ls: cannot access 'docs/manual/sample2.png': No such file or directory
>     -rw-r--r-- 1 ymorin ymorin 17K Jul 28 21:25
> output/docs/manual/sample2.png
>     $ mkdir ../O
>     $ make O=$(cd ../O; pwd) manual-html
>     [--SNIP--]
>     $ ls -l ../O/docs/manual/sample2.png docs/manual/sample2.png
>     ls: cannot access 'docs/manual/sample2.png': No such file or directory
>     -rw-r--r-- 1 ymorin ymorin 16512 Jul 28 21:26
> ../O/docs/manual/sample2.png
>
> Both in-tree and out-of-tree manuals have the state machine, and the
> graph *is* generated in the output dir, not the source dir.
>
> Did I miss something?
>
> 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.  |
>
> '------------------------------^-------^------------------^--------------------'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160728/0c8523f1/attachment.html>

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

* [Buildroot] [PATCH v3] asciidoc: use absolute path for resources
  2016-07-28 19:44       ` Brandon Maier
@ 2016-07-28 19:52         ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2016-07-28 19:52 UTC (permalink / raw)
  To: buildroot

Brandon, All,

On 2016-07-28 14:44 -0500, Brandon Maier spake thusly:
> The bug crops up when generating the chunked/split-HTML manual. Try the
> "manual" target instead of "manual-html".

Indeed, I could reproduce. Your patch indeed fixes it.

Thanks! :-)

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

end of thread, other threads:[~2016-07-28 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-27 18:02 [Buildroot] [PATCH v3] asciidoc: use absolute path for resources Matt Weber
2016-07-27 19:21 ` Peter Korsgaard
2016-07-28 13:04   ` Matthew Weber
2016-07-28 19:29     ` Yann E. MORIN
2016-07-28 19:44       ` Brandon Maier
2016-07-28 19:52         ` Yann E. MORIN

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.