automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ylwrap removes too many directories from output


From: Stefano Lattarini
Subject: Re: ylwrap removes too many directories from output
Date: Wed, 16 May 2012 18:17:49 +0200

[moving to automake-patches]

On 05/10/2012 02:03 PM, Nikolai Weibull wrote:
> Hi!
>
Hi Nikolai, sorry for the delay, and thanks for the patch.

> If Automake is used in non-recursive mode and one of the inputs is a
> yacc file, for example, src/grammar.y, ylwrap will remove too many
> directories from the output file when it adjusts the paths in it.
> This results in #line directives referring to grammar.y instead of
> src/grammar.y.
> 
> This is a result of input_rx simply taking all the directory
> components of the absolute input path and removing them.
> 
> One solution is to store the path passed to ylwrap and replace input_rx
> with it:
>
> --- build/ylwrap.old    2012-05-10 13:59:19.495291713 +0200
> +++ build/ylwrap        2012-05-10 13:59:24.579351693 +0200
> @@ -67,6 +67,8 @@
>  # The input.
>  input="$1"
>  shift
> +input_orgdir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
> +input_sub=`echo "$input_orgdir" | sed 's,\\\\,\\\\\\\\,g'`
>  case "$input" in
>    [\\/]* | ?:[\\/]*)
>      # Absolute path; do nothing.
> @@ -175,7 +177,7 @@
>              -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
>              -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
> 
> -      sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
> +      sed -e "/^#/!b" -e "s,$input_rx,$input_sub," -e "s,$from,$2," \
>            -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
> 
>        # Check whether header files must be updated.
> 
> I’m sure that there’s a much better way of doing this, but this seems to work.
> 
I like your idea.  I've turned it into a two patch series (see attachment).  I
will push by tomorrow if there is no objection.

Regards,
  Stefano

Attachment: 0001-ylwrap-preparatory-refactoring.patch
Description: Text Data

Attachment: 0002-ylwrap-preserve-subdirectories-in-line-munging.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]