• E
    spec: indent %if to make it easier to see conditions · c8f79c9b
    Eric Blake 提交于
    Nested conditionals are hard to read if they are not indented.
    We can't add arbitrary whitespace to everything in spec files,
    but we CAN add spaces before %if and %define.  Use this trick,
    plus a fancy sed script that rewrites a spec file into a C
    file, so we can use cppi to keep our spec file nice.
    
    For reference, the sed script converts code like:
    
    |# RHEL-5 builds are client-only for s390, ppc
    |%if 0%{?rhel} == 5
    |    %ifnarch %{ix86} x86_64 ia64
    |        %define client_only        1
    |    %endif
    |%endif
    
    into the following for cppi:
    
    |// # RHEL-5 builds are client-only for s390, ppc
    |#if a // 0%{?rhel} == 5
    |# if a // %{ix86} x86_64 ia64
    |#  define client_only        1
    |# endif
    |#endif
    
    and errors from 'make syntax-check' look like:
    spec_indentation
    cppi: mingw-libvirt.spec.in: line 130: not properly indented
    maint.mk: incorrect preprocessor indentation
    
    * libvirt.spec.in: Add some indentation to make it easier to follow
    various conditionals.
    * mingw-libvirt-spec.in: Likewise.
    * cfg.mk (sc_spec_indentation): New syntax check to enforce it.
    c8f79c9b
cfg.mk 30.9 KB