timezone-data: update to latest version

BUG=None
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works

Change-Id: Id62c78b0c61e10c02688e797f53f58a85c852213
Reviewed-on: https://chromium-review.googlesource.com/171020
Reviewed-by: Matt Tennant <mtennant@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sys-libs/timezone-data/Manifest b/sys-libs/timezone-data/Manifest
index a4eef6a..b6a2a1c 100644
--- a/sys-libs/timezone-data/Manifest
+++ b/sys-libs/timezone-data/Manifest
@@ -1,2 +1,2 @@
-DIST tzcode2013d.tar.gz 138198 RMD160 74d2b1588dff5919bc2c0eff8648699cba3843d8 SHA1 e83b5304bf6ba93a590eca3c738b63fd0ed8e74d SHA256 2d9eb90c94644cddb74a490d1184ef9f88efcaa7a2b1bf88be0ee9eeeab707b6
-DIST tzdata2013d.tar.gz 218918 RMD160 6167a41e9cdd8de4c73a22e096742b4077ba8ffc SHA1 bdf46d0a6de276a21f1cbce6022888568c5ee520 SHA256 cd1c96f0676e0edceebc6a418a2222ffb05becb41180dd9f847b9c7cef303b04
+DIST tzcode2013g.tar.gz 171550 SHA256 c7c358b459bb65cfab7b7bdd6a9689233fc393f1f9fdf4f0f46ca7dac5a9587b SHA512 dd4475916fe36609155d72cfe434b387455ba860cee15fbbbb5caf37cc77757d467c4ae80e81396280e8d3fb68e131373151e8d0eee9bbf8674b96f99e0a9cbd WHIRLPOOL 558d14d820ff7c2ace2f9f0e126fea708abc97ca4fed73f5ad682dbf6756b72729a67b481d4dd85a528cc3bc8ab09f53002ed69227d20c2e9c249bc3ad7f6557
+DIST tzdata2013g.tar.gz 226943 SHA256 b6cdd3998dcc732a6ae5e101e1394f9d4d6dff68bd48a8fb78c44c2b997d3a4f SHA512 84107da6eb8bbc9063b06e422eb6ef4a5952039b90b4c86f6cc6ccecb370d1482dddf8be472d498b98cbb3ac6f7a0ed374f8b83613989a7d7a3a228b8910ac71 WHIRLPOOL fce805496f463cecac3c84c64dd5f1fe8c7eaea80bcfcb4796f1dac023e9c4de94203f64f1901ec6cb348d1986e1c4d965a6aac026ab6f9365d0ced691e8eefe
diff --git a/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch
deleted file mode 100644
index eb52f87..0000000
--- a/sys-libs/timezone-data/files/timezone-data-2013d-makefile.patch
+++ /dev/null
@@ -1,95 +0,0 @@
- - Fix up default paths
- - Support env DESTDIR / LDFLAGS / CFLAGS / CC
- - Use awk instead of nawk
- - Don't build/install libtz.a
- - Don't install man-pages provided by sys-apps/man-pages
- - Move zic zdump to sbin and tzselect to bin ala glibc
- - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
- - Install leaps zoneinfo into zoneinfo/right/ ala glibc
- - Disable broken web test
- - Make sure tzselect uses #!/bin/bash and not #!/bin/ksh
- - Flags to the linking are passed as LDFLAGS, not LFLAGS
- - LDFLAGS was missed for the 'date' target
-
---- a/Makefile
-+++ b/Makefile
-@@ -46,5 +46,5 @@
- # Everything gets put in subdirectories of. . .
- 
--TOPDIR=		/usr/local
-+TOPDIR=		$(DESTDIR)/usr
- 
- # "Compiled" time zone information is placed in the "TZDIR" directory
-@@ -52,5 +52,5 @@
- # Use an absolute path name for TZDIR unless you're just testing the software.
- 
--TZDIR=		$(TOPDIR)/etc/zoneinfo
-+TZDIR=		$(TOPDIR)/share/zoneinfo
- 
- # Types to try, as an alternative to time_t.  int64_t should be first.
-@@ -59,5 +59,5 @@
- # The "tzselect", "zic", and "zdump" commands get installed in. . .
- 
--ETCDIR=		$(TOPDIR)/etc
-+SBINDIR=		$(TOPDIR)/sbin
- 
- # If you "make INSTALL", the "date" command gets installed in. . .
-@@ -67,5 +67,5 @@
- # Manual pages go in subdirectories of. . .
- 
--MANDIR=		$(TOPDIR)/man
-+MANDIR=		$(TOPDIR)/share/man
- 
- # Library functions are put in an archive in LIBDIR.
-@@ -293,6 +293,8 @@
- ###############################################################################
- 
--cc=		cc
--CC=		$(cc) -DTZDIR=\"$(TZDIR)\"
-+CC+=		-DTZDIR=\"$(TZDIR)\"
-+ifeq ($(NLS),1)
-+CC += -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
-+endif
- 
- TZCSRCS=	zic.c localtime.c asctime.c scheck.c ialloc.c
-@@ -335,11 +337,13 @@
- ALL:		all date
- 
--install:	all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
-+install:	all $(DATA) $(REDO) $(MANS) $(TABDATA)
- 		$(ZIC) -y $(YEARISTYPE) \
- 			-d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
- 		-rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
- 		cp iso3166.tab zone.tab $(TZDIR)/.
--		-mkdir $(TOPDIR) $(ETCDIR)
--		cp tzselect zic zdump $(ETCDIR)/.
-+		-mkdir $(TOPDIR) $(SBINDIR)
-+		cp zic zdump $(SBINDIR)/.
-+		-mkdir $(TOPDIR) $(BINDIR)
-+		cp tzselect $(BINDIR)/.
- 		-mkdir $(TOPDIR) $(MANDIR) \
- 			$(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
-@@ -351,6 +355,4 @@
- 			$(MANDIR)/man8/zic.8
- 		cp newctime.3 newtzset.3 $(MANDIR)/man3/.
--		cp tzfile.5 $(MANDIR)/man5/.
--		cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
- 
- INSTALL:	ALL install date.1
-@@ -392,7 +394,7 @@
- # to using them, or vice versa.
- other_two:	zic leapseconds $(TDATA)
--		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
-+		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR)/posix -L /dev/null $(TDATA)
- 		$(ZIC) -y $(YEARISTYPE) \
--			-d $(TZDIR)-leaps -L leapseconds $(TDATA)
-+			-d $(TZDIR)/right -L leapseconds $(TDATA)
- 
- posix_right:	posix_only other_two
-@@ -422,5 +424,5 @@
- 		chmod +x $@
- 
--check:		check_character_set check_tables check_web
-+check:		check_character_set check_tables
- 
- check_character_set: $(ENCHILADA)
diff --git a/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch b/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch
new file mode 100644
index 0000000..f496098
--- /dev/null
+++ b/sys-libs/timezone-data/files/timezone-data-2013f-makefile.patch
@@ -0,0 +1,119 @@
+ - Fix up default paths
+ - Support env CC
+ - Don't build/install libtz.a
+ - Don't install man-pages provided by sys-apps/man-pages
+ - Move zic, zdump to sbin and tzselect to bin ala glibc
+ - Install posix zoneinfo into zoneinfo/posix/ instead of zoneinfo-posix/ ala glibc
+ - Install leaps zoneinfo into zoneinfo/right/ ala glibc
+
+--- a/Makefile
++++ b/Makefile
+@@ -45,21 +45,21 @@
+ 
+ # Everything gets put in subdirectories of. . .
+ 
+-TOPDIR=		/usr/local
++TOPDIR=		/usr
+ 
+ # "Compiled" time zone information is placed in the "TZDIR" directory
+ # (and subdirectories).
+ # Use an absolute path name for TZDIR unless you're just testing the software.
+ 
+ TZDIR_BASENAME=	zoneinfo
+-TZDIR=		$(TOPDIR)/etc/$(TZDIR_BASENAME)
++TZDIR=		$(TOPDIR)/share/$(TZDIR_BASENAME)
+ 
+ # Types to try, as an alternative to time_t.  int64_t should be first.
+ TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
+ 
+ # The "tzselect", "zic", and "zdump" commands get installed in. . .
+ 
+-ETCDIR=		$(TOPDIR)/etc
++SBINDIR=		$(TOPDIR)/sbin
+ 
+ # If you "make INSTALL", the "date" command gets installed in. . .
+ 
+@@ -67,7 +67,7 @@
+ 
+ # Manual pages go in subdirectories of. . .
+ 
+-MANDIR=		$(TOPDIR)/man
++MANDIR=		$(TOPDIR)/share/man
+ 
+ # Library functions are put in an archive in LIBDIR.
+ 
+@@ -294,8 +294,10 @@
+ 
+ ###############################################################################
+ 
+-cc=		cc
+-CC=		$(cc) -DTZDIR=\"$(TZDIR)\"
++CC+=		-DTZDIR=\"$(TZDIR)\"
++ifeq ($(NLS),1)
++CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
++endif
+ 
+ TZCSRCS=	zic.c localtime.c asctime.c scheck.c ialloc.c
+ TZCOBJS=	zic.o localtime.o asctime.o scheck.o ialloc.o
+@@ -338,14 +340,16 @@
+ 
+ ALL:		all date
+ 
+-install:	all $(DATA) $(REDO) $(DESTDIR)$(TZLIB) $(MANS)
++install:	all $(DATA) $(REDO) $(MANS)
+ 		$(ZIC) -y $(YEARISTYPE) \
+ 			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ 		-rm -f $(DESTDIR)$(TZDIR)/iso3166.tab \
+ 			$(DESTDIR)$(TZDIR)/zone.tab
+ 		cp iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+-		-mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(ETCDIR)
+-		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
++		-mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(SBINDIR)
++		cp zic zdump $(DESTDIR)$(SBINDIR)/.
++		-mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(BINDIR)
++		cp tzselect $(DESTDIR)$(BINDIR)/.
+ 		-mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(MANDIR) \
+ 			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ 			$(DESTDIR)$(MANDIR)/man8
+@@ -356,8 +360,6 @@
+ 			$(DESTDIR)$(MANDIR)/man8/zdump.8 \
+ 			$(DESTDIR)$(MANDIR)/man8/zic.8
+ 		cp newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+-		cp tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+-		cp tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
+ 
+ INSTALL:	ALL install date.1
+ 		-mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(BINDIR)
+@@ -405,17 +407,17 @@
+ right_posix:	right_only leapseconds
+ 		rm -fr $(DESTDIR)$(TZDIR)-leaps
+-		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
++		ln -s . $(DESTDIR)$(TZDIR)/right || \
+-		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ 			-L leapseconds $(TDATA)
+-		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ 			-L /dev/null $(TDATA)
+ 
+ posix_right:	posix_only leapseconds
+ 		rm -fr $(DESTDIR)$(TZDIR)-posix
+-		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
++		ln -s . $(DESTDIR)$(TZDIR)/posix || \
+-		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
++		  $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/posix \
+ 			-L /dev/null $(TDATA)
+-		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
++		$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)/right \
+ 			-L leapseconds $(TDATA)
+ 
+ zones:		$(REDO)
+@@ -442,7 +442,7 @@
+ 			<$? >$@
+ 		chmod +x $@
+ 
+-check:		check_character_set check_tables check_web
++check:		check_character_set check_tables
+ 
+ check_character_set: $(ENCHILADA)
+ 		sharp='#'; ! grep -n $(INVALID_CHAR) $(ENCHILADA)
diff --git a/sys-libs/timezone-data/metadata.xml b/sys-libs/timezone-data/metadata.xml
index fb4199e..0619186 100644
--- a/sys-libs/timezone-data/metadata.xml
+++ b/sys-libs/timezone-data/metadata.xml
@@ -1,5 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-<herd>toolchain</herd>
+  <herd>toolchain</herd>
+  <maintainer>
+    <email>djc@gentoo.org</email>
+    <name>Dirkjan Ochtman</name>
+  </maintainer>
 </pkgmetadata>
diff --git a/sys-libs/timezone-data/timezone-data-2013d.ebuild b/sys-libs/timezone-data/timezone-data-2013g.ebuild
similarity index 65%
rename from sys-libs/timezone-data/timezone-data-2013d.ebuild
rename to sys-libs/timezone-data/timezone-data-2013g.ebuild
index b0f864d..7d54d1a 100644
--- a/sys-libs/timezone-data/timezone-data-2013d.ebuild
+++ b/sys-libs/timezone-data/timezone-data-2013g.ebuild
@@ -1,6 +1,8 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/timezone-data/timezone-data-2013d.ebuild,v 1.1 2013/08/25 00:37:01 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/timezone-data/timezone-data-2013f-r1.ebuild,v 1.1 2013/09/28 10:55:44 vapier Exp $
+
+EAPI="3"
 
 inherit eutils toolchain-funcs flag-o-matic
 
@@ -15,32 +17,47 @@
 
 LICENSE="BSD public-domain"
 SLOT="0"
-KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
 IUSE="nls elibc_FreeBSD elibc_glibc"
 
 RDEPEND="!<sys-libs/glibc-2.3.5"
 
 S=${WORKDIR}
 
-src_unpack() {
-	unpack ${A}
-	epatch "${FILESDIR}"/${PN}-2013d-makefile.patch
+pkg_setup() {
+	# Deal with the case where older timezone-data installed a
+	# dir here, but newer one installs symlinks.  Portage will
+	# barf when you try to transition file types.
+	if cd "${EROOT}"/usr/share/zoneinfo 2>/dev/null ; then
+		if [[ -d posix ]] ; then
+			mv posix .gentoo-upgrade || die
+			ln -s .gentoo-upgrade posix || die
+		fi
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-2013f-makefile.patch
 	tc-is-cross-compiler && cp -pR "${S}" "${S}"-native
 }
 
 src_compile() {
 	local LDLIBS
 	tc-export CC
-	use elibc_FreeBSD && append-flags -DSTD_INSPIRED #138251
+	if use elibc_FreeBSD || use elibc_Darwin ; then
+		append-cppflags -DSTD_INSPIRED #138251
+	fi
 	export NLS=$(usex nls 1 0)
 	if use nls && ! use elibc_glibc ; then
 		LDLIBS+=" -lintl" #154181
 	fi
+	# TOPDIR is used in some utils when compiling.
 	emake \
+		TOPDIR="${EPREFIX}/usr" \
 		CFLAGS="${CPPFLAGS} ${CFLAGS} -std=gnu99" \
 		LDFLAGS="${LDFLAGS}" \
 		LDLIBS="${LDLIBS}" \
-		|| die "emake failed"
+		|| die
 	if tc-is-cross-compiler ; then
 		emake -C "${S}"-native \
 			CC=$(tc-getBUILD_CC) \
@@ -54,21 +71,20 @@
 src_install() {
 	local zic=""
 	tc-is-cross-compiler && zic="zic=${S}-native/zic"
-	emake install ${zic} DESTDIR="${D}" || die
-	rm -rf "${D}"/usr/share/zoneinfo-leaps
+	emake install ${zic} DESTDIR="${ED}" || die
 	dodoc README Theory
 	dohtml *.htm
 }
 
 pkg_config() {
 	# make sure the /etc/localtime file does not get stale #127899
-	local tz src etc_lt="${ROOT}etc/localtime"
+	local tz src etc_lt="${EROOT}etc/localtime"
 
 	if has_version '<sys-apps/baselayout-2' ; then
-		src="${ROOT}etc/conf.d/clock"
+		src="${EROOT}etc/conf.d/clock"
 		tz=$(unset TIMEZONE ; source "${src}" ; echo ${TIMEZONE-FOOKABLOIE})
 	else
-		src="${ROOT}etc/timezone"
+		src="${EROOT}etc/timezone"
 		if [[ -e ${src} ]] ; then
 			tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
 		else
@@ -84,7 +100,7 @@
 			# if /etc/localtime is a symlink somewhere, assume they
 			# know what they're doing and they're managing it themselves
 			if [[ ! -L ${etc_lt} ]] ; then
-				cp -f "${ROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
+				cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
 				elog "Setting ${etc_lt} to Factory."
 			else
 				elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
@@ -95,16 +111,18 @@
 		return 0
 	fi
 
-	if [[ ! -e ${ROOT}/usr/share/zoneinfo/${tz} ]] ; then
+	if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
 		elog "You have an invalid TIMEZONE setting in ${src}"
 		elog "Your ${etc_lt} has been reset to Factory; enjoy!"
 		tz="Factory"
 	fi
-	einfo "Updating ${etc_lt} with ${ROOT}usr/share/zoneinfo/${tz}"
+	einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
 	[[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
-	cp -f "${ROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
+	cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
 }
 
 pkg_postinst() {
+	rm -rf "${EROOT}"/usr/share/zoneinfo/.gentoo-upgrade &
 	pkg_config
+	wait
 }