]> xenbits.xensource.com Git - libvirt.git/commit
spec: indent %if to make it easier to see conditions
authorEric Blake <eblake@redhat.com>
Wed, 9 Jan 2013 20:50:03 +0000 (13:50 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 21 Jan 2013 17:36:14 +0000 (10:36 -0700)
commitc8f79c9b29d4b3c975e7a7f7eb14516dfcd0fd9a
tree5dfd88287d2cb9bfcc8e02bf69118886ebe0f436
parent790f912b468657859466215312dbfb0b1a9a1f69
spec: indent %if to make it easier to see conditions

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.
cfg.mk
libvirt.spec.in
mingw-libvirt.spec.in