11
0

Accepting request 530346 from Java:Factory

Recommend tzdata-java8

OBS-URL: https://build.opensuse.org/request/show/530346
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/java-1_8_0-openjdk?expand=0&rev=52
This commit is contained in:
2017-10-06 08:54:25 +00:00
committed by Git OBS Bridge
3 changed files with 101 additions and 20 deletions

View File

@@ -0,0 +1,66 @@
--- openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-07-27 02:47:51.000000000 +0200
+++ openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-09-30 21:28:03.040474683 +0200
@@ -31,6 +31,7 @@
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.InputStream;
import java.io.IOException;
import java.io.StreamCorruptedException;
import java.security.AccessController;
@@ -47,6 +48,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
+import java.util.Properties;
import java.util.Set;
import java.util.SimpleTimeZone;
import java.util.concurrent.ConcurrentHashMap;
@@ -251,7 +253,15 @@
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
- String libDir = System.getProperty("java.home") + File.separator + "lib";
+ final String homeDir = System.getProperty("java.home");
+ if (homeDir == null) {
+ throw new Error("java.home is not set");
+ }
+ String libDir = homeDir + File.separator + "lib";
+ String otherDir = getZoneInfoDir(libDir);
+ if (otherDir != null)
+ libDir = otherDir;
+
try (DataInputStream dis = new DataInputStream(
new BufferedInputStream(new FileInputStream(
new File(libDir, "tzdb.dat"))))) {
@@ -264,6 +274,30 @@
}
});
}
+
+ private static String getZoneInfoDir(final String libDir) {
+ return AccessController.doPrivileged (new PrivilegedAction<String>() {
+ public String run() {
+ try {
+ File f = new File(libDir + File.separator + "tz.properties");
+ InputStream in = new FileInputStream(f);
+ BufferedInputStream bin = new BufferedInputStream(in);
+ Properties props = new Properties();
+ props.load(bin);
+ bin.close();
+ String dir = props.getProperty("sun.zoneinfo.dir");
+ if (dir == null)
+ return null;
+ File tzdbdat = new File(dir, "tzdb.dat");
+ if (tzdbdat.exists())
+ return dir;
+ return null;
+ } catch (Exception x) {
+ return null;
+ }
+ }
+ });
+ }
private static void addOldMapping() {
for (String[] alias : oldMappings) {

View File

@@ -1,3 +1,28 @@
-------------------------------------------------------------------
Mon Oct 2 07:40:41 UTC 2017 - fstrba@suse.com
- Change the requirement of tzdata-java8 to Recommends, since it is
not strictly needed.
-------------------------------------------------------------------
Thu Sep 28 16:40:43 UTC 2017 - fstrba@suse.com
- Added patch:
* alternative-tzdb_dat.patch
+ Allow specifying alternative path where to find the tzdb.dat
file. With fallback to $JAVA_HOME/jre/lib/tzdb.dat
- Don't symlink tzdb.dat in postinstall
-------------------------------------------------------------------
Thu Sep 21 22:43:35 UTC 2017 - fstrba@suse.com
- Update the provided jdbc-stdext version to 4.2
-------------------------------------------------------------------
Thu Sep 21 11:41:46 UTC 2017 - fstrba@suse.com
- Allow bootstrapping by itself (BuildConflicts: java-devel >= 1.9)
-------------------------------------------------------------------
Sat Sep 16 07:29:20 UTC 2017 - fstrba@suse.com

View File

@@ -199,6 +199,7 @@ Patch1001: java-1_8_0-openjdk-suse-desktop-files.patch
Patch2000: java-1_8_0-openjdk-gcc6.patch
Patch2001: disable-doclint-by-default.patch
Patch2002: java-1_8_0-openjdk-linuxfilestore.patch
Patch2003: alternative-tzdb_dat.patch
BuildRequires: alsa-lib-devel
BuildRequires: autoconf
BuildRequires: automake
@@ -253,9 +254,9 @@ Provides: jre1.7.x
Provides: jre1.8.x
%if %{with bootstrap}
BuildRequires: java-devel >= 1.7
BuildConflicts: java-devel >= 1.8
BuildConflicts: java-devel >= 1.9
%else
BuildRequires: java-1_8_0-openjdk-devel
BuildRequires: %{name}-devel
%endif
%if %{with_system_kerberos}
BuildRequires: krb5-devel
@@ -312,6 +313,7 @@ Requires: jpackage-utils
Requires(post): update-alternatives
# Postun requires update-alternatives to uninstall tool update-alternatives.
Requires(postun): update-alternatives
Recommends: tzdata-java8
# Standard JPackage base provides.
Provides: java-%{javaver}-headless = %{version}-%{release}
Provides: java-headless = %{javaver}
@@ -324,7 +326,7 @@ Provides: jre-openjdk-headless = %{version}-%{release}
Provides: jaas = %{version}
Provides: java-sasl = %{version}
Provides: jce = %{version}
Provides: jdbc-stdext = 4.1
Provides: jdbc-stdext = 4.2
Provides: jndi = %{version}
Provides: jndi-cos = %{version}
Provides: jndi-dns = %{version}
@@ -344,10 +346,6 @@ Provides: jsse = %{version}
%else
Requires: mozilla-nss
%endif
%if 0%{?suse_version} > 1320
# Require zoneinfo data in java8+ format provided by tzdata-java8 subpackage.
Requires(post): tzdata-java8
%endif
%description headless
The OpenJDK 8 runtime environment without audio and video support.
@@ -569,6 +567,7 @@ patch -p0 -i %{PATCH2000}
patch -p0 -i %{PATCH2001}
patch -p0 -i %{PATCH2002}
patch -p0 -i %{PATCH2003}
(cd openjdk/common/autoconf
bash ./autogen.sh
@@ -614,6 +613,9 @@ echo "" >> $JAVA_HOME/jre/lib/pulseaudio.properties
popd
%endif
# Copy tz.properties
echo "sun.zoneinfo.dir=%{_datadir}/javazi" >> $JAVA_HOME/jre/lib/tz.properties
# Check debug symbols are present and can identify code
SERVER_JVM="$JAVA_HOME/jre/lib/%{archinstall}/server/libjvm.so"
if [ -f "$SERVER_JVM" ] ; then
@@ -639,7 +641,7 @@ export NO_BRP_CHECK_BYTECODE_VERSION=true
# Install systemtap support files.
install -dm 755 %{buildroot}%{_jvmdir}/%{sdkdir}/tapset
for i in tapset/*.stp; do
cp -a $i %{buildroot}%{_jvmdir}/%{sdkdir}/tapset/$(basename $i .stp)-1.8.0.stp
cp -a $i %{buildroot}%{_jvmdir}/%{sdkdir}/tapset/$(basename $i .stp)-%{javaver}.stp
done
install -d -m 755 %{buildroot}%{tapsetdir}
pushd %{buildroot}%{tapsetdir}
@@ -867,15 +869,6 @@ update-alternatives \
--slave %{_jvmjardir}/jre-%{javaver} \
jre_%{javaver}_exports %{_jvmjardir}/%{jrelnk}
%if 0%{?suse_version} > 1320
if [ -e %{_datadir}/javazi/tzdb.dat ]; then
if [ -e %{_jvmdir}/%{jredir}/lib/tzdb.dat ]; then
rm -f %{_jvmdir}/%{jredir}/lib/tzdb.dat
fi
ln -sf %{_datadir}/javazi/tzdb.dat %{_jvmdir}/%{jredir}/lib/tzdb.dat
fi
%endif
%postun headless
if [ $1 -eq 0 ]
then
@@ -1105,9 +1098,6 @@ fi
%if 0%{?suse_version} <= 1130
%config(noreplace) %{cacerts}
%endif
%if 0%{?suse_version} > 1320
%ghost %{_jvmdir}/%{jredir}/lib/tzdb.dat
%endif
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.policy
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.security
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/blacklisted.certs