[PROPOSED] One line per metadatum in tzdata.zi

With the new metadata, version lines could be long. E.g., 'make DATAFORM=rearguard REDO=posix_only PACKRATDATA=backzone BACKWARD=' could generate a tzdata.zi line like this: # version 2018e-57-gba7f088,dataform=rearguard,redo=posix_only,ddeps=(backzone,!backward) which is quite a mouthful and is stretching the definition of "version". To avoid the problem, output a separate comment line for each metadata component instead, like this: # version 2018e-57-gba7f088 # dataform rearguard # redo posix_only # ddeps backzone !backward This is easier to read and to parse and should scale better if we add more metadata later. * NEWS: Mention this. * zishrink.awk: Output a separate line for each metadatum. 2018-07-21 Paul Eggert <eggert@cs.ucla.edu> Use space, not comma, in tzdata.zi "# version" * zishrink.awk: Use space instead of comma to separate original version string from auxiliary configuration information. This saves two bytes and (more important) is easier for humans to read. --- NEWS | 16 ++++++++-------- zishrink.awk | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 413d649..a3fc622 100644 --- a/NEWS +++ b/NEWS @@ -92,14 +92,14 @@ Unreleased, experimental changes tzdata.zi is now more stable from release to release. (Problem noted by Tom Lane.) It is also a bit shorter. - tzdata.zi's version comment now contains information about which - data format was selected, which input files were used, and how - leap seconds are treated. (Problems noted by Lester Caine and - Brian Inglis.) If the Makefile defaults are used, no text is - appended to the version comment, for backward compatibility. - A redistributor intending to alter its copy of the files should - also append "-SOMETHING" to the 'version' file's first line, where - "SOMETHING" identifies what was changed. + tzdata.zi now can contain comment lines documenting configuration + information, such as which data format was selected, which input + files were used, and how leap seconds are treated. (Problems + noted by Lester Caine and Brian Inglis.) If the Makefile defaults + are used these comment lines are absent, for backward + compatibility. A redistributor intending to alter its copy of the + files should also append "-LABEL" to the 'version' file's first + line, where "LABEL" identifies the redistributor's change. Release 2018e - 2018-05-01 23:42:51 -0700 diff --git a/zishrink.awk b/zishrink.awk index 162e515..74e0de9 100644 --- a/zishrink.awk +++ b/zishrink.awk @@ -287,30 +287,30 @@ BEGIN { # that affect the output of this script, you should append '-SOMETHING' # to the contents of 'version', where SOMETHING identifies what was changed. - if (dataform != "main") { - version = version ",dataform=" dataform - } - if (redo != "posix_right") { - version = version ",redo=" redo - } ndeps = split(deps, dep) ddeps = "" for (i = 1; i <= ndeps; i++) { if (default_dep[dep[i]]) { default_dep[dep[i]]++ } else { - ddeps = ddeps "," dep[i] + ddeps = ddeps " " dep[i] } } for (d in default_dep) { if (default_dep[d] == 1) { - ddeps = ddeps ",!" d + ddeps = ddeps " !" d } } + print "# version", version + if (dataform != "main") { + print "# dataform", dataform + } + if (redo != "posix_right") { + print "# redo " redo + } if (ddeps) { - version = version ",ddeps=(" substr(ddeps, 2) ")" + print "# ddeps" ddeps } - print "# version", version print "# This zic input file is in the public domain." prehash_rule_names() -- 2.7.4
participants (1)
-
Paul Eggert