Re: [PATCH] Makefile: detect errors in running spatch
- From
Jeff King <peff@peff.net>
- Date
- Mar 10, 2017, 18:12 UTC
- Message-ID
- <20170310181220.mmbjsmhihkd5rajl@sigill.intra.peff.net>
- In-Reply-To
- <1fd87646-76fb-e67c-e61a-c0ccca20cf0a@web.de>
On Fri, Mar 10, 2017 at 06:03:47PM +0100, René Scharfe wrote:
Show 6 quoted lines
> > This shell code is getting a bit unwieldy to stick inside the Makefile, > > with all the line continuation and $-escaping. It might be worth moving > > it into a helper script. > > There is one for the kernel (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/coccicheck). > It's quite big, though.
Yeah, there's a lot going on there that I don't think we care about (though I am new to coccinelle, so maybe I would grow to appreciate the features).
I was thinking of just moving the current Makefile snippet into a script. That lets us avoid the irritating quoting. And we can use things like functions, which would make the $?-handling in the loop less tedious (because we can return straight out of the loop).
Show 5 quoted lines
> > I don't know if that would make the patches harder to apply. The results > > aren't full patches, so I assume you usually do some kind of munging on > > them? > > They work with patch -p0.
Hrm, you're right. I tried it earlier based on the commit message from the original "coccicheck" commit, but I got "only garbage was found". But now it works. I must have screwed it up (perhaps tab-completion stopped at "copy.cocci" instead of "copy.cocci.patch").
> > make coccicheck SPATCH='spatch --in-place' > > Using SPATCH_FLAGS for adding an option in such case would be a bit simpler.
That too. :)
Show 5 quoted lines
> We can get rid of the loop by using the spatch options --use-gitgrep and > --dir. I can't find the former one in the docs, though, so I'm not sure if > it only works with certain versions or what exactly it is even doing. It > seems to have the side effect of producing git-style patches (applicable > with patch -p1) at least.
I have no objections to pursuing that. But I think with my patch, it's workable for now, so there's no rush.
-Peff