[PATCH 0/1] Allow 'backzone' to be incorporated in 'right' data

The REDO macro in the Makefile currently allows you to build POSIX data, 'right' data, or both sets with either the default. It also allows information from the 'backzone' file to be incorporated into the POSIX data set but not if the 'right' data is being built to. There may be some unlucky bar steward out there who needs to incorporate the 'backzone' file data into the 'right' data set, or into both the POSIX and 'right' data sets, so I added a few extra targets to the Makefile for your consideration. See patch in following email.

* NEWS: Document this. * Makefile: Add targets 'posix_right_packrat', 'right_packrat', and 'right_posix_packrat' which behave like 'posix_right', 'right_only', and 'right_posix', but incorporate information from the 'backzone' file into the data sets in the same way as the existing 'posix_packrat' target. --- Makefile | 77 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- NEWS | 8 +++++++ 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index d2f64c8..cb74cf6 100644 --- a/Makefile +++ b/Makefile @@ -72,23 +72,29 @@ MANDIR= $(TOPDIR)/man LIBDIR= $(TOPDIR)/lib -# If you always want time values interpreted as "seconds since the epoch -# (not counting leap seconds)", use -# REDO= posix_only -# below. If you always want right time values interpreted as "seconds since -# the epoch" (counting leap seconds)", use -# REDO= right_only -# below. If you want both sets of data available, with leap seconds not -# counted normally, use -# REDO= posix_right -# below. If you want both sets of data available, with leap seconds counted -# normally, use -# REDO= right_posix -# below. If you want just POSIX-compatible time values, but with -# out-of-scope and often-wrong data from the file 'backzone', use -# REDO= posix_packrat +# Set 'REDO' according to the table below. +# +# REDO= posix? right? default + packrat? +# ------------------- ------ ------ ------- ---------- +# posix_only Yes No posix No +# right_only No Yes right No +# posix_right Yes Yes posix No +# right_posix Yes Yes right No +# posix_packrat Yes No posix Yes +# right_packrat No Yes right Yes +# posix_right_packrat Yes Yes posix Yes +# right_posix_packrat Yes Yes right Yes +# +# A "Yes" in the "posix?" column indicates that POSIX-compatible time values +# interpreted as "seconds since the epoch (not counting leap seconds)" are +# available. A "Yes" in the "right?" column indicates that right time values +# interpreted as "seconds since the epoch (counting leap seconds)" are +# available. The "default" column indicates the set of values used by default. +# A "Yes" in the "+ packrat?" column indicates that out-of-scope and +# often wrong data from the file 'backzone' is to be included. +# # POSIX mandates that leap seconds not be counted; for compatibility with it, -# use "posix_only", "posix_right", or "posix_packrat". +# use "posix_only", "posix_right", "posix_packrat", or "posix_right_packrat". REDO= posix_right @@ -441,11 +447,44 @@ posix_right: posix_only leapseconds $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ -L leapseconds $(TDATA) +right_packrat: right_only leapseconds backzone + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ + -L leapseconds - backzone + posix_packrat: posix_only backzone $(AWK) '/^Rule/' $(TDATA) | \ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ -L /dev/null - backzone +right_posix_packrat: right_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-leaps + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone + +posix_right_packrat: posix_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-posix + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone + zones: $(REDO) libtz.a: $(LIBOBJS) @@ -660,6 +699,6 @@ zic.o: private.h tzfile.h version.h .PHONY: check check_character_set check_links .PHONY: check_public check_sorted check_tables .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc -.PHONY: install maintainer-clean names posix_packrat posix_only posix_right -.PHONY: public right_only right_posix signatures tarballs typecheck -.PHONY: zonenames zones +.PHONY: install maintainer-clean names posix_only posix_packrat posix_right +.PHONY: posix_right_packrat public right_only right_packrat right_posix +.PHONY: right_posix_packrat signatures tarballs typecheck zonenames zones diff --git a/NEWS b/NEWS index a3e9e10..3263a00 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,14 @@ Unreleased, experimental changes This simplifies the code and is consistent with zdump.c. (Problem reported by Christos Zoulas.) + Changes affecting build procedure + + The 'REDO' Makefile macro now supports additional values + 'posix_right_packrat', 'right_packrat', and 'right_posix_packrat'. + These extend 'posix_right', 'right_only', and 'right_posix' in the + same way that 'posix_packrat' extends 'posix_only', incorporating + information from the 'backzone' file into the data sets. + Changes affecting documentation The tzfile man page now documents that transition times denote the -- 2.5.1

On 24/09/15 19:12, Ian Abbott wrote:
+right_posix_packrat: right_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-leaps + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone + +posix_right_packrat: posix_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-posix + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone +
Oops, I'm missing some braces in those compound shell commands. I'll post an updated patch. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-

* NEWS: Document this. * Makefile: Add targets 'posix_right_packrat', 'right_packrat', and 'right_posix_packrat' which behave like 'posix_right', 'right_only', and 'right_posix', but incorporate information from the 'backzone' file into the data sets in the same way as the existing 'posix_packrat' target. --- v2: Correct the compound shell commands; they need some braces. Makefile | 77 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- NEWS | 8 +++++++ 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index d2f64c8..9b7ca67 100644 --- a/Makefile +++ b/Makefile @@ -72,23 +72,29 @@ MANDIR= $(TOPDIR)/man LIBDIR= $(TOPDIR)/lib -# If you always want time values interpreted as "seconds since the epoch -# (not counting leap seconds)", use -# REDO= posix_only -# below. If you always want right time values interpreted as "seconds since -# the epoch" (counting leap seconds)", use -# REDO= right_only -# below. If you want both sets of data available, with leap seconds not -# counted normally, use -# REDO= posix_right -# below. If you want both sets of data available, with leap seconds counted -# normally, use -# REDO= right_posix -# below. If you want just POSIX-compatible time values, but with -# out-of-scope and often-wrong data from the file 'backzone', use -# REDO= posix_packrat +# Set 'REDO' according to the table below. +# +# REDO= posix? right? default + packrat? +# ------------------- ------ ------ ------- ---------- +# posix_only Yes No posix No +# right_only No Yes right No +# posix_right Yes Yes posix No +# right_posix Yes Yes right No +# posix_packrat Yes No posix Yes +# right_packrat No Yes right Yes +# posix_right_packrat Yes Yes posix Yes +# right_posix_packrat Yes Yes right Yes +# +# A "Yes" in the "posix?" column indicates that POSIX-compatible time values +# interpreted as "seconds since the epoch (not counting leap seconds)" are +# available. A "Yes" in the "right?" column indicates that right time values +# interpreted as "seconds since the epoch (counting leap seconds)" are +# available. The "default" column indicates the set of values used by default. +# A "Yes" in the "+ packrat?" column indicates that out-of-scope and +# often wrong data from the file 'backzone' is to be included. +# # POSIX mandates that leap seconds not be counted; for compatibility with it, -# use "posix_only", "posix_right", or "posix_packrat". +# use "posix_only", "posix_right", "posix_packrat", or "posix_right_packrat". REDO= posix_right @@ -441,11 +447,44 @@ posix_right: posix_only leapseconds $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ -L leapseconds $(TDATA) +right_packrat: right_only leapseconds backzone + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ + -L leapseconds - backzone + posix_packrat: posix_only backzone $(AWK) '/^Rule/' $(TDATA) | \ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ -L /dev/null - backzone +right_posix_packrat: right_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-leaps + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ + { $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone ; } + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone + +posix_right_packrat: posix_packrat leapseconds backzone + rm -fr $(DESTDIR)$(TZDIR)-posix + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ + { $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ + -L /dev/null - backzone ; } + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ + -L leapseconds - backzone + zones: $(REDO) libtz.a: $(LIBOBJS) @@ -660,6 +699,6 @@ zic.o: private.h tzfile.h version.h .PHONY: check check_character_set check_links .PHONY: check_public check_sorted check_tables .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc -.PHONY: install maintainer-clean names posix_packrat posix_only posix_right -.PHONY: public right_only right_posix signatures tarballs typecheck -.PHONY: zonenames zones +.PHONY: install maintainer-clean names posix_only posix_packrat posix_right +.PHONY: posix_right_packrat public right_only right_packrat right_posix +.PHONY: right_posix_packrat signatures tarballs typecheck zonenames zones diff --git a/NEWS b/NEWS index a3e9e10..3263a00 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,14 @@ Unreleased, experimental changes This simplifies the code and is consistent with zdump.c. (Problem reported by Christos Zoulas.) + Changes affecting build procedure + + The 'REDO' Makefile macro now supports additional values + 'posix_right_packrat', 'right_packrat', and 'right_posix_packrat'. + These extend 'posix_right', 'right_only', and 'right_posix' in the + same way that 'posix_packrat' extends 'posix_only', incorporating + information from the 'backzone' file into the data sets. + Changes affecting documentation The tzfile man page now documents that transition times denote the -- 2.5.1

On 09/24/2015 11:12 AM, Ian Abbott wrote:
There may be some unlucky bar steward out there who needs to incorporate the 'backzone' file data into the 'right' data set, or into both the POSIX and 'right' data sets
With luck that will never happen. If it does happen, though, we need an approach where the length of the makefile doesn't explode combinatorially with the number of installation options. I had already considered something along the lines suggested, but backed off when I saw it about to blow. Maybe you can tweak the makefile to do something recursive and nonexplosive instead? But if not, it's OK to leave it the way it is.

On 24/09/15 21:44, Paul Eggert wrote:
On 09/24/2015 11:12 AM, Ian Abbott wrote:
There may be some unlucky bar steward out there who needs to incorporate the 'backzone' file data into the 'right' data set, or into both the POSIX and 'right' data sets
With luck that will never happen. If it does happen, though, we need an approach where the length of the makefile doesn't explode combinatorially with the number of installation options. I had already considered something along the lines suggested, but backed off when I saw it about to blow. Maybe you can tweak the makefile to do something recursive and nonexplosive instead? But if not, it's OK to leave it the way it is.
Would something along the lines of the attached Makefile be suitable? It uses a single target to build one or two data sets (for two data sets there is also a symbolic link to - or a copy of - the default data set), but does clever tricks with Makefile macros. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-

On 09/28/2015 11:01 AM, Ian Abbott wrote:
Would something along the lines of the attached Makefile be suitable? It uses a single target to build one or two data sets
It has just one target, but it has a large number of macros, and this number will grow exponentially with the number of options we add. I'd rather have an approach where the Makefile doesn't grow exponentially with the number of options.

On 28/09/15 22:53, Paul Eggert wrote:
On 09/28/2015 11:01 AM, Ian Abbott wrote:
Would something along the lines of the attached Makefile be suitable? It uses a single target to build one or two data sets
It has just one target, but it has a large number of macros, and this number will grow exponentially with the number of options we add. I'd rather have an approach where the Makefile doesn't grow exponentially with the number of options.
I think that would mean replacing the 'REDO' macro with separate macros to control whether the main set of data is 'posix' or 'right', whether the second (opposite) set of data is to be made available, and whether the 'backzone' data is to be incorporated. Something along the lines of the attached Makefile? (I can convert this to a patch if required, but want to see what you think first.) One thing I'm not too sure of is the portability of macro expansions such as $(TZDIR_$(SET1)) which might make this a non-starter! -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-

On 09/29/2015 07:06 AM, Ian Abbott wrote:
I think that would mean replacing the 'REDO' macro with separate macros to control whether the main set of data is 'posix' or 'right', whether the second (opposite) set of data is to be made available, and whether the 'backzone' data is to be incorporated
Yes, something like that. The basic idea is that the makefile should grow linearly with the number of installation options, not exponentially.
One thing I'm not too sure of is the portability of macro expansions such as $(TZDIR_$(SET1)) which might make this a non-starter!
Unfortunately you're right, it's not portable, as it doesn't work with traditional 'make'. POSIX isn't clear in this area, but my best guess is that POSIX doesn't require support for that sort of usage. Perhaps use a recursive call to $(MAKE) instead?

On 29/09/15 20:17, Paul Eggert wrote:
On 09/29/2015 07:06 AM, Ian Abbott wrote:
I think that would mean replacing the 'REDO' macro with separate macros to control whether the main set of data is 'posix' or 'right', whether the second (opposite) set of data is to be made available, and whether the 'backzone' data is to be incorporated
Yes, something like that. The basic idea is that the makefile should grow linearly with the number of installation options, not exponentially.
One thing I'm not too sure of is the portability of macro expansions such as $(TZDIR_$(SET1)) which might make this a non-starter!
Unfortunately you're right, it's not portable, as it doesn't work with traditional 'make'. POSIX isn't clear in this area, but my best guess is that POSIX doesn't require support for that sort of usage. Perhaps use a recursive call to $(MAKE) instead?
Yes it looks like the results are unspecified by POSIX: "If string1 in a macro expansion contains a macro expansion, the results are unspecified." The attached version uses recursive calls to $(MAKE) instead. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-

Ian Abbott wrote:
The attached version uses recursive calls to $(MAKE) instead.
Thanks for doing all that. In mulling over it for a (long) while, I'd like to preserve the existing rule names, as I expect other packages may be using 'make posix_right' etc. I hacked on it a bit and came up with the attached more-conservative take on the submake idea, which I just now installed into the experimental version on GitHub. Please give it a try when you have the time.

On 10/12/15 06:21, Paul Eggert wrote:
Ian Abbott wrote:
The attached version uses recursive calls to $(MAKE) instead.
Thanks for doing all that. In mulling over it for a (long) while, I'd like to preserve the existing rule names, as I expect other packages may be using 'make posix_right' etc. I hacked on it a bit and came up with the attached more-conservative take on the submake idea, which I just now installed into the experimental version on GitHub. Please give it a try when you have the time.
Thanks! I tried it. Seems to work. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-
participants (2)
-
Ian Abbott
-
Paul Eggert