bug-cppi
[Top][All Lists]
Advanced

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

Re: [bug-cppi] extension of cppi to cover spec files?


From: Jim Meyering
Subject: Re: [bug-cppi] extension of cppi to cover spec files?
Date: Thu, 10 Jan 2013 19:03:06 +0100

Eric Blake wrote:
> On the libvirt list, there was a thread[1] that mentioned that in a .rpm
> file, writing:
>
> %if %{condition1}
>  %define foo 0
> %else
>  %define foo 1
>  %if %{condition2}
>   %define bar 1
>  %endif
> %endif
>
> is more legible than when everything is flush to the left column.  It
> seems like with some slight modifications, cppi could be extended to be
> used as a way to enforce an indentation style on rpm file macros.  What
> do you think?
>
> [1] https://www.redhat.com/archives/libvir-list/2013-January/msg00570.html

Hi Eric,

I agree that using indentation makes that easier to read.

Though note that the current code is merely a lexer of a small subset
of C syntax, but since RPM spec files are subject to different syntax
rules, there may be unbalanced comment delimiters, unmatched quotes, etc.

In spite of that, if you can make cppi do what you want without
disrupting things too much, it might be worthwhile.  The reason cppi
is written in C is because it had to handle very large C input files
quickly enough to reside on a commit hook, given system performance
constraints of many years ago. (logs say it was *20* years ago!)
The original version was written in Perl, but was too slow, back then.



reply via email to

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