svn commit: r509250 - in head/misc/zoneinfo: . files

Thomas Munro tmunro at FreeBSD.org
Mon Aug 19 03:09:04 UTC 2019


Author: tmunro (src committer)
Date: Mon Aug 19 03:09:03 2019
New Revision: 509250
URL: https://svnweb.freebsd.org/changeset/ports/509250

Log:
  misc/zoneinfo: install zone1970.tab and other fixes
  
  Install zone1970.tab in addition to zone.tab (like D20646 for base).
  
  The old logic to remove countries from zone.tab doesn't port to
  zone1970.tab since some lines might have to be patched more than
  once. Replace it with some awk.
  
  Remove LEAPFILE reference that wasn't being set anyway.
  
  Fix plist entry for Etc/UCT, which is (since 2019a) part of
  "backward" and not present otherwise.
  
  Make BACKWARD not be the default, since (a) it's not the base system's
  default and (b) that stuff is all deprecated.
  
  Update comment about check-plist to include a reminder to check both with
  and without BACKWARD (this would have caught the existing plist error).
  
  Remove no-longer-needed include of bsd.port.pre.mk.
  
  Fix location and name of iso3166 file in comments in zone1970.tab, also
  to match base system.
  
  Add back a test-pkgplist target, because it turns out check-plist is not
  strict enough to handle the case of moving entries into or out of the
  "backward" set; check-plist doesn't error if a file is present in STAGEDIR
  but is commented out in the plist, but we want that to be noticed.
  
  Submitted by:	Andrew Gierth <andrew at tao11.riddles.org.uk>
  Reviewed by:	philip, skreuzer, tmunro
  Approved by:	skreuzer (maintainer), allanjude (src mentor)
  Differential Revision:	https://reviews.freebsd.org/D20981

Added:
  head/misc/zoneinfo/files/patch-etcetera   (contents, props changed)
  head/misc/zoneinfo/files/patch-zone1970.tab   (contents, props changed)
Deleted:
  head/misc/zoneinfo/files/patchremove-ax
  head/misc/zoneinfo/files/patchremove-bl
  head/misc/zoneinfo/files/patchremove-bq
  head/misc/zoneinfo/files/patchremove-cw
  head/misc/zoneinfo/files/patchremove-gg
  head/misc/zoneinfo/files/patchremove-im
  head/misc/zoneinfo/files/patchremove-je
  head/misc/zoneinfo/files/patchremove-me
  head/misc/zoneinfo/files/patchremove-mf
  head/misc/zoneinfo/files/patchremove-rs
  head/misc/zoneinfo/files/patchremove-ss
  head/misc/zoneinfo/files/patchremove-sx
Modified:
  head/misc/zoneinfo/Makefile
  head/misc/zoneinfo/pkg-plist

Modified: head/misc/zoneinfo/Makefile
==============================================================================
--- head/misc/zoneinfo/Makefile	Mon Aug 19 02:51:09 2019	(r509249)
+++ head/misc/zoneinfo/Makefile	Mon Aug 19 03:09:03 2019	(r509250)
@@ -3,6 +3,7 @@
 
 PORTNAME=	zoneinfo
 DISTVERSION=	2019b
+PORTREVISION=	1
 CATEGORIES=	misc
 MASTER_SITES=	https://data.iana.org/time-zones/releases/ \
 		ftp://ftp.iana.org/tz/releases/
@@ -18,61 +19,88 @@ PREFIX=		/usr
 NO_ARCH=	yes
 
 OPTIONS_DEFINE=	BACKWARD
-OPTIONS_DEFAULT=	BACKWARD
+OPTIONS_DEFAULT=
 OPTIONS_SUB=	yes
 
-BACKWARD_DESC= Include backwards compatible zones
+BACKWARD_DESC=	Include backwards compatible zones
+BACKWARD_VARS=	tzfiles+=backward
 
 TZFILES=	africa antarctica asia australasia etcetera europe \
 		factory northamerica southamerica systemv
 POSIXRULES=	America/New_York
 
-.include <bsd.port.options.mk>
+# Run both of:
+# "make DEVELOPER=1 WITHOUT=BACKWARD do-clean test-pkgplist"
+# and
+# "make DEVELOPER=1 WITH=BACKWARD do-clean test-pkgplist"
+# before commiting!
 
-.if ${PORT_OPTIONS:MBACKWARD}
-TZFILES+=	backward
-.endif
-
-# Run with "DEVELOPER=1 make check-plist" before commiting!
-
 # Make sure it breaks when the distfile isn't there anymore.
 .if !defined(PACKAGE_BUILDING)
 MASTER_SITES+=	http://people.freebsd.org/~edwin/
 .endif
 
-.include <bsd.port.pre.mk>
+# tzsetup objects (fatally) if any entry in zone.tab or zone1970.tab
+# refers to a country code that doesn't exist in misc/iso3166. While
+# arguably that should be fixed, for compatibility we remove such
+# entries here to avoid the problem.
+#
+# This used to be done by adding patch files for each country to
+# remove, but that doesn't work for zone1970.tab.
+#
+# We generate a list of all 2-letter codes that are NOT in iso3166;
+# then, for any entry in zone.tab or zone1970.tab that contains a bad
+# code: first emit a commented-out version of the line, then a version
+# with the bad codes stripped out of the first field (unless this
+# leaves the first field empty).
 
-# The following country codes can be missing from /usr/share/misc/iso3166 and
-# shouldn't appear in the zoneinfo file.
-MISSING=	ax bl bq cw gg im je me mf rs ss sx
+post-patch:
+	cd ${WRKSRC}; \
+	badc=$$(${AWK} '/^[^\#]/ { t[$$1]=1; }; \
+			END { for (i=0; i<676; ++i) { \
+				c = sprintf("%c%c", 65+int(i/26), 65+(i%26)); \
+				if (!(c in t)) print c; \
+			      } \
+			}' \
+			/usr/share/misc/iso3166 | \
+			${SED} -n -e '1h; 1!H; $${g;s/\n/|/g;p;}'); \
+	for fn in zone.tab zone1970.tab; do \
+		${MV} $${fn} $${fn}.bak; \
+		${AWK} -v FS="\t" -v OFS="\t" -v re="(^|,)($${badc})" \
+			'/^[^#]/ && $$1 ~ re { \
+				print "#" $$0; \
+				gsub(re,"",$$1); \
+				sub(/^,/,"",$$1); \
+			 }; \
+			 $$1 != "" { print; }' <$${fn}.bak >$${fn}; \
+	done
 
-.ifndef NOMISSING
-.for M in ${MISSING}
-HAS_${M:tu}!=	${GREP} -c ^${M:tu} /usr/share/misc/iso3166 || ${TRUE}
-.if ${HAS_${M:tu}} == "0"
-EXTRA_PATCHES+=	${FILESDIR}/patchremove-${M}
-.endif
-.endfor
-.endif
-
 do-build:
 	umask 022; \
 	cd ${WRKSRC}; \
 	zic -d ${WRKSRC}/zoneinfo -p ${POSIXRULES} -m ${NOBINMODE} \
-		${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
+		-y ${.OBJDIR}/yearistype ${TZFILES}
 
 do-install:
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/zoneinfo
-	${CP} -R -p ${WRKSRC}/zoneinfo/ ${STAGEDIR}${PREFIX}/share/zoneinfo
+	(cd ${WRKSRC}/zoneinfo && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/share/zoneinfo)
 	${INSTALL_DATA} ${WRKSRC}/zone.tab ${STAGEDIR}${PREFIX}/share/zoneinfo
+	${INSTALL_DATA} ${WRKSRC}/zone1970.tab ${STAGEDIR}${PREFIX}/share/zoneinfo
 
-test-patches:
-.for M in ${MISSING}
-	make clean
-	NOMISSING=1 EXTRA_PATCHES=${FILESDIR}/patchremove-${M} make patch
-.endfor
+# check-plist is too lenient for us; it doesn't care if there are
+# files in the stage dir that are commented out in plist due to port
+# options. But we need to check for an exact match, otherwise the
+# final package may be incorrect if entries move into or out of the
+# "backward" file.
+#
+# So this rule makes the additional check that there must be no file in
+# STAGEDIR not accounted for by .plist-files-no-comments.
 
-test-pkgplist:
-	for f in $$(find work/stage/usr/share/zoneinfo/ | sed -e 's,work/stage/usr/share/zoneinfo/,,' ); do if [ $$(grep -c $$f pkg-plist) -eq 0 ]; then echo $$f; fi ; done
+test-pkgplist: check-plist
+	@(cd ${STAGEDIR} && ${FIND} . -type f -print) | \
+		${SED} -e 's:^[.]::' | sort | \
+		${COMM} -23 -- - ${WRKDIR}/.plist-files-no-comments | \
+		while read -r f; do echo "MISSING FROM PLIST: $$f" >&2; echo fail; done | \
+		! ${GREP} fail >/dev/null
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Added: head/misc/zoneinfo/files/patch-etcetera
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/zoneinfo/files/patch-etcetera	Mon Aug 19 03:09:03 2019	(r509250)
@@ -0,0 +1,14 @@
+--- etcetera.orig	2019-07-23 03:26:15 UTC
++++ etcetera
+@@ -22,8 +22,10 @@ Zone	Etc/UTC		0	-	UTC
+ 
+ # The following link uses older naming conventions,
+ # but it belongs here, not in the file 'backward',
+-# as functions like gmtime load the "GMT" file to handle leap seconds properly.
++# as functions like gmtime load the "UTC" file to handle leap seconds properly.
+ # We want this to work even on installations that omit the other older names.
++Link	Etc/UTC				UTC
++# Do the same for GMT for compatibility reasons.
+ Link	Etc/GMT				GMT
+ 
+ Link	Etc/UTC				Etc/Universal

Added: head/misc/zoneinfo/files/patch-zone1970.tab
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/zoneinfo/files/patch-zone1970.tab	Mon Aug 19 03:09:03 2019	(r509250)
@@ -0,0 +1,12 @@
+--- zone1970.tab.orig	2019-06-22 19:39:01 UTC
++++ zone1970.tab
+@@ -9,7 +9,8 @@
+ # UTF-8 encoding.  The columns of the table are as follows:
+ #
+ # 1.  The countries that overlap the timezone, as a comma-separated list
+-#     of ISO 3166 2-character country codes.  See the file 'iso3166.tab'.
++#     of ISO 3166 2-character country codes.
++#     See the file '/usr/share/misc/iso3166'.
+ # 2.  Latitude and longitude of the timezone's principal location
+ #     in ISO 6709 sign-degrees-minutes-seconds format,
+ #     either ±DDMM±DDDMM or ±DDMMSS±DDDMMSS,

Modified: head/misc/zoneinfo/pkg-plist
==============================================================================
--- head/misc/zoneinfo/pkg-plist	Mon Aug 19 02:51:09 2019	(r509249)
+++ head/misc/zoneinfo/pkg-plist	Mon Aug 19 03:09:03 2019	(r509250)
@@ -351,7 +351,6 @@
 %%DATADIR%%/Etc/GMT-9
 %%DATADIR%%/Etc/GMT0
 %%DATADIR%%/Etc/Greenwich
-%%DATADIR%%/Etc/UCT
 %%DATADIR%%/Etc/UTC
 %%DATADIR%%/Etc/Universal
 %%DATADIR%%/Etc/Zulu
@@ -472,9 +471,11 @@
 %%DATADIR%%/Pacific/Tongatapu
 %%DATADIR%%/Pacific/Wake
 %%DATADIR%%/Pacific/Wallis
+%%DATADIR%%/UTC
 %%DATADIR%%/WET
 %%DATADIR%%/posixrules
 %%DATADIR%%/zone.tab
+%%DATADIR%%/zone1970.tab
 %%BACKWARD%%%%DATADIR%%/Africa/Asmera
 %%BACKWARD%%%%DATADIR%%/Africa/Timbuktu
 %%BACKWARD%%%%DATADIR%%/America/Argentina/ComodRivadavia
@@ -542,6 +543,7 @@
 %%BACKWARD%%%%DATADIR%%/Cuba
 %%BACKWARD%%%%DATADIR%%/Egypt
 %%BACKWARD%%%%DATADIR%%/Eire
+%%BACKWARD%%%%DATADIR%%/Etc/UCT
 %%BACKWARD%%%%DATADIR%%/Europe/Belfast
 %%BACKWARD%%%%DATADIR%%/Europe/Tiraspol
 %%BACKWARD%%%%DATADIR%%/GB
@@ -589,7 +591,6 @@
 %%BACKWARD%%%%DATADIR%%/US/Mountain
 %%BACKWARD%%%%DATADIR%%/US/Pacific
 %%BACKWARD%%%%DATADIR%%/US/Samoa
-%%BACKWARD%%%%DATADIR%%/UTC
 %%BACKWARD%%%%DATADIR%%/Universal
 %%BACKWARD%%%%DATADIR%%/W-SU
 %%BACKWARD%%%%DATADIR%%/Zulu


More information about the svn-ports-all mailing list