Page MenuHomeFreeBSD

Replace revision and publication date in generated documentation with more useful data.
ClosedPublic

Authored by grembo on Mar 27 2016, 2:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 22 2024, 1:33 PM
Unknown Object (File)
Dec 21 2023, 6:21 AM
Unknown Object (File)
Dec 20 2023, 2:25 AM
Unknown Object (File)
Dec 10 2023, 12:14 PM
Unknown Object (File)
Nov 19 2023, 1:51 AM
Unknown Object (File)
Nov 19 2023, 12:20 AM
Unknown Object (File)
Nov 6 2023, 6:35 PM
Unknown Object (File)
Nov 6 2023, 6:24 AM

Details

Reviewers
hrs
wblock
grembo
Group Reviewers
doceng
Summary

Right now, the title page of documents (e.g. porters handbook) contains
version information that is automatically filled in by RCS keyword
substitution every time the title document gets changed. Unfortunately,
it doesn't get updated automatically if any of the other source files change,
therefore giving incaccurate and outdated (looking) information to the reader.

This patch aims to fix this by extracting accuarate version information for all
SRCS of a document.

Right now it's only used in pubdate, if it already contains a $FreeBSD placeholder.
It's always applied to releaseinfo.

Test Plan

make

Diff Detail

Event Timeline

grembo retitled this revision from to Replace revision and publication date in generated documentation with more useful data..
grembo updated this object.
grembo edited the test plan for this revision. (Show Details)
grembo added a reviewer: wblock.

Nice!

Parsing out the revision number, date, and committer can be done in the Perl call, and passed as separate parameters. That would simplify the stylesheets and also make them less fragile. Right now, they depend on magic string length constants that do not indicate what they mean.

Perl can do the sort and tail itself, parse out the version, date, and committer, and return a string with those three parameter settings. I will write that, if desired.

grembo edited edge metadata.

Separate lastrevision into multiple, more structured fields in Makefile.
Remove perl from the mix.
Add tail command to doc.commands.mk.

Kind of went the opposite direction in terms of perl, I find the result to be quite readable though.

wblock edited edge metadata.

Kind of went the opposite direction in terms of perl, I find the result to be quite readable though.

This is excellent! It is actually possible to see what the XSL is doing, and the overhead is minimal. Let's give it a couple of days for other feedback, but as far as I'm concerned, it's good.

This revision is now accepted and ready to land.Mar 28 2016, 2:50 AM
hrs requested changes to this revision.Mar 31 2016, 10:18 PM
hrs added a reviewer: hrs.
hrs added a subscriber: hrs.

No, please do not add this kind of complexity into Makefile. Parsing an XML file by using grep or awk is a big regression even if it is useful. Use a stylesheet instead.

This revision now requires changes to proceed.Mar 31 2016, 10:18 PM

@hrs
Can you please suggest how to accomplish what this is doing (and I think what this is doing is extremely important, I was embarrassed when I showed the Porters Handbook to someone and it said that it was last updated two years ago) in a style sheet in a way that is less complex (this is not about parsing XML, but about getting an SVN keyword out of a group of text files, which is super stable, compatible and will work even on files that are part of the documentation, even if they're not XML)?

@hrs (edited, so it makes more sense)

The reason why this is not parsing XML as such is:

  1. The user puts $FreeBSD$ anywhere in the file, usually somewhere in an XML comment at the top of the file.
  2. subversion replaces this string, not caring about the document structure or if this is XML at all.
  3. On build, make extracts that information the exact same way it was created by subversion, i.e. not caring about the document structure or if this is XML, and passes it into the document generator.

So, besides the fact that this approach is very lean and easy to understand, I also think it's the right thing to do given how this information is created (it might be more accurate to use subversion, but afaik the build process shouldn't depend on this, so it's not an option).

So, besides the fact that this approach is very lean and easy to understand, I also think it's the right thing to do given how this information is created (it might be more accurate to use subversion, but afaik the build process shouldn't depend on this, so it's not an option).

Agreed. svn info can get the information, but then the build only works if Subversion is present and the doc tree is a working copy, neither of which can be assumed.

As Michael says, source files are not necessarily XML, and I think that use of version strings in the XML files is not consistent.

We could (and maybe should) also check the latest dates of other types of files that affect the rendered output, like illustrations. Those do not always have easily accessible version strings, though.

share/mk/doc.docbook.mk
90

Needs the -s option for grep here to avoid noise about generated files listed in SRCS but not always present. Example: the mirror files in the Handbook. To test, cd en_US.ISO8859-1/books/handbook && make clean && make -V SRCS.

grembo edited edge metadata.
grembo marked an inline comment as done.

Add -s to grep to silence error messages in stages of the build
when certain files don't exist yet.

share/mk/doc.docbook.mk
90

Good catch, thank you.

wblock edited edge metadata.

No further feedback...

Committed in r48778:

Replace revision and publication date in generated documentation with
the actual date of last update. This fixes the problems with misleading
"last update" dates that only reflect the change in a single
rarely-changed file. Note that hrs had reservations about doing this in
the Makefile rather than with a stylesheet. However, not all our source
files are XML. For now, this change works, and can be replaced by a
more elegant solution later. We should also consider checking dates on
other files that affect the content or appearance of documents, like
images.

@wblock This has been committed quite some time ago, but as @hrs requested changes, I can't close it (this would only have happened if the svn revision mentioned the review). As it was committed, I would prefer not to abandon it. Any ideas how to solve this?

This revision is now accepted and ready to land.Mar 28 2017, 11:08 PM

Never mind, apparently I can accept it myself and this is good enough to allow me to close it.