main: distribute leapseconds in tzdata, and fix timestamps

Problem with leapseconds reported by Matt Burgess in
<http://mm.icann.org/pipermail/tz/2013-September/020379.html>
with a followup by Ian Abbott in
<http://mm.icann.org/pipermail/tz/2013-September/020383.html>.
* Makefile (MANTXTS): New macro.
(maintainer-clean): Use it.
(DOCS): Add it.
(DATA): Add 'leapseconds'.
(LEAP_DEPS): New macro.
(leapseconds): Use it.
(public): Don't depend on set-timestamps; each tarball does that
individually now, to allow for more parallelization.
(date.1.txt, newctime.3.txt, newstrftime.3.txt, newtzset.3.txt)
(time2posix.3.txt, tzfile.5.txt, tzselect.8.txt, zdump.8.txt)
(zic.8.txt): Depend on the corresponding non-.txt file.
$(MANTXTS): New rule.
(set-timestamps.out): Rename from set-timestamps, and make it a file,
so that it has its own timestamp; this avoids useless rework.
Depend on $(ENCHILADA) and ignore files under Git that are not
also listed in $(ENCHILADA).  Set the timestamp of 'leapseconds'
and each $(MANTXTS) to be the maximum of its dependencies, to avoid
timestamp churn in future tarballs.  Prefer touch -m, as we don't
care about access time here.
(tzcode$(VERSION).tar.gz, tzdata$(VERSION).tar.gz):
Depend on set-timestamps.out rather than the individual files,
so timestamps are set before creating the tarballs even when
make is parallelized.
(tzcode$(VERSION).tar.gz): Don't mention *.[1-8].txt explicitly,
since we now get $(MANTXTS) via $(DOCS).
* NEWS: Document the above.
This commit is contained in:
Paul Eggert
2013-09-25 15:50:44 -07:00
parent ca267f2db1
commit a5851f83d3
2 changed files with 45 additions and 15 deletions
+38 -15
View File
@@ -311,8 +311,12 @@ NEWUCBSRCS= date.c strftime.c
SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) tzselect.ksh
MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
tzfile.5 tzselect.8 zic.8 zdump.8
MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
time2posix.3.txt \
tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
date.1.txt
COMMON= Makefile README
DOCS= NEWS Theory $(MANS) date.1
DOCS= NEWS Theory $(MANS) date.1 $(MANTXTS)
PRIMARY_YDATA= africa antarctica asia australasia \
europe northamerica southamerica
YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward
@@ -320,8 +324,9 @@ NDATA= systemv factory
SDATA= solar87 solar88 solar89
TDATA= $(YDATA) $(NDATA) $(SDATA)
TABDATA= iso3166.tab zone.tab
LEAP_DEPS= leapseconds.awk leap-seconds.list
DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) \
leap-seconds.list yearistype.sh
leapseconds $(LEAP_DEPS) yearistype.sh
WEB_PAGES= tz-art.htm tz-link.htm
AWK_SCRIPTS= checktab.awk leapseconds.awk
MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
@@ -382,7 +387,7 @@ yearistype: yearistype.sh
cp yearistype.sh yearistype
chmod +x yearistype
leapseconds: leapseconds.awk leap-seconds.list
leapseconds: $(LEAP_DEPS)
$(AWK) -f leapseconds.awk leap-seconds.list >$@
posix_only: zic $(TDATA)
@@ -460,22 +465,38 @@ clean: clean_misc
maintainer-clean: clean
@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'
rm -f *.[1-8].txt *.asc *.tar.gz
rm -f $(MANTXTS) *.asc *.tar.gz
names:
@echo $(ENCHILADA)
public: check check_public check_time_t_alternatives \
set-timestamps tarballs signatures
tarballs signatures
date.1.txt: date.1
newctime.3.txt: newctime.3
newstrftime.3.txt: newstrftime.3
newtzset.3.txt: newtzset.3
time2posix.3.txt: time2posix.3
tzfile.5.txt: tzfile.5
tzselect.8.txt: tzselect.8
zdump.8.txt: zdump.8
zic.8.txt: zic.8
$(MANTXTS): workman.sh
LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@
# Set the time stamps to those of the git repository, if available,
# and if the files have not changed since then.
# This uses GNU 'touch' syntax 'touch -d@N FILE',
# where N is the number of seconds since 1970.
# If git or GNU 'touch' is absent, do nothing and fail.
set-timestamps:
-files=`git ls-files` && \
touch -d @1 test.out && rm -f test.out && \
# Also, set the timestamp of each prebuilt file like 'leapseconds'
# to be the maximum of the files it depends on.
set-timestamps.out: $(ENCHILADA)
rm -f $@
-files=`git ls-files $(ENCHILADA)` && \
touch -md @1 test.out && rm -f test.out && \
for file in $$files; do \
if git diff --quiet $$file; then \
time=`git log -1 --format='tformat:%ct' $$file` && \
@@ -484,6 +505,12 @@ set-timestamps:
echo >&2 "$$file: warning: does not match repository"; \
fi || exit; \
done
touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
exit; \
done
touch $@
# The zics below ensure that each data file can stand on its own.
# We also do an all-files run to catch links to links.
@@ -529,17 +556,13 @@ check_time_t_alternatives:
tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC)
for i in *.[1-8] ; do \
LC_ALL=C sh workman.sh $$i > $$i.txt && \
touch -r $$i $$i.txt || exit; \
done
tzcode$(VERSION).tar.gz: set-timestamps.out
LC_ALL=C && export LC_ALL && \
tar $(TARFLAGS) -cf - \
$(COMMON) $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | \
$(COMMON) $(DOCS) $(SOURCES) $(MISC) | \
gzip $(GZIPFLAGS) > $@
tzdata$(VERSION).tar.gz: $(COMMON) $(DATA)
tzdata$(VERSION).tar.gz: set-timestamps.out
LC_ALL=C && export LC_ALL && \
tar $(TARFLAGS) -cf - $(COMMON) $(DATA) | \
gzip $(GZIPFLAGS) > $@