Hello community,

here is the log from the commit of package timezone.4630 for 
openSUSE:13.1:Update checked in at 2016-04-24 10:10:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/timezone.4630 (Old)
 and      /work/SRC/openSUSE:13.1:Update/.timezone.4630.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "timezone.4630"

Changes:
--------
New Changes file:

--- /dev/null   2016-04-07 01:36:33.300037506 +0200
+++ /work/SRC/openSUSE:13.1:Update/.timezone.4630.new/timezone-java.changes     
2016-04-24 10:10:01.000000000 +0200
@@ -0,0 +1,5296 @@
+-------------------------------------------------------------------
+Mon Apr 18 18:05:46 UTC 2016 - [email protected]
+
+- timezone update 2016d
+  * Venezuela (America/Caracas) switches from -0430 to -04 on 
+    2016-05-01 at 02:30 [boo#975875]
+  * Asia/Magadan switches from +10 to +11 on 2016-04-24 at 02:00.
+  * New zone Asia/Tomsk, split off from Asia/Novosibirsk. It covers
+    Tomsk Oblast, Russia, which switches from +06 to +07 on
+    2016-05-29 at 02:00
+  * Changes for past time zones (corrections and new Europe/Kirov)
+  * Corrections to historical time in Kazakhstan from 1991
+    through 2005.
+
+-------------------------------------------------------------------
+Wed Mar 23 23:05:32 UTC 2016 - [email protected]
+
+- timezone update 2016c [boo#972433]
+  * Azerbaijan no longer observes DST (Asia/Baku)
+  * Chile reverts from permanent to seasonal DST.
+  * Correct past timestamps for Europe/Kaliningrad, Europe/Vilnius,
+    Europe/Volgograd 1989-1991
+
+-------------------------------------------------------------------
+Thu Mar 17 13:41:22 CET 2016 - [email protected]
+
+- update to 2016b (bsc#971377):
+  * New zones Europe/Astrakhan and Europe/Ulyanovsk for Astrakhan
+    and Ulyanovsk Oblasts, Russia, both of which will switch from
+    +03 to +04 on 2016-03-27 at 02:00 local time.
+  * New zone Asia/Barnaul for Altai Krai and Altai Republic, Russia,
+    which will switch from +06 to +07 on the same date and local time.
+  * Asia/Sakhalin moves from +10 to +11 on 2016-03-27 at 02:00.
+  * As a trial of a new system that needs less information to be made
+    up, the new zones use numeric time zone abbreviations like "+04"
+    instead of invented abbreviations like "ASTT".
+  * Haiti will not observe DST in 2016.
+  * Palestine's spring-forward transition on 2016-03-26 is at 01:00,
+    not 00:00.
+  * tzselect's diagnostics and checking, and checktab.awk's checking,
+    have been improved.
+  * tzselect now tests Julian-date TZ settings more accurately.
+    (Thanks to J William Piggott.)
+- tzcode-revert-01-8c9cb9580.patch, tzcode-revert-02-301f794f3.patch,
+  tzcode-revert-03-39fd078a6.patch: Revert some porting fixes specific
+  to MS-Windows that rewrites parts of zic touched by our patches.
+
+-------------------------------------------------------------------
+Sat Feb 20 14:04:41 UTC 2016 - [email protected]
+
+- re-release binaries to resolve incident number sequencing issue
+  affecing subsequent tree builds (boo#967403)
+
+-------------------------------------------------------------------
+Thu Jan 28 07:37:16 UTC 2016 - [email protected]
+
+- timezone update 2016a [boo#963921]
+  * America/Cayman will not observe DTS this year
+  * Asia/Chita switches from +0800 to +0900 on 2016-03-27 at 02:00.
+  * Asia/Tehran now has DST predictions for the year 2038 and later
+  * America/Metlakatla switched from PST all year to AKST/AKDT on
+    2015-11-01 at 02:00.
+  * America/Santa_Isabel has been removed, and replaced with a
+    backward compatibility link to America/Tijuana.
+  * Asia/Karachi's two transition times in 2002 were off by a minute.
+
+-------------------------------------------------------------------
+Fri Oct  2 06:34:00 UTC 2015 - [email protected]
+
+- timezone update 2015g
+   * Turkey's 2015 fall-back transition is scheduled for Nov. 8,
+     not Oct. 25 [boo#948227]
+   * Adjustments for upcoming changes in Norfolk, Fiji, Fort Nelson
+   * New zone America/Fort_Nelson.
+   * localtime no longer mishandles America/Anchorage after 2037.
+   * On hosts with signed 32-bit time_t, localtime no longer
+     mishandles Pacific/Fiji after 2038-01-16 14:00 UTC.
+
+-------------------------------------------------------------------
+Fri Aug 14 13:06:18 UTC 2015 - [email protected]
+
+- timezone update 2015f [boo#941249]
+  * North Korea switches to +0830 on 2015-08-15, abbreviation
+    remains "KST".
+  * Uruguay no longer observes DST.
+  * Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC.
+- unfuzz tzcode-symlink.patch and tzcode-link.diff
+
+-------------------------------------------------------------------
+Sun Jun 14 15:22:29 UTC 2015 - [email protected]
+
+- timezone update 2015e [boo#934654]
+  *  Morocco will suspend DST from 2015-06-14 03:00 through 
+     2015-07-19 02:00, not 06-13 and 07-18 as guessed.
+   * Assume Cayman Islands will observe DST starting next year,
+     using US rules.
+   * The file 'iso3166.tab' now uses UTF-8
+
+-------------------------------------------------------------------
+Tue May 19 11:02:27 UTC 2015 - [email protected]
+
+- tzcode-zic-empty-comp.diff: Replaced by more sophisticated fix
+  from upstream
+
+-------------------------------------------------------------------
+Mon May 18 13:57:44 UTC 2015 - [email protected]
+
+- tzcode-zic-empty-comp.diff: Fix check for empty components in
+  absolute path
+
+-------------------------------------------------------------------
+Thu May 14 12:16:44 UTC 2015 - [email protected]
+
+- Fix post-install script to overwrite the temporary file when
+  attempting to create /etc/localtime as a hard link [bsc#928841]
+
+-------------------------------------------------------------------
+Thu May 14 12:08:51 UTC 2015 - [email protected]
+
+- timezone update 2015d [bsc#928584, bsc#928246]
+  * Egypt announced it is off DST indefinitely
+  * zic has some minor performance improvements
+- tzcode-fromname.patch, tzcode-link.diff, tzcode-symlink.patch,
+  tzcode-zic.diff, tzdata-china.diff: Rebase
+
+-------------------------------------------------------------------
+Tue Apr 14 06:59:29 UTC 2015 - [email protected]
+
+- timezone update 2015c [boo#927029]
+  * correct Egypt 2015 DST transition from April 24 to April 30
+  * Changes affecting past time stamps and historic DST changes
+  * time zones turned into links where this affects UTC offsets
+    in pre-1970 time stamps only: America/Montreal
+
+-------------------------------------------------------------------
+Sat Mar 21 08:42:15 UTC 2015 - [email protected]
+
+- timezone update 2015b [boo#923493]
+- Changes to time zones:
+  * Mongolia DST observance 2015
+  * Palestine DST dates 2015 and 2015
+  * correct 1982 zone shift in Pacific/Easter, regression in 2015a
+  * More pre-1970 zones have been turned into links, when they
+    differed from existing zones only for older time stamps:
+    America/Antigua, America/Cayman, Pacific/Midway,
+    Pacific/Saipan.
+  * Correct the 1992-2010 DST abbreviation in Volgograd from "MSK"
+    to "MSD".
+- Changes to code:
+  * Fix integer overflow bug in reference 'mktime' implementation.
+  * Allow -Dtime_tz=time_t compilations, and allow -Dtime_tz=...
+    libraries to be used in the same executable as standard-library
+    time_t functions.
+
+-------------------------------------------------------------------
+Fri Jan 30 21:55:43 UTC 2015 - [email protected]
+
+- timezone update 2015a
+  * New positive leap second 2015-06-30 23:59:60 UTC as per IERS
+    Bulletin C 49 [boo#914676]
+  * Mexico state Quintana Roo (America/Cancun) shift from Central
+    Time with DST to Eastern Time without DST on 2015-02-01 02:00.
+  * Chile (America/Santiago) will retain old DST as standard time
+    from April, also Pacific/Easter, and Antarctica/Palmer
+  * Changes affecting past timestamps (Iceland 1837 through 1939)
+  * Some more zones have been turned into links (pre-1970)
+
+------------------------------------------------------------------
+Tue Nov 11 18:36:37 UTC 2014 - [email protected]
+
+- timezone update 2014j [boo#904824]
+  + Turks & Caicos' switch from US eastern time to UTC-4 year-round
+    moved from 2014-11-02 at 02:00 to 2015-11-01 at 02:00.
+  + Corrects pre-1989 time stamps for Asia/Seoul and Asia/Pyongyang
+  + Time zones turned into links when they differed from existing
+    zones only for pre-1970 time stamps:
+    Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam,
+    Africa/Djibouti, Africa/Kampala, Africa/Mogadishu, 
+    Indian/Antananarivo, Indian/Comoro, and Indian/Mayotte.
+
+-------------------------------------------------------------------
+Wed Oct 22 19:41:06 UTC 2014 - [email protected]
+
+- update to 2014i [bsc#902276]:
+  * Pacific/Fiji will observe DST from 2014-11-02 02:00 to
+    2015-01-18 03:00.
+  * A new Zone Pacific/Bougainville, for the part of Papua New
+    Guinea that plans to switch from UTC+10 to UTC+11 on
+    2014-12-28 at 02:00.
+  * Some changes in time zone abbreviations and affecting past
+    time stamps.
+  * Some fixes for minor bugs.
+
+-------------------------------------------------------------------
+Fri Sep 26 20:12:48 UTC 2014 - [email protected]
+
+- update to 2014h [bnc#898747]:
++++ 5099 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.timezone.4630.new/timezone-java.changes
New Changes file:

--- /dev/null   2016-04-07 01:36:33.300037506 +0200
+++ /work/SRC/openSUSE:13.1:Update/.timezone.4630.new/timezone.changes  
2016-04-24 10:10:01.000000000 +0200
@@ -0,0 +1,5303 @@
+-------------------------------------------------------------------
+Mon Apr 18 18:05:46 UTC 2016 - [email protected]
+
+- timezone update 2016d
+  * Venezuela (America/Caracas) switches from -0430 to -04 on 
+    2016-05-01 at 02:30 [boo#975875]
+  * Asia/Magadan switches from +10 to +11 on 2016-04-24 at 02:00.
+  * New zone Asia/Tomsk, split off from Asia/Novosibirsk. It covers
+    Tomsk Oblast, Russia, which switches from +06 to +07 on
+    2016-05-29 at 02:00
+  * Changes for past time zones (corrections and new Europe/Kirov)
+  * Corrections to historical time in Kazakhstan from 1991
+    through 2005.
+
+-------------------------------------------------------------------
+Wed Mar 23 23:05:32 UTC 2016 - [email protected]
+
+- timezone update 2016c [boo#972433]
+  * Azerbaijan no longer observes DST (Asia/Baku)
+  * Chile reverts from permanent to seasonal DST.
+  * Correct past timestamps for Europe/Kaliningrad, Europe/Vilnius,
+    Europe/Volgograd 1989-1991
+
+-------------------------------------------------------------------
+Thu Mar 17 13:41:22 CET 2016 - [email protected]
+
+- update to 2016b (bsc#971377):
+  * New zones Europe/Astrakhan and Europe/Ulyanovsk for Astrakhan
+    and Ulyanovsk Oblasts, Russia, both of which will switch from
+    +03 to +04 on 2016-03-27 at 02:00 local time.
+  * New zone Asia/Barnaul for Altai Krai and Altai Republic, Russia,
+    which will switch from +06 to +07 on the same date and local time.
+  * Asia/Sakhalin moves from +10 to +11 on 2016-03-27 at 02:00.
+  * As a trial of a new system that needs less information to be made
+    up, the new zones use numeric time zone abbreviations like "+04"
+    instead of invented abbreviations like "ASTT".
+  * Haiti will not observe DST in 2016.
+  * Palestine's spring-forward transition on 2016-03-26 is at 01:00,
+    not 00:00.
+  * tzselect's diagnostics and checking, and checktab.awk's checking,
+    have been improved.
+  * tzselect now tests Julian-date TZ settings more accurately.
+    (Thanks to J William Piggott.)
+- tzcode-revert-01-8c9cb9580.patch, tzcode-revert-02-301f794f3.patch,
+  tzcode-revert-03-39fd078a6.patch: Revert some porting fixes specific
+  to MS-Windows that rewrites parts of zic touched by our patches.
+
+-------------------------------------------------------------------
+Sat Feb 20 14:04:41 UTC 2016 - [email protected]
+
+- re-release binaries to resolve incident number sequencing issue
+  affecing subsequent tree builds (boo#967403)
+
+-------------------------------------------------------------------
+Thu Jan 28 07:37:16 UTC 2016 - [email protected]
+
+- timezone update 2016a [boo#963921]
+  * America/Cayman will not observe DTS this year
+  * Asia/Chita switches from +0800 to +0900 on 2016-03-27 at 02:00.
+  * Asia/Tehran now has DST predictions for the year 2038 and later
+  * America/Metlakatla switched from PST all year to AKST/AKDT on
+    2015-11-01 at 02:00.
+  * America/Santa_Isabel has been removed, and replaced with a
+    backward compatibility link to America/Tijuana.
+  * Asia/Karachi's two transition times in 2002 were off by a minute.
+
+-------------------------------------------------------------------
+Fri Oct  2 06:34:00 UTC 2015 - [email protected]
+
+- timezone update 2015g
+   * Turkey's 2015 fall-back transition is scheduled for Nov. 8,
+     not Oct. 25 [boo#948227]
+   * Adjustments for upcoming changes in Norfolk, Fiji, Fort Nelson
+   * New zone America/Fort_Nelson.
+   * localtime no longer mishandles America/Anchorage after 2037.
+   * On hosts with signed 32-bit time_t, localtime no longer
+     mishandles Pacific/Fiji after 2038-01-16 14:00 UTC.
+
+-------------------------------------------------------------------
+Fri Aug 14 13:06:18 UTC 2015 - [email protected]
+
+- timezone update 2015f [boo#941249]
+  * North Korea switches to +0830 on 2015-08-15, abbreviation
+    remains "KST".
+  * Uruguay no longer observes DST.
+  * Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC.
+- unfuzz tzcode-symlink.patch and tzcode-link.diff
+
+-------------------------------------------------------------------
+Sun Jun 14 15:32:39 UTC 2015 - [email protected]
+
+- timezone update 2015e [boo#934654]
+  *  Morocco will suspend DST from 2015-06-14 03:00 through 
+     2015-07-19 02:00, not 06-13 and 07-18 as guessed.
+   * Assume Cayman Islands will observe DST starting next year,
+     using US rules.
+   * The file 'iso3166.tab' now uses UTF-8
+   * When displaying data, tzselect converts it to the current
+     locale's encoding if the iconv command works.
+   * tzselect no longer mishandles Dominica, fixing a bug introduced
+     in Release 2014f.
+   * zic -l no longer fails when compiled with
+     -DTZDEFAULT=\"/etc/localtime\", regression from 2014f.
+     Dropping upstreamed tzcode-zic-empty-comp.diff
+
+-------------------------------------------------------------------
+Tue May 19 11:02:27 UTC 2015 - [email protected]
+
+- tzcode-zic-empty-comp.diff: Replaced by more sophisticated fix
+  from upstream
+
+-------------------------------------------------------------------
+Mon May 18 13:57:44 UTC 2015 - [email protected]
+
+- tzcode-zic-empty-comp.diff: Fix check for empty components in
+  absolute path
+
+-------------------------------------------------------------------
+Thu May 14 12:16:44 UTC 2015 - [email protected]
+
+- Fix post-install script to overwrite the temporary file when
+  attempting to create /etc/localtime as a hard link [bsc#928841]
+
+-------------------------------------------------------------------
+Thu May 14 12:08:51 UTC 2015 - [email protected]
+
+- timezone update 2015d [bsc#928584, bsc#928246]
+  * Egypt announced it is off DST indefinitely
+  * zic has some minor performance improvements
+- tzcode-fromname.patch, tzcode-link.diff, tzcode-symlink.patch,
+  tzcode-zic.diff, tzdata-china.diff: Rebase
+
+-------------------------------------------------------------------
+Tue Apr 14 06:59:29 UTC 2015 - [email protected]
+
+- timezone update 2015c [boo#927029]
+  * correct Egypt 2015 DST transition from April 24 to April 30
+  * Changes affecting past time stamps and historic DST changes
+  * time zones turned into links where this affects UTC offsets
+    in pre-1970 time stamps only: America/Montreal
+
+-------------------------------------------------------------------
+Sat Mar 21 08:42:15 UTC 2015 - [email protected]
+
+- timezone update 2015b [boo#923493]
+- Changes to time zones:
+  * Mongolia DST observance 2015
+  * Palestine DST dates 2015 and 2015
+  * correct 1982 zone shift in Pacific/Easter, regression in 2015a
+  * More pre-1970 zones have been turned into links, when they
+    differed from existing zones only for older time stamps:
+    America/Antigua, America/Cayman, Pacific/Midway,
+    Pacific/Saipan.
+  * Correct the 1992-2010 DST abbreviation in Volgograd from "MSK"
+    to "MSD".
+- Changes to code:
+  * Fix integer overflow bug in reference 'mktime' implementation.
+  * Allow -Dtime_tz=time_t compilations, and allow -Dtime_tz=...
+    libraries to be used in the same executable as standard-library
+    time_t functions.
+
+-------------------------------------------------------------------
+Fri Jan 30 21:55:43 UTC 2015 - [email protected]
+
+- timezone update 2015a
+  * New positive leap second 2015-06-30 23:59:60 UTC as per IERS
+    Bulletin C 49 [boo#914676]
+  * Mexico state Quintana Roo (America/Cancun) shift from Central
+    Time with DST to Eastern Time without DST on 2015-02-01 02:00.
+  * Chile (America/Santiago) will retain old DST as standard time
+    from April, also Pacific/Easter, and Antarctica/Palmer
+  * Changes affecting past timestamps (Iceland 1837 through 1939)
+  * Some more zones have been turned into links (pre-1970)
+
+------------------------------------------------------------------
+Tue Nov 11 18:36:37 UTC 2014 - [email protected]
+
+- timezone update 2014j [boo#904824]
+  + Turks & Caicos' switch from US eastern time to UTC-4 year-round
+    moved from 2014-11-02 at 02:00 to 2015-11-01 at 02:00.
+  + Corrects pre-1989 time stamps for Asia/Seoul and Asia/Pyongyang
+  + Time zones turned into links when they differed from existing
+    zones only for pre-1970 time stamps:
+    Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam,
+    Africa/Djibouti, Africa/Kampala, Africa/Mogadishu, 
+    Indian/Antananarivo, Indian/Comoro, and Indian/Mayotte.
+
+-------------------------------------------------------------------
+Wed Oct 22 19:41:06 UTC 2014 - [email protected]
+
+- update to 2014i [bsc#902276]:
+  * Pacific/Fiji will observe DST from 2014-11-02 02:00 to
+    2015-01-18 03:00.
+  * A new Zone Pacific/Bougainville, for the part of Papua New
+    Guinea that plans to switch from UTC+10 to UTC+11 on
+    2014-12-28 at 02:00.
+  * Some changes in time zone abbreviations and affecting past
++++ 5106 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.timezone.4630.new/timezone.changes

New:
----
  iso3166-uk.diff
  pre_checkin.sh
  timezone-java.changes
  timezone-java.spec
  timezone-java.spec.in
  timezone.changes
  timezone.keyring
  timezone.spec
  tzcode-fromname.patch
  tzcode-link.diff
  tzcode-revert-01-8c9cb9580.patch
  tzcode-revert-02-301f794f3.patch
  tzcode-revert-03-39fd078a6.patch
  tzcode-symlink.patch
  tzcode-zic.diff
  tzcode2016d.tar.gz
  tzcode2016d.tar.gz.asc
  tzdata-china.diff
  tzdata2016d.tar.gz
  tzdata2016d.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ timezone-java.spec ++++++
#
# spec file for package timezone-java
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           timezone-java
BuildRequires:  fastjar
BuildRequires:  gcc-gij
BuildRequires:  javazic
Summary:        Time Zone Descriptions
License:        BSD-3-Clause and SUSE-Public-Domain
Group:          System/Base
# COMMON-BEGIN
# COMMON-BEGIN
Version:        2016d
Release:        0
Source:         ftp://ftp.iana.org/tz/releases/tzdata%{version}.tar.gz
Source1:        ftp://ftp.iana.org/tz/releases/tzcode%{version}.tar.gz
Source2:        ftp://ftp.iana.org/tz/releases/tzdata%{version}.tar.gz.asc
Source3:        ftp://ftp.iana.org/tz/releases/tzcode%{version}.tar.gz.asc
# http://sks.mrball.net/pks/lookup?op=get&search=0xED97E90E62AA7E34
Source4:        timezone.keyring
Patch0:         tzdata-china.diff
Patch1:         tzcode-zic.diff
# PATCH-FIX-OPENSUSE bnc#845530
Patch2:         tzcode-fromname.patch
Patch3:         iso3166-uk.diff
Patch4:         tzcode-link.diff
Patch5:         tzcode-symlink.patch
# Revert MS-Windows specific changes that rewrites parts of zic touched
# by our patches
Patch100:       tzcode-revert-01-8c9cb9580.patch
Patch101:       tzcode-revert-02-301f794f3.patch
Patch102:       tzcode-revert-03-39fd078a6.patch
# COMMON-END
# COMMON-END
Url:            http://www.gnu.org/software/libc/libc.html
PreReq:         filesystem, coreutils
BuildArch:      noarch
Provides:       tzdata-java = %{version}-%{release}
Provides:       tzdata-java8 = %{version}-%{release}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
These are configuration files that describe available time zones - this
package is intended for Java Virtual Machine based on OpenJDK.



%prep
%setup -c  -a 1
# COMMON-PREP-BEGIN
# COMMON-PREP-BEGIN
%patch100 -p1 -R
%patch101 -p1 -R
%patch102 -p1 -R
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%if 0%{?suse_version} < 1220
%patch4 -p1
%else
%patch5 -p1
%endif
sed -ri 's@/usr/local/etc/zoneinfo@%{_datadir}/zoneinfo@g' *.[1358]
# COMMON-PREP-END
# COMMON-PREP-END

echo "tzdata%{version}" >> VERSION

%build
gij -jar %{_javadir}/javazic.jar -V %{version} \
    -d javazi \
    africa antarctica asia australasia europe northamerica pacificnew \
    southamerica backward etcetera systemv  \
    %{_datadir}/javazic/tzdata_jdk/gmt \
    %{_datadir}/javazic/tzdata_jdk/jdk11_backward

%install
install -d -m 0755 $RPM_BUILD_ROOT/%{_datadir}
cp -a javazi $RPM_BUILD_ROOT%{_datadir}

%files
%defattr(-,root,root)
%{_datadir}/javazi

%changelog
++++++ timezone.spec ++++++
#
# spec file for package timezone
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           timezone
Summary:        Time Zone Descriptions
License:        BSD-3-Clause and SUSE-Public-Domain
Group:          System/Base
Url:            http://www.iana.org/time-zones
PreReq:         filesystem, coreutils
# COMMON-BEGIN
Version:        2016d
Release:        0
Source:         ftp://ftp.iana.org/tz/releases/tzdata%{version}.tar.gz
Source1:        ftp://ftp.iana.org/tz/releases/tzcode%{version}.tar.gz
Source2:        ftp://ftp.iana.org/tz/releases/tzdata%{version}.tar.gz.asc
Source3:        ftp://ftp.iana.org/tz/releases/tzcode%{version}.tar.gz.asc
# http://sks.mrball.net/pks/lookup?op=get&search=0xED97E90E62AA7E34
Source4:        timezone.keyring
Patch0:         tzdata-china.diff
Patch1:         tzcode-zic.diff
# PATCH-FIX-OPENSUSE bnc#845530
Patch2:         tzcode-fromname.patch
Patch3:         iso3166-uk.diff
Patch4:         tzcode-link.diff
Patch5:         tzcode-symlink.patch
# Revert MS-Windows specific changes that rewrites parts of zic touched
# by our patches
Patch100:       tzcode-revert-01-8c9cb9580.patch
Patch101:       tzcode-revert-02-301f794f3.patch
Patch102:       tzcode-revert-03-39fd078a6.patch
# COMMON-END
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%global AREA    Etc
%global ZONE    UTC

%description
These are configuration files that describe available time zones. You
can select an appropriate time zone for your system with YaST.



%prep
%setup -q -c -a 1
# COMMON-PREP-BEGIN
%patch100 -p1 -R
%patch101 -p1 -R
%patch102 -p1 -R
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%if 0%{?suse_version} < 1220
%patch4 -p1
%else
%patch5 -p1
%endif
sed -ri 's@/usr/local/etc/zoneinfo@%{_datadir}/zoneinfo@g' *.[1358]
# COMMON-PREP-END

%build
unset ${!LC_*}
LANG=POSIX
LC_ALL=POSIX
AREA=%{AREA}
ZONE=%{ZONE}
export AREA LANG LC_ALL ZONE
make %{?_smp_mflags} TZDIR=%{_datadir}/zoneinfo CFLAGS="$RPM_OPT_FLAGS 
-DHAVE_GETTEXT=1 -DTZDEFAULT='\"/etc/localtime\"' -DTM_GMTOFF=tm_gmtoff 
-DTM_ZONE=tm_zone" AWK=awk
make %{?_smp_mflags} TZDIR=zoneinfo AWK=awk zones
# Generate posixrules
./zic -y ./yearistype -d zoneinfo -p %{AREA}/%{ZONE}

%install
mkdir -p %{buildroot}%{_prefix}/share/zoneinfo
cp -a zoneinfo %{buildroot}%{_prefix}/share/zoneinfo/posix
cp -al %{buildroot}%{_prefix}/share/zoneinfo/posix/. 
%{buildroot}%{_prefix}/share/zoneinfo
cp -a zoneinfo-leaps %{buildroot}%{_prefix}/share/zoneinfo/right
mkdir -p %{buildroot}/etc
rm -f  %{buildroot}/etc/localtime
rm -f  %{buildroot}%{_prefix}/share/zoneinfo/posixrules
%if 0%{?suse_version} >= 1230
ln -sf %{_prefix}/share/zoneinfo/%{AREA}/%{ZONE} %{buildroot}/etc/localtime
%else
cp -fp %{buildroot}%{_prefix}/share/zoneinfo/%{AREA}/%{ZONE} 
%{buildroot}/etc/localtime
%endif
ln -sf /etc/localtime      %{buildroot}%{_prefix}/share/zoneinfo/posixrules
install -m 644 iso3166.tab %{buildroot}%{_prefix}/share/zoneinfo/iso3166.tab
install -m 644 zone.tab    %{buildroot}%{_prefix}/share/zoneinfo/zone.tab
install -m 644 zone1970.tab %{buildroot}%{_prefix}/share/zoneinfo/zone1970.tab
install -D -m 755 tzselect %{buildroot}%{_bindir}/tzselect
install -D -m 755 zdump    %{buildroot}%{_sbindir}/zdump
install -D -m 755 zic      %{buildroot}%{_sbindir}/zic

%clean
rm -rf %{buildroot}

%post
if [ -f /etc/sysconfig/clock ];
then
    . /etc/sysconfig/clock
    if [ -n "$TIMEZONE" -a -f /etc/localtime -a -f 
/usr/share/zoneinfo/$TIMEZONE ]; then
%if 0%{?suse_version} >= 1230
        ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
%else
        new=$(mktemp /etc/localtime.XXXXXXXX) || exit 1
        cp -fl /usr/share/zoneinfo/$TIMEZONE $new 2>/dev/null || cp -fp 
/usr/share/zoneinfo/$TIMEZONE $new
        mv -f $new /etc/localtime
%endif
    else
        [ ! -f /etc/localtime ] || echo "WARNING: Not updating /etc/localtime 
with new zone file" >&2
    fi
fi
if [ ! -L /usr/share/zoneinfo/posixrules ]; then
   rm -f /usr/share/zoneinfo/posixrules
   ln -sf /etc/localtime /usr/share/zoneinfo/posixrules
fi
if [ -e /usr/share/zoneinfo/posixrules.rpmnew ]; then
   rm -f /usr/share/zoneinfo/posixrules.rpmnew
fi

%files
%defattr(-,root,root)
%verify(not link md5 size mtime) %config(missingok,noreplace) /etc/localtime
%verify(not link md5 size mtime) %{_prefix}/share/zoneinfo/posixrules
%{_prefix}/share/zoneinfo
%{_bindir}/tzselect
%{_sbindir}/zdump
%{_sbindir}/zic

%changelog
++++++ iso3166-uk.diff ++++++
Index: timezone-2016b/iso3166.tab
===================================================================
--- timezone-2016b.orig/iso3166.tab
+++ timezone-2016b/iso3166.tab
@@ -99,7 +99,7 @@ FM    Micronesia
 FO     Faroe Islands
 FR     France
 GA     Gabon
-GB     Britain (UK)
+GB     United Kingdom
 GD     Grenada
 GE     Georgia
 GF     French Guiana
++++++ pre_checkin.sh ++++++
#!/bin/bash
# This script is called automatically during autobuild checkin.

ln -f timezone.changes timezone-java.changes

for spec in timezone-java.spec; do
{ sed -n -e '1,/COMMON-BEGIN/p' $spec.in
  sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' timezone.spec
  sed -n -e '/COMMON-END/,/COMMON-PREP-BEGIN/p' $spec.in
  sed -n -e '/COMMON-PREP-BEGIN/,/COMMON-PREP-END/p' timezone.spec
  sed -n -e '/COMMON-PREP-END/,$p' $spec.in; } > $spec.tmp && mv $spec.tmp $spec
done
++++++ timezone-java.spec.in ++++++
#
# spec file for package timezone-java
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           timezone-java
BuildRequires:  fastjar
BuildRequires:  gcc-gij
BuildRequires:  javazic
Summary:        Time Zone Descriptions
License:        BSD-3-Clause and SUSE-Public-Domain
Group:          System/Base
# COMMON-BEGIN
# COMMON-END
Url:            http://www.gnu.org/software/libc/libc.html
PreReq:         filesystem, coreutils
BuildArch:      noarch
Provides:       tzdata-java = %{version}-%{release}
Provides:       tzdata-java8 = %{version}-%{release}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
These are configuration files that describe available time zones - this
package is intended for Java Virtual Machine based on OpenJDK.



%prep
%setup -c  -a 1
# COMMON-PREP-BEGIN
# COMMON-PREP-END

echo "tzdata%{version}" >> VERSION

%build
gij -jar %{_javadir}/javazic.jar -V %{version} \
    -d javazi \
    africa antarctica asia australasia europe northamerica pacificnew \
    southamerica backward etcetera systemv  \
    %{_datadir}/javazic/tzdata_jdk/gmt \
    %{_datadir}/javazic/tzdata_jdk/jdk11_backward

%install
install -d -m 0755 $RPM_BUILD_ROOT/%{_datadir}
cp -a javazi $RPM_BUILD_ROOT%{_datadir}

%files
%defattr(-,root,root)
%{_datadir}/javazi

%changelog
++++++ tzcode-fromname.patch ++++++
Index: timezone-2016b/zic.c
===================================================================
--- timezone-2016b.orig/zic.c
+++ timezone-2016b/zic.c
@@ -768,7 +768,7 @@ dolink(char const *fromfield, char const
 
                result = link(fromname, toname);
                if (result != 0) {
-                               const char *s = fromfield;
+                               const char *s = fromname;
                                const char *t;
                                char *p;
                                size_t dotdots = 0;
@@ -777,10 +777,10 @@ dolink(char const *fromfield, char const
                                do
                                         t = s;
                                while ((s = strchr(s, '/'))
-                                      && ! strncmp (fromfield, tofield,
-                                                    ++s - fromfield));
+                                      && ! strncmp (fromname, tofield,
+                                                    ++s - fromname));
 
-                               for (s = tofield + (t - fromfield); *s; s++)
+                               for (s = tofield + (t - fromname); *s; s++)
                                  dotdots += *s == '/';
                                symlinkcontents
                                  = emalloc(3 * dotdots + strlen(t) + 1);
++++++ tzcode-link.diff ++++++
This patch is used on openSUSE versions older than 12.2.
Back then, /etc/localtime was either a hard link to a zone
file in /usr/share/zoneinfo or a copy of it.

By default, zic tries the following approaches to create
/etc/localtime:

  1. Hard link
  2. Symbolic link
  3. File copy

This patch changes the order to:

  1. Hard link
  2. File copy
  3. Symbolic link

Index: timezone-2015f/zic.c
===================================================================
--- timezone-2015f.orig/zic.c
+++ timezone-2015f/zic.c
@@ -738,6 +738,23 @@ relname(char const *dir, char const *bas
   }
 }
 
+static int
+copy(fromname, toname)
+const char * const     fromname;
+const char * const     toname;
+{
+       if (!fork()) {
+               execl("/bin/cp", "cp", fromname, toname, (char*) NULL);
+               _exit(1);
+       }
+       int s;
+       if (wait(&s) < 0)
+               return -1;
+       if (!WIFEXITED(s))
+               return -1;
+       return -WEXITSTATUS(s);
+}
+
 static void
 dolink(char const *fromfield, char const *tofield)
 {
@@ -767,6 +784,8 @@ dolink(char const *fromfield, char const
                        exit(EXIT_FAILURE);
 
                result = link(fromname, toname);
+               if (result != 0)
+                       result = copy(fromname, toname);
                if (result != 0) {
                                const char *s = fromname;
                                const char *t;
++++++ tzcode-revert-01-8c9cb9580.patch ++++++
commit 8c9cb958078b470e352a58f7f2d756544051e59b
Author: Paul Eggert <[email protected]>
Date:   Fri Feb 26 12:36:17 2016 -0800

    Fix asctime_r warning with MS-Windows
    
    Problem reported by Ian Abbott in:
    http://mm.icann.org/pipermail/tz/2016-February/023291.html
    * Makefile (CFLAGS): Add comment about new -D option.
    * private.h (HAVE_DECL_ASCTIME_R): New macro.
    (asctime_r): Depend on this, not on HAVE_POSIX_DECLS.

diff --git a/Makefile b/Makefile
index 20c2c98..5e2fb52 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,7 @@ LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed.
 #  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
+#  -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
 #  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
 #  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
 #  -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
diff --git a/private.h b/private.h
index e23764d..941e91b 100644
--- a/private.h
+++ b/private.h
@@ -22,6 +22,10 @@
 ** You can override these in your C compiler options, e.g. '-DHAVE_GETTEXT=1'.
 */
 
+#ifndef HAVE_DECL_ASCTIME_R
+#define HAVE_DECL_ASCTIME_R 1
+#endif
+
 #ifndef HAVE_GETTEXT
 #define HAVE_GETTEXT           0
 #endif /* !defined HAVE_GETTEXT */
@@ -386,17 +390,11 @@ time_t time(time_t *);
 void tzset(void);
 #endif
 
-/*
-** Some time.h implementations don't declare asctime_r.
-** Others might define it as a macro.
-** Fix the former without affecting the latter.
-** Similarly for timezone, daylight, and altzone.
-*/
+#if !HAVE_DECL_ASCTIME_R && !defined asctime_r
+extern char *asctime_r(struct tm const *restrict, char *restrict);
+#endif
 
 #if !HAVE_POSIX_DECLS
-# ifndef asctime_r
-extern char *  asctime_r(struct tm const *restrict, char *restrict);
-# endif
 # ifdef USG_COMPAT
 #  ifndef timezone
 extern long timezone;
++++++ tzcode-revert-02-301f794f3.patch ++++++
commit 301f794f33d145b08fbf7f5247c8663d404fabb5
Author: Paul Eggert <[email protected]>
Date:   Fri Feb 26 08:58:45 2016 -0800

    Fix tzname redefinition in MS-Windows
    
    Problem reported by Ian Abbott in:
    http://mm.icann.org/pipermail/tz/2016-February/023289.html
    * localtime.c (tzname): Don’t define if HAVE_POSIX_DECLS,
    as causes the Microsoft compiler to complain that tzname
    is redeclared without dllimport.
    * localtime.c, private.h (altzone): Do define even if
    HAVE_POSIX_DECLS, since this is not a POSIX-specified variable.

diff --git a/localtime.c b/localtime.c
index e3bc763..276ce34 100644
--- a/localtime.c
+++ b/localtime.c
@@ -178,11 +178,6 @@ static struct state        gmtmem;
 static char            lcl_TZname[TZ_STRLEN_MAX + 1];
 static int             lcl_is_set;
 
-char *                 tzname[2] = {
-       (char *) wildabbr,
-       (char *) wildabbr
-};
-
 /*
 ** Section 4.12.3 of X3.159-1989 requires that
 **     Except for the strftime function, these functions [asctime,
@@ -193,10 +188,16 @@ char *                    tzname[2] = {
 
 static struct tm       tm;
 
-#ifdef USG_COMPAT
+#if !HAVE_POSIX_DECLS
+char *                 tzname[2] = {
+       (char *) wildabbr,
+       (char *) wildabbr
+};
+# ifdef USG_COMPAT
 long                   timezone;
 int                    daylight;
-#endif /* defined USG_COMPAT */
+# endif
+#endif
 
 #ifdef ALTZONE
 long                   altzone;
diff --git a/private.h b/private.h
index 6080e71..e23764d 100644
--- a/private.h
+++ b/private.h
@@ -386,8 +386,6 @@ time_t time(time_t *);
 void tzset(void);
 #endif
 
-#if !HAVE_POSIX_DECLS
-
 /*
 ** Some time.h implementations don't declare asctime_r.
 ** Others might define it as a macro.
@@ -395,24 +393,24 @@ void tzset(void);
 ** Similarly for timezone, daylight, and altzone.
 */
 
-#ifndef asctime_r
+#if !HAVE_POSIX_DECLS
+# ifndef asctime_r
 extern char *  asctime_r(struct tm const *restrict, char *restrict);
-#endif
-
-#ifdef USG_COMPAT
-# ifndef timezone
-extern long timezone;
 # endif
-# ifndef daylight
+# ifdef USG_COMPAT
+#  ifndef timezone
+extern long timezone;
+#  endif
+#  ifndef daylight
 extern int daylight;
+#  endif
 # endif
 #endif
+
 #if defined ALTZONE && !defined altzone
 extern long altzone;
 #endif
 
-#endif
-
 /*
 ** The STD_INSPIRED functions are similar, but most also need
 ** declarations if time_tz is defined.
++++++ tzcode-revert-03-39fd078a6.patch ++++++
commit 39fd078a694fa762de5ae7efceca1dbfb7be94b3
Author: Paul Eggert <[email protected]>
Date:   Fri Feb 26 03:33:54 2016 -0800

    Port better to MS-Windows
    
    Problems reported by Ian Abbott in:
    http://mm.icann.org/pipermail/tz/2016-February/023286.html
    http://mm.icann.org/pipermail/tz/2016-February/023287.html
    * Makefile (CFLAGS): Add comment about new -D options.
    * date.c (environ, optarg, optind, tzname):
    * private.h (asctime_r, timezone, daylight, altzone):
    * strftime.c (tzname):
    * zdump.c (environ, getopt, optarg, optind, tzname):
    * zic.c (getopt, link, optarg, optind):
    Do not declare if HAVE_POSIX_DECLS, to avoid collisions with
    system declarations, which is a problem with MS-Windows
    and tzname and the dllimport attribute.
    * date.c, zdump.c (tzname): Do not specify size, as POSIX doesn’t.
    * private.h (HAVE_POSIX_DECLS): Default to 1.
    (ENOTSUP): Default to EINVAL.
    * zic.c: If HAVE_DIRECT_H, include direct.h and io.h and
    define a mkdir macro, for MS-Windows.
    (link, symlink): Set errno to ENOTSUP in the substitutes.
    (dolink): Don’t complain merely because link and/or
    symlink is not supported.  Be a bit more economical and robust
    about checking for directories and existing destinations.
    Report errno-related string on link failures.
    (itsdir): Work correctly even if a directory has a timestamp that
    is out of time_t range, so that stat fails with errno ==
    EOVERFLOW.
    (writezone): Don’t remove files we can’t stat.

diff --git a/Makefile b/Makefile
index 568f7f6..20c2c98 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,7 @@ LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed.
 #  -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
+#  -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
 #  -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
 #  -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
 #  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
@@ -116,6 +117,8 @@ LDLIBS=
 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
 #      This defaults to 1 if a working localtime_rz seems to be available.
 #      localtime_rz can make zdump significantly faster, but is nonstandard.
+#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
+#      functions like 'link' or variables like 'tzname' required by POSIX
 #  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
 #  -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l
 #      This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
diff --git a/date.c b/date.c
index 824e57d..4c11f61 100644
--- a/date.c
+++ b/date.c
@@ -42,10 +42,12 @@
 #define SECSPERMIN     60
 #endif /* !defined SECSPERMIN */
 
+#if !HAVE_POSIX_DECLS
 extern char **         environ;
 extern char *          optarg;
 extern int             optind;
-extern char *          tzname[2];
+extern char *          tzname[];
+#endif
 
 static int             retval = EXIT_SUCCESS;
 
diff --git a/private.h b/private.h
index 1c176e6..6080e71 100644
--- a/private.h
+++ b/private.h
@@ -34,6 +34,10 @@
 #define HAVE_LINK              1
 #endif /* !defined HAVE_LINK */
 
+#ifndef HAVE_POSIX_DECLS
+#define HAVE_POSIX_DECLS 1
+#endif
+
 #ifndef HAVE_STRDUP
 #define HAVE_STRDUP 1
 #endif
@@ -106,6 +110,9 @@
 #ifndef ENAMETOOLONG
 # define ENAMETOOLONG EINVAL
 #endif
+#ifndef ENOTSUP
+# define ENOTSUP EINVAL
+#endif
 #ifndef EOVERFLOW
 # define EOVERFLOW EINVAL
 #endif
@@ -379,6 +386,8 @@ time_t time(time_t *);
 void tzset(void);
 #endif
 
+#if !HAVE_POSIX_DECLS
+
 /*
 ** Some time.h implementations don't declare asctime_r.
 ** Others might define it as a macro.
@@ -402,6 +411,8 @@ extern int daylight;
 extern long altzone;
 #endif
 
+#endif
+
 /*
 ** The STD_INSPIRED functions are similar, but most also need
 ** declarations if time_tz is defined.
diff --git a/strftime.c b/strftime.c
index 7a139bd..f75f9fd 100644
--- a/strftime.c
+++ b/strftime.c
@@ -106,7 +106,9 @@ static char *       _fmt(const char *, const struct tm *, 
char *, const char *,
                        int *);
 static char *  _yconv(int, int, bool, bool, char *, char const *);
 
+#if !HAVE_POSIX_DECLS
 extern char *  tzname[];
+#endif
 
 #ifndef YEAR_2000_NAME
 #define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
diff --git a/zdump.c b/zdump.c
index 063a263..64d90f6 100644
--- a/zdump.c
+++ b/zdump.c
@@ -238,12 +238,14 @@ enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX 
/ 400 };
 # define timezone_t char **
 #endif
 
+#if !HAVE_POSIX_DECLS
 extern char ** environ;
 extern int     getopt(int argc, char * const argv[],
                        const char * options);
 extern char *  optarg;
 extern int     optind;
-extern char *  tzname[2];
+extern char *  tzname[];
+#endif
 
 /* The minimum and maximum finite time values.  */
 enum { atime_shift = CHAR_BIT * sizeof (time_t) - 2 };
diff --git a/zic.c b/zic.c
index 78ab870..0ec3359 100644
--- a/zic.c
+++ b/zic.c
@@ -22,6 +22,13 @@ typedef int_fast64_t zic_t;
 #define ZIC_MAX_ABBR_LEN_WO_WARN       6
 #endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
 
+#ifdef HAVE_DIRECT_H
+# include <direct.h>
+# include <io.h>
+# undef mkdir
+# define mkdir(name, mode) _mkdir(name)
+#endif
+
 #if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -87,17 +94,19 @@ struct zone {
        zic_t           z_untiltime;
 };
 
+#if !HAVE_POSIX_DECLS
 extern int     getopt(int argc, char * const argv[],
                        const char * options);
 extern int     link(const char * fromname, const char * toname);
 extern char *  optarg;
 extern int     optind;
+#endif
 
 #if ! HAVE_LINK
-# define link(from, to) (-1)
+# define link(from, to) (errno = ENOTSUP, -1)
 #endif
 #if ! HAVE_SYMLINK
-# define symlink(from, to) (-1)
+# define symlink(from, to) (errno = ENOTSUP, -1)
 #endif
 
 static void    addtt(zic_t starttime, int type);
@@ -758,41 +767,47 @@ dolink(char const *fromfield, char const *tofield)
                        progname, fromname, e);
                exit(EXIT_FAILURE);
        }
-       if (itsdir(toname) <= 0)
-               remove(toname);
        if (link(fromname, toname) != 0) {
-               int     result;
+         int link_errno = errno;
+         bool retry_if_link_supported = false;
 
-               if (! mkdirs(toname))
-                       exit(EXIT_FAILURE);
-
-               result = link(fromname, toname);
-               if (result != 0) {
-                               const char *s = fromfield;
-                               const char *t;
-                               char *p;
-                               size_t dotdots = 0;
-                               register char * symlinkcontents = NULL;
-
-                               do
-                                        t = s;
-                               while ((s = strchr(s, '/'))
-                                      && ! strncmp (fromfield, tofield,
-                                                    ++s - fromfield));
-
-                               for (s = tofield + (t - fromfield); *s; s++)
-                                 dotdots += *s == '/';
-                               symlinkcontents
-                                 = emalloc(3 * dotdots + strlen(t) + 1);
-                               for (p = symlinkcontents; dotdots-- != 0; p += 
3)
-                                 memcpy(p, "../", 3);
-                               strcpy(p, t);
-                               result = symlink(symlinkcontents, toname);
-                               if (result == 0)
-warning(_("hard link failed, symbolic link used"));
-                               free(symlinkcontents);
-               }
-               if (result != 0) {
+         if (link_errno == ENOENT || link_errno == ENOTSUP) {
+           if (! mkdirs(toname))
+             exit(EXIT_FAILURE);
+           retry_if_link_supported = true;
+         }
+         if ((link_errno == EEXIST || link_errno == ENOTSUP)
+             && itsdir(toname) == 0
+             && (remove(toname) == 0 || errno == ENOENT))
+           retry_if_link_supported = true;
+         if (retry_if_link_supported && link_errno != ENOTSUP)
+           link_errno = link(fromname, toname) == 0 ? 0 : errno;
+         if (link_errno != 0) {
+           const char *s = fromfield;
+           const char *t;
+           char *p;
+           size_t dotdots = 0;
+           char *symlinkcontents;
+           int symlink_result;
+
+           do
+             t = s;
+           while ((s = strchr(s, '/'))
+                  && strncmp(fromfield, tofield, ++s - fromfield) == 0);
+
+           for (s = tofield + (t - fromfield); *s; s++)
+             dotdots += *s == '/';
+           symlinkcontents = emalloc(3 * dotdots + strlen(t) + 1);
+           for (p = symlinkcontents; dotdots-- != 0; p += 3)
+             memcpy(p, "../", 3);
+           strcpy(p, t);
+           symlink_result = symlink(symlinkcontents, toname);
+           free(symlinkcontents);
+           if (symlink_result == 0) {
+             if (link_errno != ENOTSUP)
+               warning(_("symbolic link used because hard link failed: %s"),
+                       strerror (link_errno));
+           } else {
                        FILE *fp, *tp;
                        int c;
                        fp = fopen(fromname, "rb");
@@ -815,8 +830,11 @@ warning(_("hard link failed, symbolic link used"));
                                putc(c, tp);
                        close_file(fp, fromname);
                        close_file(tp, toname);
-                       warning(_("link failed, copy used"));
-               }
+                       if (link_errno != ENOTSUP)
+                         warning(_("copy used because hard link failed: %s"),
+                                 strerror (link_errno));
+           }
+         }
        }
        free(fromname);
        free(toname);
@@ -863,18 +881,17 @@ itsdir(char const *name)
 {
        struct stat st;
        int res = stat(name, &st);
-       if (res != 0)
-               return res;
 #ifdef S_ISDIR
-       return S_ISDIR(st.st_mode) != 0;
-#else
-       {
+       if (res == 0)
+               return S_ISDIR(st.st_mode) != 0;
+#endif
+       if (res == 0 || errno == EOVERFLOW) {
                char *nameslashdot = relname(name, ".");
-               res = stat(nameslashdot, &st);
+               bool dir = stat(nameslashdot, &st) == 0 || errno == EOVERFLOW;
                free(nameslashdot);
-               return res == 0;
+               return dir;
        }
-#endif
+       return -1;
 }
 
 /*
@@ -1685,7 +1702,7 @@ writezone(const char *const name, const char *const 
string, char version)
        /*
        ** Remove old file, if any, to snap links.
        */
-       if (itsdir(fullname) <= 0 && remove(fullname) != 0 && errno != ENOENT) {
+       if (itsdir(fullname) == 0 && remove(fullname) != 0 && errno != ENOENT) {
                const char *e = strerror(errno);
 
                fprintf(stderr, _("%s: Can't remove %s: %s\n"),
++++++ tzcode-symlink.patch ++++++
This patch is used on openSUSE 12.2 or newer. Nowadays,
/etc/localtime is by default a symbolic link to a zone
file in /usr/share/zoneinfo.

By default, zic tries the following approaches to create
/etc/localtime:

  1. Hard link
  2. Symbolic link
  3. File copy

This patch changes the logic slightly: keep using symbolic
links if /etc/localtime is already one. If it isn't, use
the default order as listed above.

Index: timezone-2015f/zic.c
===================================================================
--- timezone-2015f.orig/zic.c
+++ timezone-2015f/zic.c
@@ -105,7 +105,7 @@ static int  addtype(zic_t, char const *,
 static void    leapadd(zic_t, bool, int, int);
 static void    adjleap(void);
 static void    associate(void);
-static void    dolink(const char * fromfield, const char * tofield);
+static void    dolink(const char * fromfield, const char * tofield, int 
defaultsymlink);
 static char ** getfields(char * buf);
 static zic_t   gethms(const char * string, const char * errstring,
                       bool);
@@ -633,7 +633,7 @@ _("%s: More than one -L option specified
        */
        for (i = 0; i < nlinks; ++i) {
                eat(links[i].l_filename, links[i].l_linenum);
-               dolink(links[i].l_from, links[i].l_to);
+               dolink(links[i].l_from, links[i].l_to, false);
                if (noise)
                        for (j = 0; j < nlinks; ++j)
                                if (strcmp(links[i].l_to,
@@ -642,11 +642,11 @@ _("%s: More than one -L option specified
        }
        if (lcltime != NULL) {
                eat(_("command line"), 1);
-               dolink(lcltime, TZDEFAULT);
+               dolink(lcltime, TZDEFAULT, true);
        }
        if (psxrules != NULL) {
                eat(_("command line"), 1);
-               dolink(psxrules, TZDEFRULES);
+               dolink(psxrules, TZDEFRULES, false);
        }
        if (warnings && (ferror(stderr) || fclose(stderr) != 0))
          return EXIT_FAILURE;
@@ -739,14 +739,17 @@ relname(char const *dir, char const *bas
 }
 
 static void
-dolink(char const *fromfield, char const *tofield)
+dolink(char const *fromfield, char const *tofield, int defaultsymlink)
 {
+       struct stat st;
        register char * fromname;
        register char * toname;
        register int fromisdir;
 
        fromname = relname(directory, fromfield);
        toname = relname(directory, tofield);
+       if (lstat(fromname, &st) == 0 && S_ISLNK(st.st_mode))
+               defaultsymlink = true;
        /*
        ** We get to be careful here since
        ** there's a fair chance of root running us.
@@ -760,14 +763,14 @@ dolink(char const *fromfield, char const
        }
        if (itsdir(toname) <= 0)
                remove(toname);
-       if (link(fromname, toname) != 0) {
+       if (defaultsymlink || link(fromname, toname) != 0) {
                int     result;
 
                if (! mkdirs(toname))
                        exit(EXIT_FAILURE);
-
-               result = link(fromname, toname);
-               if (result != 0) {
+               if (!defaultsymlink)
+                       result = link(fromname, toname);
+               if ((defaultsymlink || (!defaultsymlink && result != 0))) {
                                const char *s = fromname;
                                const char *t;
                                char *p;
++++++ tzcode-zic.diff ++++++
Index: timezone-2016b/zic.c
===================================================================
--- timezone-2016b.orig/zic.c
+++ timezone-2016b/zic.c
@@ -788,8 +788,10 @@ dolink(char const *fromfield, char const
                                  memcpy(p, "../", 3);
                                strcpy(p, t);
                                result = symlink(symlinkcontents, toname);
+#if 0
                                if (result == 0)
 warning(_("hard link failed, symbolic link used"));
+#endif
                                free(symlinkcontents);
                }
                if (result != 0) {
++++++ tzdata-china.diff ++++++
Index: timezone-2016b/asia
===================================================================
--- timezone-2016b.orig/asia
+++ timezone-2016b/asia
@@ -518,6 +518,10 @@ Rule       PRC     1987    1991    -       Apr     Sun>=10 
0:00    1:
 Zone   Asia/Shanghai   8:05:43 -       LMT     1901
                        8:00    Shang   C%sT    1949
                        8:00    PRC     C%sT
+
+# Nowadays, China Standard Time is known as "Beijing Time"
+Zone   Asia/Beijing    8:00    PRC     C%sT
+
 # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi
 # / Wulumuqi.  (Please use Asia/Shanghai if you prefer Beijing time.)
 Zone   Asia/Urumqi     5:50:20 -       LMT     1928
Index: timezone-2016b/backward
===================================================================
--- timezone-2016b.orig/backward
+++ timezone-2016b/backward
@@ -94,7 +94,7 @@ Link  America/Mexico_City     Mexico/General
 Link   Pacific/Auckland        NZ
 Link   Pacific/Chatham         NZ-CHAT
 Link   America/Denver          Navajo
-Link   Asia/Shanghai           PRC
+Link   Asia/Beijing            PRC
 Link   Pacific/Pohnpei         Pacific/Ponape
 Link   Pacific/Pago_Pago       Pacific/Samoa
 Link   Pacific/Chuuk           Pacific/Truk
Index: timezone-2016b/zone.tab
===================================================================
--- timezone-2016b.orig/zone.tab
+++ timezone-2016b/zone.tab
@@ -144,6 +144,7 @@ CK  -2114-15946     Pacific/Rarotonga
 CL     -3327-07040     America/Santiago        Chile (most areas)
 CL     -2709-10926     Pacific/Easter  Easter Island
 CM     +0403+00942     Africa/Douala
+CN     +3955+11626     Asia/Beijing    China Standard Time
 CN     +3114+12128     Asia/Shanghai   Beijing Time
 CN     +4348+08735     Asia/Urumqi     Xinjiang Time
 CO     +0436-07405     America/Bogota

Reply via email to