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

Re: [GUILT 1/5] Fix generation of Documentation/usage-%.txt.

From
JSJeff Sipek <jeffpc@josefsipek.net>
Date
Jan 23, 2015, 14:36 UTC
Message-ID
<20150123143614.GG101465@meili.jeffnet.31bits.net>
In-Reply-To
<CAP=KgsSMT7Wniek1FgRGkrxa9+45hxcDtE-C1B4sQMvUviKJ1g@mail.gmail.com>
On Fri, Jan 23, 2015 at 03:33:03PM +0100, Per Cederqvist wrote:
Show 39 quoted lines
> On Fri, Jan 23, 2015 at 3:21 PM, Jeff Sipek <jeffpc@josefsipek.net> wrote:
> > On Fri, Jan 23, 2015 at 02:24:55PM +0100, Per Cederqvist wrote:
> >> The old rule worked, most of the time, but had several issues:
> >>
> >>  - It depended on the corresponding guilt-*.txt file, but the usage.sh
> >>    script actually reads ../guilt-foo.
> >>
> >>  - Actually, each usage-%.txt depended on all guilt-*.txt files, so
> >>    make had to do more work than necessary if a single file was
> >>    altered.
> >>
> >>  - The construct broke parallel make, which would spawn several
> >>    usage.sh at once.  This leads to unnecessary work, and could
> >>    potentially result in broken usage files if the "echo some_string >
> >>    some_file" construct used by usage.sh isn't atomic.
> >>
> >> Fixed by letting the usage.sh script update a single file, and writing
> >> a proper implicit make rule.  This makes parallel make work a lot
> >> better.
> >
> > Nice!
> >
> >> There is a small downside, though, as usage.sh will now be run once
> >> for each command (if everything is regenerated).  I think it is worth
> >> to pay that price to get the correctness.  This command is still very
> >> fast compared to the docbook processing.
> >
> > Given how much simple usage.sh got, I'm thinking it might be worth it to
> > just remove it, and just shove the rule into the makefile itself.
> >
> > Ok, I tried to write it.  I came up with the following.  (Note: I have *not*
> > tested it.)  It's not *that* ugly.
> >
> > usage-guilt-%.txt: ../guilt-% usage.sh
> >         echo "'$(basename $<)' `sed -n -e '/^USAGE=/{s/USAGE="//; s/"$//; p; q}' $<`" > $@
> >
> > What do you think?  Too opaque?  Your change looks good.
> 
> Too opaque,

Between that and the other patch in the series that modifies usage.sh, your patch is good as is.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Show 5 quoted lines
> and not tested enough. It doesn't work, since make will
> handle all $.  You need to write $$ instead of $ in at least one of the
> places.  I would stick with usage.sh, as getting the quoting right when
> you have make, shell, subshells, and sed all at the same time is just
> too painful.

And this is comming from the person that rewrote cmd/shouldfail in a way that the average shell user will go "whaaa??" :P (To be fair, I don't know of a simpler way to make cmd/shouldfail.)

> But it is of course up to you. You are the maintainer. :-)
Heh.
Jeff.
-- 
Real Programmers consider "what you see is what you get" to be just as bad a
concept in Text Editors as it is in women. No, the Real Programmer wants a
"you asked for it, you got it" text editor -- complicated, cryptic,
powerful, unforgiving, dangerous.
Previous: Per CederqvistNext: Per Cederqvist
Message 5 of 13 in “[GUILT 0/5] doc: less guilt-foo invocations, minor Makefile fixes”
  1. Per CederqvistJan 23, 2015
  2. 1/5 Fix generation of Documentation/usage-%.txt.Per Cederqvist, Jan 23, 2015
  3. Jeff SipekJan 23, 2015
  4. Per CederqvistJan 23, 2015
  5. Jeff SipekJan 23, 2015
  6. 2/5 doc: guilt.xml depends on cmds.txt.Per Cederqvist, Jan 23, 2015
  7. Jeff SipekJan 23, 2015
  8. 3/5 doc: don't use guilt-foo invocations in examples.Per Cederqvist, Jan 23, 2015
  9. Jeff SipekJan 23, 2015
  10. 4/5 doc: don't use guilt-foo invocations in usage messages.Per Cederqvist, Jan 23, 2015
  11. Jeff SipekJan 23, 2015
  12. 5/5 doc: git doesn't use git-foo invocations.Per Cederqvist, Jan 23, 2015
  13. Jeff SipekJan 23, 2015

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.