git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: René ScharfeNext: Junio C Hamano
Message 3 of 4 in “Makefile: detect errors in running spatch”
  1. Makefile: detect errors in running spatchJeff King, Mar 10, 2017
  2. René ScharfeMar 10, 2017
  3. Jeff KingMar 10, 2017
  4. Junio C HamanoMar 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.