提交 2e258dae 编写于 作者: E Eric Blake

maint: prefer $(GREP) in cfg.mk

We already used $(GREP) in some places, but might as well use it
everywhere during syntax check, in line with similar recent gnulib
changes.
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 7db886e7
# Customize Makefile.maint. -*- makefile -*- # Customize Makefile.maint. -*- makefile -*-
# Copyright (C) 2008-2015 Red Hat, Inc. # Copyright (C) 2008-2019 Red Hat, Inc.
# Copyright (C) 2003-2008 Free Software Foundation, Inc. # Copyright (C) 2003-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
...@@ -305,7 +305,7 @@ sc_flags_usage: ...@@ -305,7 +305,7 @@ sc_flags_usage:
$(srcdir)/include/libvirt/libvirt-qemu.h \ $(srcdir)/include/libvirt/libvirt-qemu.h \
$(srcdir)/include/libvirt/libvirt-lxc.h \ $(srcdir)/include/libvirt/libvirt-lxc.h \
$(srcdir)/include/libvirt/libvirt-admin.h \ $(srcdir)/include/libvirt/libvirt-admin.h \
| grep -c '\(long\|unsigned\) flags')" != 4 && \ | $(GREP) -c '\(long\|unsigned\) flags')" != 4 && \
{ echo '$(ME): new API should use "unsigned int flags"' 1>&2; \ { echo '$(ME): new API should use "unsigned int flags"' 1>&2; \
exit 1; } || : exit 1; } || :
@prohibit=' flags ATTRIBUTE_UNUSED' \ @prohibit=' flags ATTRIBUTE_UNUSED' \
...@@ -639,10 +639,10 @@ sc_libvirt_unmarked_diagnostics: ...@@ -639,10 +639,10 @@ sc_libvirt_unmarked_diagnostics:
exclude='_\(' \ exclude='_\(' \
halt='found unmarked diagnostic(s)' \ halt='found unmarked diagnostic(s)' \
$(_sc_search_regexp) $(_sc_search_regexp)
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ @{ $(GREP) -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ $(GREP) -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
| $(SED) 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \ | $(SED) 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
| grep '[ ]"' && \ | $(GREP) '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || : exit 1; } || :
...@@ -654,9 +654,9 @@ sc_libvirt_unmarked_diagnostics: ...@@ -654,9 +654,9 @@ sc_libvirt_unmarked_diagnostics:
# there are functions to which this one applies but that do not get marked # there are functions to which this one applies but that do not get marked
# diagnostics. # diagnostics.
sc_prohibit_newline_at_end_of_diagnostic: sc_prohibit_newline_at_end_of_diagnostic:
@grep -A2 -nE \ @$(GREP) -A2 -nE \
'\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \ '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT)) \
| grep '\\n"' \ | $(GREP) '\\n"' \
&& { echo '$(ME): newline at end of message(s)' 1>&2; \ && { echo '$(ME): newline at end of message(s)' 1>&2; \
exit 1; } || : exit 1; } || :
...@@ -664,12 +664,12 @@ sc_prohibit_newline_at_end_of_diagnostic: ...@@ -664,12 +664,12 @@ sc_prohibit_newline_at_end_of_diagnostic:
# allow VIR_ERROR to do this, and ignore functions that take a single # allow VIR_ERROR to do this, and ignore functions that take a single
# string rather than a format argument. # string rather than a format argument.
sc_prohibit_diagnostic_without_format: sc_prohibit_diagnostic_without_format:
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ @{ $(GREP) -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ $(GREP) -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
| $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \ | $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \
-e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \ -e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
-e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \ -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
| grep -vE 'VIR_ERROR' && \ | $(GREP) -vE 'VIR_ERROR' && \
{ echo '$(ME): found diagnostic without %' 1>&2; \ { echo '$(ME): found diagnostic without %' 1>&2; \
exit 1; } || : exit 1; } || :
...@@ -687,16 +687,16 @@ sc_prohibit_useless_translation: ...@@ -687,16 +687,16 @@ sc_prohibit_useless_translation:
# When splitting a diagnostic across lines, ensure that there is a space # When splitting a diagnostic across lines, ensure that there is a space
# or \n on one side of the split. # or \n on one side of the split.
sc_require_whitespace_in_translation: sc_require_whitespace_in_translation:
@grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \ @$(GREP) -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \
| $(SED) -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \ | $(SED) -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
-e '/_(.*[^\ ]""[^\ ]/p' | grep . && \ -e '/_(.*[^\ ]""[^\ ]/p' | $(GREP) . && \
{ echo '$(ME): missing whitespace at line split' 1>&2; \ { echo '$(ME): missing whitespace at line split' 1>&2; \
exit 1; } || : exit 1; } || :
# Enforce recommended preprocessor indentation style. # Enforce recommended preprocessor indentation style.
sc_preprocessor_indentation: sc_preprocessor_indentation:
@if cppi --version >/dev/null 2>&1; then \ @if cppi --version >/dev/null 2>&1; then \
$(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$' | xargs cppi -a -c \ $(VC_LIST_EXCEPT) | $(GREP) -E '\.[ch](\.in)?$$' | xargs cppi -a -c \
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
exit 1; }; \ exit 1; }; \
else \ else \
...@@ -707,13 +707,13 @@ sc_preprocessor_indentation: ...@@ -707,13 +707,13 @@ sc_preprocessor_indentation:
# (comment-only) C file that mirrors the same layout as the spec file. # (comment-only) C file that mirrors the same layout as the spec file.
sc_spec_indentation: sc_spec_indentation:
@if cppi --version >/dev/null 2>&1; then \ @if cppi --version >/dev/null 2>&1; then \
for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \ for f in $$($(VC_LIST_EXCEPT) | $(GREP) '\.spec\.in$$'); do \
$(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \ $(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
-e 's/%\(else\|endif\|define\)/#\1/' \ -e 's/%\(else\|endif\|define\)/#\1/' \
-e 's/^\( *\)\1\1\1#/#\1/' \ -e 's/^\( *\)\1\1\1#/#\1/' \
-e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \ -e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
| cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \ | cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \
done | { if grep . >&2; then false; else :; fi; } \ done | { if $(GREP) . >&2; then false; else :; fi; } \
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \ || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
exit 1; }; \ exit 1; }; \
else \ else \
...@@ -803,11 +803,11 @@ sc_prohibit_cross_inclusion: ...@@ -803,11 +803,11 @@ sc_prohibit_cross_inclusion:
# When converting an enum to a string, make sure that we track any new # When converting an enum to a string, make sure that we track any new
# elements added to the enum by using a _LAST marker. # elements added to the enum by using a _LAST marker.
sc_require_enum_last_marker: sc_require_enum_last_marker:
@grep -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT)) \ @$(GREP) -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT)) \
| $(SED) -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \ | $(SED) -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \
-e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \ -e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
-e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \ -e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
| grep . && \ | $(GREP) . && \
{ echo '$(ME): enum impl needs to use _LAST marker' 1>&2; \ { echo '$(ME): enum impl needs to use _LAST marker' 1>&2; \
exit 1; } || : exit 1; } || :
...@@ -883,7 +883,7 @@ sc_prohibit_wrong_filename_in_comment: ...@@ -883,7 +883,7 @@ sc_prohibit_wrong_filename_in_comment:
if (fail == 1) { \ if (fail == 1) { \
exit 1; \ exit 1; \
} \ } \
}' $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') || fail=1; \ }' $$($(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$') || fail=1; \
if test $$fail -eq 1; then \ if test $$fail -eq 1; then \
{ echo '$(ME): The file name in comments must match the' \ { echo '$(ME): The file name in comments must match the' \
'actual file name' 1>&2; exit 1; } \ 'actual file name' 1>&2; exit 1; } \
...@@ -918,7 +918,7 @@ sc_require_if_else_matching_braces: ...@@ -918,7 +918,7 @@ sc_require_if_else_matching_braces:
$(_sc_search_regexp) $(_sc_search_regexp)
sc_curly_braces_style: sc_curly_braces_style:
@files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); \ @files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$'); \
if $(GREP) -nHP \ if $(GREP) -nHP \
'^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \ '^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \
$$files; then \ $$files; then \
...@@ -931,7 +931,7 @@ sc_curly_braces_style: ...@@ -931,7 +931,7 @@ sc_curly_braces_style:
fi fi
sc_prohibit_windows_special_chars_in_filename: sc_prohibit_windows_special_chars_in_filename:
@files=$$($(VC_LIST_EXCEPT) | grep '[:*?"<>|]'); \ @files=$$($(VC_LIST_EXCEPT) | $(GREP) '[:*?"<>|]'); \
test -n "$$files" && { echo '$(ME): Windows special chars' \ test -n "$$files" && { echo '$(ME): Windows special chars' \
'in filename not allowed:' 1>&2; echo $$files 1>&2; exit 1; } || : 'in filename not allowed:' 1>&2; echo $$files 1>&2; exit 1; } || :
...@@ -996,8 +996,8 @@ sc_prohibit_sysconf_pagesize: ...@@ -996,8 +996,8 @@ sc_prohibit_sysconf_pagesize:
$(_sc_search_regexp) $(_sc_search_regexp)
sc_prohibit_virSecurity: sc_prohibit_virSecurity:
@grep -Pn 'virSecurityManager(?!Ptr)' $$($(VC_LIST_EXCEPT) | grep 'src/qemu/' | \ @$(GREP) -Pn 'virSecurityManager(?!Ptr)' $$($(VC_LIST_EXCEPT) | $(GREP) 'src/qemu/' | \
grep -v 'src/qemu/qemu_security') && \ $(GREP) -v 'src/qemu/qemu_security') && \
{ echo '$(ME): prefer qemuSecurity wrappers' 1>&2; exit 1; } || : { echo '$(ME): prefer qemuSecurity wrappers' 1>&2; exit 1; } || :
sc_prohibit_pthread_create: sc_prohibit_pthread_create:
...@@ -1128,24 +1128,24 @@ endif ...@@ -1128,24 +1128,24 @@ endif
# Don't include duplicate header in the source (either *.c or *.h) # Don't include duplicate header in the source (either *.c or *.h)
prohibit-duplicate-header: prohibit-duplicate-header:
$(AM_V_GEN)files=$$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); \ $(AM_V_GEN)files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.[chx]$$'); \
$(PERL) -W $(top_srcdir)/build-aux/prohibit-duplicate-header.pl $$files $(PERL) -W $(top_srcdir)/build-aux/prohibit-duplicate-header.pl $$files
spacing-check: spacing-check:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \ $(AM_V_GEN)files=`$(VC_LIST) | $(GREP) '\.c$$'`; \
$(PERL) $(top_srcdir)/build-aux/check-spacing.pl $$files || \ $(PERL) $(top_srcdir)/build-aux/check-spacing.pl $$files || \
{ echo '$(ME): incorrect formatting' 1>&2; exit 1; } { echo '$(ME): incorrect formatting' 1>&2; exit 1; }
mock-noinline: mock-noinline:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.[ch]$$'`; \ $(AM_V_GEN)files=`$(VC_LIST) | $(GREP) '\.[ch]$$'`; \
$(PERL) $(top_srcdir)/build-aux/mock-noinline.pl $$files $(PERL) $(top_srcdir)/build-aux/mock-noinline.pl $$files
header-ifdef: header-ifdef:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.[h]$$'`; \ $(AM_V_GEN)files=`$(VC_LIST) | $(GREP) '\.[h]$$'`; \
$(PERL) $(top_srcdir)/build-aux/header-ifdef.pl $$files $(PERL) $(top_srcdir)/build-aux/header-ifdef.pl $$files
test-wrap-argv: test-wrap-argv:
$(AM_V_GEN)files=`$(VC_LIST) | grep -E '\.(ldargs|args)'`; \ $(AM_V_GEN)files=`$(VC_LIST) | $(GREP) -E '\.(ldargs|args)'`; \
$(PERL) $(top_srcdir)/tests/test-wrap-argv.pl --check $$files $(PERL) $(top_srcdir)/tests/test-wrap-argv.pl --check $$files
group-qemu-caps: group-qemu-caps:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册