Skip to content

Commit fbe098e

Browse files
committed
IANA 2022b
2 parents 14f33bf + 301a880 commit fbe098e

32 files changed

+1938
-1275
lines changed

tz/Makefile

+119-41
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ DATAFORM= main
3333
# make zonenames
3434
# to get a list of the values you can use for LOCALTIME.
3535

36-
LOCALTIME= GMT
36+
LOCALTIME= Factory
3737

3838
# The POSIXRULES macro controls interpretation of nonstandard and obsolete
3939
# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
@@ -176,12 +176,19 @@ TZDATA_TEXT= leapseconds tzdata.zi
176176

177177
BACKWARD= backward
178178

179-
# If you want out-of-scope and often-wrong data from the file 'backzone', use
179+
# If you want out-of-scope and often-wrong data from the file 'backzone',
180+
# but only for entries listed in the backward-compatibility file zone.tab, use
180181
# PACKRATDATA= backzone
182+
# PACKRATLIST= zone.tab
183+
# If you want all the 'backzone' data, use
184+
# PACKRATDATA= backzone
185+
# PACKRATLIST=
181186
# To omit this data, use
182187
# PACKRATDATA=
188+
# PACKRATLIST=
183189

184190
PACKRATDATA=
191+
PACKRATLIST=
185192

186193
# The name of a locale using the UTF-8 encoding, used during self-tests.
187194
# The tests are skipped if the name does not appear to work on this system.
@@ -264,7 +271,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
264271
$(GCC_INSTRUMENT) \
265272
-Wall -Wextra \
266273
-Walloc-size-larger-than=100000 -Warray-bounds=2 \
267-
-Wbad-function-cast -Wcast-align=strict -Wdate-time \
274+
-Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
268275
-Wdeclaration-after-statement -Wdouble-promotion \
269276
-Wduplicated-branches -Wduplicated-cond \
270277
-Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
@@ -278,7 +285,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
278285
-Wsuggest-attribute=const -Wsuggest-attribute=format \
279286
-Wsuggest-attribute=malloc \
280287
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
281-
-Wtrampolines -Wundef -Wuninitialized -Wunused-macros \
288+
-Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
282289
-Wvariadic-macros -Wvla -Wwrite-strings \
283290
-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
284291
-Wno-type-limits -Wno-unused-parameter
@@ -448,6 +455,9 @@ UNUSUAL_OK_IPA = u̯
448455
# useful in commentary.
449456
UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
450457
458+
# Put this in a bracket expression to match spaces.
459+
s = [:space:]
460+
451461
# OK_CHAR matches any character allowed in the distributed files.
452462
# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
453463
# multibyte letters are also allowed so that commentary can contain a
@@ -521,8 +531,9 @@ TDATA= $(YDATA) $(NDATA) $(BACKWARD)
521531
ZONETABLES= zone1970.tab zone.tab
522532
TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
523533
LEAP_DEPS= leapseconds.awk leap-seconds.list
524-
TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA)
525-
DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA)
534+
TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
535+
$(PACKRATDATA) $(PACKRATLIST)
536+
DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
526537
DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
527538
leapseconds $(ZONETABLES)
528539
AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
@@ -534,8 +545,9 @@ TZS= to$(TZS_YEAR).tzs
534545
TZS_NEW= to$(TZS_YEAR)new.tzs
535546
TZS_DEPS= $(YDATA) asctime.c localtime.c \
536547
private.h tzfile.h zdump.c zic.c
548+
TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
537549
# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
538-
EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
550+
EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
539551
ENCHILADA = $(EIGHT_YARDS) $(TZS)
540552
541553
# Consult these files when deciding whether to rebuild the 'version' file.
@@ -608,13 +620,17 @@ version: $(VERSION_DEPS)
608620
printf '%s\n' "$$V" >$@.out
609621
mv $@.out $@
610622
611-
# These files can be tailored by setting BACKWARD and PACKRATDATA.
623+
# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
612624
vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
613-
$(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
625+
$(AWK) \
626+
-v DATAFORM=`expr $@ : '\(.*\).zi'` \
627+
-v PACKRATDATA='$(PACKRATDATA)' \
628+
-v PACKRATLIST='$(PACKRATLIST)' \
629+
-f ziguard.awk \
614630
$(TDATA) $(PACKRATDATA) >$@.out
615631
mv $@.out $@
616632
# This file has a version comment that attempts to capture any tailoring
617-
# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
633+
# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
618634
tzdata.zi: $(DATAFORM).zi version zishrink.awk
619635
version=`sed 1q version` && \
620636
LC_ALL=C $(AWK) \
@@ -652,6 +668,7 @@ INSTALLARGS = \
652668
DESTDIR='$(DESTDIR)' \
653669
LEAPSECONDS='$(LEAPSECONDS)' \
654670
PACKRATDATA='$(PACKRATDATA)' \
671+
PACKRATLIST='$(PACKRATLIST)' \
655672
TZDEFAULT='$(TZDEFAULT)' \
656673
TZDIR='$(TZDIR)' \
657674
ZIC='$(ZIC)'
@@ -690,11 +707,6 @@ posix_right: posix_only
690707
$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
691708
$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
692709
693-
# This obsolescent rule is present for backwards compatibility with
694-
# tz releases 2014g through 2015g. It should go away eventually.
695-
posix_packrat: $(INSTALL_DATA_DEPS)
696-
$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
697-
698710
zones: $(REDO)
699711
700712
# dummy.zd is not a real file; it is mentioned here only so that the
@@ -755,8 +767,8 @@ tzselect: tzselect.ksh version
755767
mv $@.out $@
756768
757769
check: check_character_set check_white_space check_links \
758-
check_name_lengths check_sorted \
759-
check_tables check_web check_zishrink check_tzs
770+
check_name_lengths check_slashed_abbrs check_sorted \
771+
check_tables check_web check_ziguard check_zishrink check_tzs
760772
761773
check_character_set: $(ENCHILADA)
762774
test ! '$(UTF8_LOCALE)' || \
@@ -780,19 +792,28 @@ check_white_space: $(ENCHILADA)
780792
patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
781793
! grep -En "$$pat" \
782794
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
783-
! grep -n '[[:space:]]$$' \
795+
! grep -n '[$s]$$' \
784796
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
785797
touch $@
786798
787-
PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
788-
FILE_NAME_COMPONENT_TOO_LONG = \
789-
$(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15}
799+
PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
800+
FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
790801
791802
check_name_lengths: $(TDATA_TO_CHECK) backzone
792803
! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
793804
$(TDATA_TO_CHECK) backzone
794805
touch $@
795806
807+
PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
808+
STDOFF = [-+]?[0-9:.]+
809+
RULELESS_SAVE = (-|$(STDOFF)[sd]?)
810+
RULELESS_SLASHED_ABBRS = \
811+
$(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
812+
813+
check_slashed_abbrs: $(TDATA_TO_CHECK)
814+
! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
815+
touch $@
816+
796817
CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
797818
798819
check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
@@ -832,11 +853,19 @@ check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
832853
test ! -s $@.out || { cat $@.out; exit 1; }
833854
mv $@.out $@
834855
856+
check_ziguard: rearguard.zi vanguard.zi ziguard.awk
857+
$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
858+
diff -u rearguard.zi -
859+
$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
860+
diff -u vanguard.zi -
861+
touch $@
862+
835863
# Check that zishrink.awk does not alter the data, and that ziguard.awk
836864
# preserves main-format data.
837865
check_zishrink: check_zishrink_posix check_zishrink_right
838866
check_zishrink_posix check_zishrink_right: \
839-
zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi
867+
zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
868+
$(TDATA) $(DATAFORM).zi tzdata.zi
840869
rm -fr $@.dir $@-t.dir $@-shrunk.dir
841870
mkdir $@.dir $@-t.dir $@-shrunk.dir
842871
case $@ in \
@@ -845,8 +874,8 @@ check_zishrink_posix check_zishrink_right: \
845874
esac && \
846875
$(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
847876
$(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
848-
case $(DATAFORM) in \
849-
main) \
877+
case $(DATAFORM),$(PACKRATLIST) in \
878+
main,) \
850879
$(ZIC) $$leap -d $@-t.dir $(TDATA) && \
851880
$(AWK) '/^Rule/' $(TDATA) | \
852881
$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
@@ -967,6 +996,10 @@ check_public: $(VERSION_DEPS)
967996
rm public.dir/main.zi
968997
cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
969998
public.dir/zic -d public.dir/zoneinfo main.zi
999+
rm public.dir/main.zi
1000+
cd public.dir && \
1001+
$(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
1002+
public.dir/zic -d public.dir/zoneinfo main.zi
9701003
:
9711004
rm -fr public.dir
9721005
touch $@
@@ -1027,9 +1060,9 @@ REARGUARD_ASC = \
10271060
ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
10281061
tzdb-$(VERSION).tar.lz.asc
10291062
1030-
tarballs rearguard_tarballs traditional_tarballs \
1063+
tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
10311064
signatures rearguard_signatures traditional_signatures: \
1032-
version set-timestamps.out rearguard.zi
1065+
version set-timestamps.out rearguard.zi vanguard.zi
10331066
VERSION=`cat version` && \
10341067
$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
10351068
@@ -1042,6 +1075,8 @@ rearguard_tarballs_version: \
10421075
tzdata$(VERSION)-rearguard.tar.gz
10431076
traditional_tarballs_version: \
10441077
tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
1078+
tailored_tarballs_version: \
1079+
tzdata$(VERSION)-tailored.tar.gz
10451080
signatures_version: $(ALL_ASC)
10461081
rearguard_signatures_version: $(REARGUARD_ASC)
10471082
traditional_signatures_version: $(TRADITIONAL_ASC)
@@ -1055,34 +1090,76 @@ tzcode$(VERSION).tar.gz: set-timestamps.out
10551090
10561091
tzdata$(VERSION).tar.gz: set-timestamps.out
10571092
LC_ALL=C && export LC_ALL && \
1058-
tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
1093+
tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
10591094
gzip $(GZIPFLAGS) >[email protected]
10601095
10611096
1097+
# Create empty files with a reproducible timestamp.
1098+
CREATE_EMPTY = TZ=UTC0 touch -mt 202010122253.00
1099+
1100+
# The obsolescent *rearguard* targets and related macros are present
1101+
# for backwards compatibility with tz releases 2018e through 2022a.
1102+
# They should go away eventually. To build rearguard tarballs you
1103+
# can instead use 'make DATAFORM=rearguard tailored_tarballs'.
10621104
tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
1063-
rm -fr tzdata$(VERSION)-rearguard.dir
1064-
mkdir tzdata$(VERSION)-rearguard.dir
1065-
ln $(COMMON) $(DATA) $(MISC) tzdata$(VERSION)-rearguard.dir
1066-
cd tzdata$(VERSION)-rearguard.dir && \
1067-
rm -f $(TDATA) $(PACKRATDATA) version
1105+
1106+
1107+
ln $(TZDATA_DIST) [email protected]
1108+
cd [email protected] && rm -f $(TDATA) $(PACKRATDATA) version
10681109
for f in $(TDATA) $(PACKRATDATA); do \
1069-
rearf=tzdata$(VERSION)-rearguard.dir/$$f; \
1110+
rearf=$@.dir/$$f; \
10701111
$(AWK) -v DATAFORM=rearguard -f ziguard.awk $$f >$$rearf && \
10711112
$(SET_TIMESTAMP_DEP) $$rearf ziguard.awk $$f || exit; \
10721113
done
1073-
sed '1s/$$/-rearguard/' \
1074-
<version >tzdata$(VERSION)-rearguard.dir/version
1114+
sed '1s/$$/-rearguard/' <version >[email protected]/version
10751115
: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1076-
TZ=UTC0 touch -mt 202010122253.00 \
1077-
tzdata$(VERSION)-rearguard.dir/pacificnew
1078-
touch -cmr version tzdata$(VERSION)-rearguard.dir/version
1116+
$(CREATE_EMPTY) [email protected]/pacificnew
1117+
touch -cmr version [email protected]/version
10791118
LC_ALL=C && export LC_ALL && \
1080-
(cd tzdata$(VERSION)-rearguard.dir && \
1119+
(cd $@.dir && \
10811120
tar $(TARFLAGS) -cf - \
1082-
$(COMMON) $(DATA) $(MISC) pacificnew | \
1121+
$(TZDATA_DIST) pacificnew | \
10831122
gzip $(GZIPFLAGS)) >[email protected]
10841123
10851124
1125+
# Create a tailored tarball suitable for TZUpdater and compatible tools.
1126+
# For example, 'make DATAFORM=vanguard tailored_tarballs' makes a tarball
1127+
# useful for testing whether TZUpdater supports vanguard form.
1128+
# The generated tarball is not byte-for-byte equivalent to a hand-tailored
1129+
# traditional tarball, as data entries are put into 'etcetera' even if they
1130+
# came from some other source file. However, the effect should be the same
1131+
# for ordinary use, which reads all the source files.
1132+
tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
1133+
1134+
1135+
: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
1136+
1137+
$(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
1138+
`test $(DATAFORM) = vanguard || echo pacificnew`
1139+
(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
1140+
1141+
touch -cmr tzdata.zi [email protected]/etcetera
1142+
sed -n \
1143+
-e '/^# *version *\(.*\)/h' \
1144+
-e '/^# *ddeps */H' \
1145+
-e '$$!d' \
1146+
-e 'g' \
1147+
-e 's/^# *version *//' \
1148+
-e 's/\n# *ddeps */-/' \
1149+
-e 's/ /-/g' \
1150+
-e 'p' \
1151+
<tzdata.zi >[email protected]/version
1152+
touch -cmr version [email protected]/version
1153+
links= && \
1154+
for file in $(TZDATA_DIST); do \
1155+
test -f [email protected]/$$file || links="$$links $$file"; \
1156+
done && \
1157+
ln $$links [email protected]
1158+
LC_ALL=C && export LC_ALL && \
1159+
1160+
tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >[email protected]
1161+
1162+
10861163
tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
10871164
rm -fr tzdb-$(VERSION)
10881165
mkdir tzdb-$(VERSION)
@@ -1134,13 +1211,14 @@ zic.o: private.h tzfile.h version.h
11341211
.PHONY: check_web check_zishrink
11351212
.PHONY: clean clean_misc dummy.zd force_tzs
11361213
.PHONY: install install_data maintainer-clean names
1137-
.PHONY: posix_only posix_packrat posix_right public
1214+
.PHONY: posix_only posix_right public
11381215
.PHONY: rearguard_signatures rearguard_signatures_version
11391216
.PHONY: rearguard_tarballs rearguard_tarballs_version
11401217
.PHONY: right_only right_posix signatures signatures_version
11411218
.PHONY: tarballs tarballs_version
11421219
.PHONY: traditional_signatures traditional_signatures_version
11431220
.PHONY: traditional_tarballs traditional_tarballs_version
1221+
.PHONY: tailored_tarballs tailored_tarballs_version
11441222
.PHONY: typecheck
11451223
.PHONY: zonenames zones
11461224
.PHONY: $(ZDS)

0 commit comments

Comments
 (0)