From: Jinkun Jang Date: Tue, 12 Mar 2013 06:18:23 +0000 (+0900) Subject: Tizen 2.1 base X-Git-Tag: 2.1b_release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2F2.1b_release;p=toolchains%2Ftzdata.git Tizen 2.1 base --- diff --git a/Makeconfig.in b/Makeconfig.in new file mode 100644 index 0000000..2c09a40 --- /dev/null +++ b/Makeconfig.in @@ -0,0 +1,13 @@ +objpfx := @objpfx@ +datadir := @datadir@ +install_root := @install_root@ +AWK := awk +built-program-cmd := /usr/sbin/zic +cross-compiling := no +have-ksh := yes ++force = +leapseconds = /dev/null +posixrules = America/New_York +posixrules-file = posixrules +zonedir := $(datadir)/zoneinfo +inst_zonedir := $(install_root)$(zonedir) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cd08b35 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +all: + mkdir obj + for i in tzdata*/*; do ln -sf ../$$i src/; done + cp -L src/yearistype.sh src/yearistype; chmod +x src/yearistype + +include ./Makeconfig + +install: + $(MAKE) -C src install + +check: $(objpfx)test-tz $(objpfx)tst-timezone +$(objpfx)test-tz: src/test-tz.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< + TZDIR=$(inst_zonedir) $@ || ( echo TEST FAILED; exit 1 ) +$(objpfx)tst-timezone: src/tst-timezone.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< + TZDIR=$(inst_zonedir) $@ || ( echo TEST FAILED; exit 1 ) + +clean: + rm -rf obj src/yearistype + for i in tzdata*/*; do rm -f src/`basename $$i`; done diff --git a/Rules b/Rules new file mode 100644 index 0000000..4c55781 --- /dev/null +++ b/Rules @@ -0,0 +1,18 @@ +$(objpfx)zic: /dev/null + touch $@ +$(objpfx)scheck.o: /dev/null + touch $@ +$(objpfx)ialloc.o: /dev/null + touch $@ +define make-target-directory +$(addprefix mkdir -p ,\ + $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%))) +endef +define do-install +$(make-target-directory) +/usr/bin/install -m 644 $< $@ +endef +install: $(inst_zonedir)/ + $(MAKE) install-data +$(inst_zonedir)/: ; $(make-target-directory) +install-data: $(install-others) diff --git a/packaging/tzcode2011g.tar.gz b/packaging/tzcode2011g.tar.gz new file mode 100644 index 0000000..89a9f6c Binary files /dev/null and b/packaging/tzcode2011g.tar.gz differ diff --git a/packaging/tzdata.changes b/packaging/tzdata.changes new file mode 100644 index 0000000..230c7ca --- /dev/null +++ b/packaging/tzdata.changes @@ -0,0 +1,12 @@ +* Fri May 27 2011 Anas Nashif - 2010b +- Dont depend on fdupes, avoid too many cycles + +* Tue May 24 2011 Anas Nashif - 2010b +- Repackage documentaion/translations + +* Sat Apr 10 2010 Anas Nashif - 2010b +- Fixed rpmlint errors + +* Mon Feb 08 2010 Austin Zhang - 2010b +- Upstream 2010b + diff --git a/packaging/tzdata.spec b/packaging/tzdata.spec new file mode 100644 index 0000000..7d3a2f5 --- /dev/null +++ b/packaging/tzdata.spec @@ -0,0 +1,55 @@ +Summary: Timezone data +Name: tzdata +Version: 2011h +%define tzdata_version %{version} +%define tzcode_version 2011g +Release: 1 +License: Public Domain +Group: System/Base +URL: ftp://elsie.nci.nih.gov/pub/ + +# The tzdata-base-0.tar.bz2 is a simple building infrastructure and +# test suite. It is occasionally updated from glibc sources, and as +# such is under LGPLv2+, but none of this ever gets to be part of +# final zoneinfo files. +Source0: %{name}-%{version}.tar.bz2 +# These are official upstream. +Source1: ftp://elsie.nci.nih.gov/pub/tzdata%{tzdata_version}.tar.gz +Source2: ftp://elsie.nci.nih.gov/pub/tzcode%{tzcode_version}.tar.gz +BuildArch: noarch + +%description +This package contains data files with rules for various timezones around +the world. + +%prep +%setup -q -n %{name}-%{version} +mkdir tzdata%{tzdata_version} +tar xzf %{SOURCE1} -C tzdata%{tzdata_version} +mkdir tzcode%{tzcode_version} +tar xzf %{SOURCE2} -C tzcode%{tzcode_version} +sed -e 's|@objpfx@|'`pwd`'/obj/|' \ + -e 's|@datadir@|%{_datadir}|' \ + Makeconfig.in > Makeconfig + + +%build +make + +%install +rm -fr $RPM_BUILD_ROOT +sed -i 's|@install_root@|%{buildroot}|' Makeconfig +make install + +%check +echo ====================TESTING========================= +make check +echo ====================TESTING END===================== + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{_datadir}/zoneinfo + diff --git a/packaging/tzdata2011h.tar.gz b/packaging/tzdata2011h.tar.gz new file mode 100644 index 0000000..344c41a Binary files /dev/null and b/packaging/tzdata2011h.tar.gz differ diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..cf2c7d7 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,226 @@ +# Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +# +# Makefile for timezone information +# +subdir := timezone + +distribute := tzfile.h private.h scheck.c ialloc.c yearistype \ + iso3166.tab zone.tab tzselect.ksh checktab.awk \ + README + +extra-objs := scheck.o ialloc.o + +others := zdump zic +tests := test-tz tst-timezone + +tzbases := africa antarctica asia australasia europe northamerica \ + southamerica etcetera factory \ + solar87 solar88 solar89 +tzlinks := backward systemv +tzfiles := $(tzbases) $(tzlinks) +# pacificnew doesn't compile; if it is to be used, it should be included in +# northamerica. +distribute += $(tzfiles) leapseconds pacificnew simplebackw + +generated := $(addprefix z.,$(tzfiles)) +install-sbin := zic zdump + +generated-dirs = testdata + +all: # Make this the default target; it will be defined in Rules. + +include ../Makeconfig # Get objpfx defined so we can use it below. + +CPPFLAGS-zic = -DNOT_IN_libc + +# z.* use this variable. +define nl + + +endef +ifndef avoid-generated +ifndef inhibit_timezone_rules +-include $(addprefix $(objpfx)z.,$(tzfiles)) +endif +endif + +# Make these absolute file names. +installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \ + $(addprefix $(inst_zonedir)/, \ + $(localtime-file))) +installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \ + $(addprefix $(inst_zonedir)/, \ + $(posixrules-file))) + +ifeq ($(cross-compiling),no) +# Don't try to install the zoneinfo files since we can't run zic. +install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \ + $(zonenames:%=posix/%) \ + $(zonenames:%=right/%)) \ + $(installed-localtime-file) $(installed-posixrules-file) +endif + +ifeq ($(have-ksh),yes) +install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab +install-bin-script = tzselect +generated += tzselect +endif + +include ../Rules + + +$(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile +# Kludge alert: we use an implicit rule (in what we are generating here) +# because that is the only way to tell Make that the one command builds all +# the files. +# The extra kludge for the $(tzlinks) files is necessary since running zic +# this file requires all other files to exist. Blech! + $(make-target-directory) + (echo 'define $*-zones' ;\ + $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\ + echo 'endef' ;\ + echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\ + echo 'ifdef $*-zones' ;\ + if test x$(findstring $*, $(tzlinks)) != x; then \ + echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\ + echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\ + echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\ + echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\ + echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\ + echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\ + fi ;\ + echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\ + echo '$< $$(objpfx)zic leapseconds yearistype' ;\ + echo ' $$(tzcompile)' ;\ + echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\ + echo '$< $$(objpfx)zic /dev/null yearistype' ;\ + echo ' $$(tzcompile)' ;\ + echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\ + echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\ + echo ' $$(tzcompile)' ;\ + echo 'endif' ;\ + echo 'zonenames := $$(zonenames) $$($*-zones)' ;\ + ) > $@.new + mv $@.new $@ + +.PHONY: echo-zonenames +echo-zonenames: + @echo 'Known zones: $(zonenames)' + + +# We have to use `-d $(inst_zonedir)' to explictly tell zic where to +# place the output files although $(zonedir) is compiled in. But the +# user might have set $(install_root) on the command line of `make install'. +zic-cmd = $(built-program-cmd) -d $(inst_zonedir) +tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \ + -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $< + +# The source files specify the zone names relative to the -d directory, +# so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix +# and the like. This magic extracts /posix or /right if it's the first +# component after $(inst_zonedir) in the target name $@. +target-zone-flavor = $(filter /posix /right, \ + /$(firstword $(subst /, , \ + $(patsubst $(inst_zonedir)/%,%,$@)))) + +ifdef localtime +$(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \ + $(+force) + $(make-target-directory) + if test -r $@; then \ + echo Site timezone NOT reset to Factory.; \ + else \ + rm -f $@T; \ + $(SHELL) $(..)scripts/rellns-sh $< $@T; \ + mv -f $@T $@; \ + fi +endif +ifdef posixrules +$(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \ + $(+force) + $(zic-cmd) -p $(posixrules) +endif + + +$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o + +tz-cflags = -DTZDIR='"$(zonedir)"' \ + -DTZDEFAULT='"$(localtime-file)"' \ + -DTZDEFRULES='"$(posixrules-file)"' \ + -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone + +CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags) -DHAVE_GETTEXT +CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) -DHAVE_GETTEXT +CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT +CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT + +# We have to make sure the data for testing the tz functions is available. +# Don't add leapseconds here since test-tz made checks that work only without +# leapseconds. +testdata = $(objpfx)testdata +define build-testdata +GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \ + $(built-program-cmd) -d $(testdata) -y ./yearistype $< +endef + +$(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC) +$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \ + Europe/Berlin Universal \ + Australia/Melbourne \ + America/Sao_Paulo Asia/Tokyo \ + Europe/London) + +test-tz-ENV = TZDIR=$(testdata) +tst-timezone-ENV = TZDIR=$(testdata) + +$(testdata)/America/New_York: northamerica $(objpfx)zic $(leapseconds) \ + yearistype + $(build-testdata) +$(testdata)/Etc/UTC: etcetera $(objpfx)zic $(leapseconds) yearistype + $(build-testdata) +$(testdata)/UTC: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \ + $(leapseconds) yearistype + $(build-testdata) +$(testdata)/Europe/Berlin: europe $(objpfx)zic $(leapseconds) yearistype + $(build-testdata) +$(testdata)/Universal: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \ + $(leapseconds) yearistype + $(build-testdata) +$(testdata)/Australia/Melbourne: australasia $(objpfx)zic $(leapseconds) \ + yearistype + $(build-testdata) +$(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \ + yearistype + $(build-testdata) +$(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype + $(build-testdata) +$(testdata)/Europe/London: europe $(objpfx)zic $(leapseconds) yearistype + $(build-testdata) + + +$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make + sed -e 's%@KSH@%$(KSH)%g' \ + -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new + chmod 555 $@.new + mv -f $@.new $@ + +$(addprefix $(inst_zonedir)/,iso3166.tab zone.tab): \ + $(inst_zonedir)/%: % $(+force) + $(do-install) diff --git a/src/simplebackw b/src/simplebackw new file mode 100644 index 0000000..860624a --- /dev/null +++ b/src/simplebackw @@ -0,0 +1,2 @@ +Link Etc/UTC UTC +Link Etc/Universal Universal diff --git a/src/test-tz.c b/src/test-tz.c new file mode 100644 index 0000000..642b45a --- /dev/null +++ b/src/test-tz.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +struct { + const char * env; + time_t expected; +} tests[] = { + {"MST", 832935315}, + {"", 832910115}, + {":UTC", 832910115}, + {"UTC", 832910115}, + {"UTC0", 832910115} +}; + + +int +main (int argc, char ** argv) +{ + int errors = 0; + struct tm tm; + time_t t; + unsigned int i; + + memset (&tm, 0, sizeof (tm)); + tm.tm_isdst = 0; + tm.tm_year = 96; /* years since 1900 */ + tm.tm_mon = 4; + tm.tm_mday = 24; + tm.tm_hour = 3; + tm.tm_min = 55; + tm.tm_sec = 15; + + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) + { + setenv ("TZ", tests[i].env, 1); + t = mktime (&tm); + if (t != tests[i].expected) + { + printf ("%s: flunked test %u (expected %lu, got %lu)\n", + argv[0], i, (long) tests[i].expected, (long) t); + ++errors; + } + } + if (errors == 0) + { + puts ("No errors."); + return EXIT_SUCCESS; + } + else + { + printf ("%d errors.\n", errors); + return EXIT_FAILURE; + } +} diff --git a/src/tst-timezone.c b/src/tst-timezone.c new file mode 100644 index 0000000..00f899b --- /dev/null +++ b/src/tst-timezone.c @@ -0,0 +1,169 @@ +/* Copyright (C) 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + +int failed = 0; + +struct test_times +{ + const char *name; + int daylight; + int timezone; + const char *tzname[2]; +}; + +static const struct test_times tests[] = +{ + { "Europe/Amsterdam", 1, -3600, { "CET", "CEST" }}, + { "Europe/Berlin", 1, -3600, { "CET", "CEST" }}, + { "Europe/London", 1, 0, { "GMT", "BST" }}, + { "Universal", 0, 0, {"UTC", "UTC" }}, + { "Australia/Melbourne", 1, -36000, { "EST", "EST" }}, + { "America/Sao_Paulo", 1, 10800, {"BRT", "BRST" }}, + { "America/Chicago", 1, 21600, {"CST", "CDT" }}, + { "America/Indiana/Indianapolis", 1, 18000, {"EST", "EDT" }}, + { "America/Los_Angeles", 1, 28800, {"PST", "PDT" }}, + { "Pacific/Auckland", 1, -43200, { "NZST", "NZDT" }}, + { NULL, 0, 0 } +}; + +/* This string will be used for `putenv' calls. */ +char envstring[100]; + +static void +print_tzvars (void) +{ + printf ("tzname[0]: %s\n", tzname[0]); + printf ("tzname[1]: %s\n", tzname[1]); + printf ("daylight: %d\n", daylight); + printf ("timezone: %ld\n", timezone); +} + + +static void +check_tzvars (const char *name, int dayl, int timez, const char *const tznam[]) +{ + int i; + + if (daylight != dayl) + { + printf ("*** Timezone: %s, daylight is: %d but should be: %d\n", + name, daylight, dayl); + ++failed; + } + if (timezone != timez) + { + printf ("*** Timezone: %s, timezone is: %ld but should be: %d\n", + name, timezone, timez); + ++failed; + } + for (i = 0; i <= 1; ++i) + if (strcmp (tzname[i], tznam[i]) != 0) + { + printf ("*** Timezone: %s, tzname[%d] is: %s but should be: %s\n", + name, i, tzname[i], tznam[i]); + ++failed; + } +} + + +int +main (int argc, char ** argv) +{ + time_t t; + const struct test_times *pt; + char buf[BUFSIZ]; + + /* This should be: Fri May 15 01:02:16 1998 (UTC). */ + t = 895194136; + printf ("We use this date: %s\n", asctime (gmtime (&t))); + + for (pt = tests; pt->name != NULL; ++pt) + { + /* Start with a known state */ + printf ("Checking timezone %s\n", pt->name); + sprintf (buf, "TZ=%s", pt->name); + if (putenv (buf)) + { + puts ("putenv failed."); + failed = 1; + } + tzset (); + print_tzvars (); + check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname); + + /* calling localtime shouldn't make a difference */ + localtime (&t); + print_tzvars (); + check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname); + } + + /* From a post of Scott Harrington to the timezone + mailing list. */ + { + struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1}; + char buf[200]; + strcpy (envstring, "TZ=Europe/London"); + putenv (envstring); + t = mktime (&tmBuf); + snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d", + getenv ("TZ"), t, + tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour, + tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year, + tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst); + fputs (buf, stdout); + puts (" should be"); + puts ("TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1"); + if (strcmp (buf, "TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1") != 0) + { + failed = 1; + fputs (" FAILED ***", stdout); + } + } + + printf("\n"); + + { + struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1}; + char buf[200]; + strcpy (envstring, "TZ=GMT"); + /* No putenv call needed! */ + t = mktime (&tmBuf); + snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d", + getenv ("TZ"), t, + tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour, + tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year, + tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst); + fputs (buf, stdout); + puts (" should be"); + puts ("TZ=GMT 892166400 0 0 0 10 3 98 5 99 0"); + if (strcmp (buf, "TZ=GMT 892166400 0 0 0 10 3 98 5 99 0") != 0) + { + failed = 1; + fputs (" FAILED ***", stdout); + } + } + + return failed ? EXIT_FAILURE : EXIT_SUCCESS; +}