bug-gnulib
[Top][All Lists]
Advanced

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

Re: maintainer-makefile: catch uses of $< in non-implicit rules


From: Tim Rühsen
Subject: Re: maintainer-makefile: catch uses of $< in non-implicit rules
Date: Mon, 24 Jun 2019 11:42:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1

Hi Akim,

On 6/22/19 5:53 PM, Akim Demaille wrote:
> Hi Tim,
> 
>> Le 17 juin 2019 à 12:04, Tim Rühsen <address@hidden> a écrit :
>>
>> Hi Akim,
>>
>> On 6/17/19 11:59 AM, Akim Demaille wrote:
>>> Hi Tim,
>>>
>>>> Le 17 juin 2019 à 11:57, Tim Rühsen <address@hidden> a écrit :
>>>>
>>>> Hi Akim,
>>>>
>>>> The patch uses awk -e which is understood only by GNU awk. This breaks
>>>> all Debian CI tests here since Debian installs 'mawk' by default (I
>>>> wasn't aware of that before).
>>>>
>>>> It's not a big deal to install package 'gawk' everywhere, but I just
>>>> wanted to mention it. I can see no warning/hint in any of the patch's
>>>> comments.
>>>
>>> That was not my intention.
>>>
>>> I expect that maintainers have gawk installed, so I think this check
>>> should be skipped if awk is not gawk.  WDYT?
>>
>> Thanks, sounds reasonable to me.
> 
> Here is my proposal.  Worked properly with the non GNU awk sitting on my 
> machine.

Your proposal works here on Debian after I switched to mawk via
'update-alternatives --config awk', selecting mawk. It detects two
occurrences of $< in our (project) Makefiles correctly.

Switching back to the old maint.mk, brings back the error message about
'-e'. I just did this to make sure.

Thanks for working on it !

Regards, Tim

> 
> commit b70c97f3ecf45a5c98b7f32189c1a4ae72a60788
> Author: Akim Demaille <address@hidden>
> Date:   Sat Jun 22 17:52:16 2019 +0200
> 
>     maintainer-makefile: restore portability to non-GNU awks
>     
>     Reported by Tim Rühsen.
>     * top/maint.mk (AWK): New variable.  Use it.
>     (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> 
> diff --git a/ChangeLog b/ChangeLog
> index cdc2b3d7a..dc7e52c0a 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2019-06-22  Akim Demaille  <address@hidden>
> +
> +     maintainer-makefile: restore portability to non-GNU awks
> +     Reported by Tim Rühsen.
> +     * top/maint.mk (AWK): New variable.  Use it.
> +     (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> +
>  2019-06-22  Akim Demaille  <address@hidden>
>  
>       argmatch: put all the docs member last.
> diff --git a/top/maint.mk b/top/maint.mk
> index 3dbe9c378..16e936022 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -24,6 +24,7 @@ ME := maint.mk
>  # These variables ought to be defined through the configure.ac section
>  # of the module description. But some packages import this file directly,
>  # ignoring the module description.
> +AWK ?= awk
>  GREP ?= grep
>  SED ?= sed
>  
> @@ -190,7 +191,7 @@ $(sc_z_rules_): %.z: %
>       @end=$$(date +%s.%N);                                           \
>       start=$$(cat .sc-start-$*);                                     \
>       rm -f .sc-start-$*;                                             \
> -     awk -v s=$$start -v e=$$end                                     \
> +     $(AWK) -v s=$$start -v e=$$end                                  \
>         'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
>  
>  # The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
> @@ -435,13 +436,15 @@ sc_prohibit_gnu_make_extensions_awk_ =                  
>                 \
>       exit status;                                                    \
>    }
>  sc_prohibit_gnu_make_extensions:
> -     (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |      \
> -       tr ' ' '\n' |                                                 \
> -       $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |                      \
> -       while read m; do                                              \
> -         $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |              \
> -           awk -v file=$$m -e '$($@_awk_)' || exit 1;                \
> -       done
> +     @if $(AWK) --version | grep GNU >/dev/null 2>&1; then           \
> +       (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |    \
> +         tr ' ' '\n' |                                               \
> +         $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |                    \
> +         while read m; do                                            \
> +           $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |            \
> +             $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;           \
> +         done;                                                       \
> +     fi
>  
>  # Using EXIT_SUCCESS as the first argument to error is misleading,
>  # since when that parameter is 0, error does not exit.  Use '0' instead.
> @@ -1383,7 +1386,7 @@ gpg_key_ID ?=                                           
>                 \
>    $$(cd $(srcdir)                                                    \
>       && git cat-file tag v$(VERSION)                                 \
>          | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null  \
> -        | awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
> +        | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
>  
>  translation_project_ ?= address@hidden
>  
> 
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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