From 151b4cc4cfcd9ab8e36ed784fd7df831d193e210 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Tue, 25 Sep 2007 11:36:06 +0000 Subject: [PATCH] - Add support for building java's zoneinfo files in new tzdata-java RPM. --- javazic-fixup.patch | 34 +++++++++++++++++++++++++++++ tzdata.spec | 53 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 javazic-fixup.patch diff --git a/javazic-fixup.patch b/javazic-fixup.patch new file mode 100644 index 0000000..8b19ef4 --- /dev/null +++ b/javazic-fixup.patch @@ -0,0 +1,34 @@ +--- sun/util/calendar/LocalGregorianCalendar.java.keiths 2007-09-07 14:48:19.000000000 -0700 ++++ sun/util/calendar/LocalGregorianCalendar.java 2007-09-07 14:52:58.000000000 -0700 +@@ -120,8 +120,7 @@ public class LocalGregorianCalendar exte + static LocalGregorianCalendar getLocalGregorianCalendar(String name) { + Properties calendarProps = null; + try { +- String homeDir = (String) AccessController.doPrivileged( +- new sun.security.action.GetPropertyAction("java.home")); ++ String homeDir = (String) System.getProperty("java.home"); + final String fname = homeDir + File.separator + "lib" + File.separator + + "calendars.properties"; + calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() { +--- sun/util/calendar/ZoneInfoFile.java.keiths 2007-09-07 14:54:58.000000000 -0700 ++++ sun/util/calendar/ZoneInfoFile.java 2007-09-07 14:55:36.000000000 -0700 +@@ -1021,8 +1021,7 @@ public class ZoneInfoFile { + byte[] buffer = null; + + try { +- String zi_dir = (String) AccessController.doPrivileged( +- new sun.security.action.GetPropertyAction("user.zoneinfo.dir")); ++ String zi_dir = (String) System.getProperty("user.zoneinfo.dir"); + File dir = null; + if (zi_dir != null) + dir = new File(zi_dir); +@@ -1035,8 +1034,7 @@ public class ZoneInfoFile { + } + + if (dir == null) { +- String homeDir = (String) AccessController.doPrivileged( +- new sun.security.action.GetPropertyAction("java.home")); ++ String homeDir = (String) System.getProperty("java.home"); + zi_dir = homeDir + File.separator + "lib" + File.separator + + "zi"; + } diff --git a/tzdata.spec b/tzdata.spec index 01ae03c..301009a 100644 --- a/tzdata.spec +++ b/tzdata.spec @@ -3,7 +3,7 @@ Name: tzdata Version: 2007g %define tzdata_version %{version} %define tzcode_version %{version} -Release: 1%{?dist} +Release: 2%{?dist} License: Public Domain, LGPLv2+ Group: System Environment/Base URL: ftp://elsie.nci.nih.gov/pub/ @@ -20,6 +20,18 @@ BuildArchitectures: noarch This package contains data files with rules for various timezones around the world. +%package java +Summary: Timzeone data for Java +Group: System Environment/Base +Source3: javazic.tar.gz +BuildArchitectures: noarch +BuildRequires: java-devel +Patch0: javazic-fixup.patch + +%description java +This package contains timezone information for use by Java runtimes. + + %prep %setup -q -n tzdata mkdir tzdata%{tzdata_version} @@ -30,15 +42,46 @@ sed -e 's|@objpfx@|'`pwd`'/obj/|' \ -e 's|@datadir@|%{_datadir}|' \ Makeconfig.in > Makeconfig +mkdir javazic +tar zxf %{SOURCE3} -C javazic +pushd javazic +%patch0 + +# Hack alert! sun.tools may be defined and installed in the +# VM. In order to guarantee that we are using IcedTea/OpenJDK +# for creating the zoneinfo files, rebase all the packages +# from "sun." to "rht.". Unfortunately, gcj does not support +# any of the -Xclasspath options, so we must go this route +# to ensure the greatest compatibility. +mv sun rht +for f in `find . -name '*.java'`; do + sed -i -e 's:sun\.tools\.:rht.tools.:g'\ + -e 's:sun\.util\.:rht.util.:g' $f +done +popd + %build make grep -v tz-art.htm tzcode%{tzcode_version}/tz-link.htm > tzcode%{tzcode_version}/tz-link.html +pushd javazic +javac -source 1.5 -target 1.5 -classpath . `find . -name \*.java` +popd +pushd tzdata%{tzcode_version} +java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \ + -d ../zoneinfo/java \ + africa antarctica asia australasia europe northamerica pacificnew \ + southamerica backward etcetera solar87 solar88 solar89 systemv \ + ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward +popd + %install rm -fr $RPM_BUILD_ROOT sed -i 's|@install_root@|%{buildroot}|' Makeconfig make install +cp -pr zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi + %check echo ====================TESTING========================= make check @@ -54,7 +97,15 @@ rm -rf %{buildroot} %doc tzcode%{tzcode_version}/Theory %doc tzcode%{tzcode_version}/tz-link.html +%files java +%defattr(-,root,root) +%{_datadir}/javazi + %changelog +* Thu Sep 25 2007 Keith Seitz - 2007g-2 +- Add support for building java's zoneinfo files in new + tzdata-java RPM. + * Wed Aug 22 2007 Petr Machata - 2007g-1 - Fix licensing tag. - Upstream 2007g