Browse code

Updated openjdk to version 1.8.0.131 and build from source

Change-Id: I22f04690fd8bc501e2c91a8f0aabcae56cfdd737
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2611
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

harishspqr authored on 2017/04/29 09:26:39
Showing 20 changed files
... ...
@@ -41,6 +41,12 @@ else
41 41
 PHOTON_PUBLISH_RPMS := publish-rpms
42 42
 endif
43 43
 
44
+ifdef PHOTON_PUBLISH_XRPMS_PATH
45
+PHOTON_PUBLISH_XRPMS := publish-x-rpms-cached
46
+else
47
+PHOTON_PUBLISH_XRPMS := publish-x-rpms
48
+endif
49
+
44 50
 ifdef PHOTON_ENABLE_RPMCHECK
45 51
 PHOTON_RPMCHECK_OPTION := -u
46 52
 else
... ...
@@ -228,7 +234,7 @@ who-needs:
228 228
 	@cd $(PHOTON_SPECDEPS_DIR) && \
229 229
 		$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg)
230 230
 
231
-packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
231
+packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
232 232
 	@echo "Building all RPMS..."
233 233
 	@cd $(PHOTON_PKG_BUILDER_DIR) && \
234 234
         $(PHOTON_PACKAGE_BUILDER) \
... ...
@@ -238,6 +244,7 @@ packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTA
238 238
                 -x $(PHOTON_SRCS_DIR) \
239 239
                 -b $(PHOTON_CHROOT_PATH) \
240 240
                 -l $(PHOTON_LOGS_DIR) \
241
+		-e $(PHOTON_PUBLISH_XRPMS_DIR) \
241 242
                 -p $(PHOTON_PUBLISH_RPMS_DIR) \
242 243
                 -c $(PHOTON_BINTRAY_CONFIG) \
243 244
                 -d $(PHOTON_DIST_TAG) \
... ...
@@ -248,7 +255,7 @@ packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTA
248 248
                 $(PHOTON_RPMCHECK_OPTION) \
249 249
                 -t ${THREADS}
250 250
 
251
-updated-packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
251
+updated-packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
252 252
 	@echo "Building only updated RPMS..."
253 253
 	@cd $(PHOTON_PKG_BUILDER_DIR) && \
254 254
         $(PHOTON_PACKAGE_BUILDER) \
... ...
@@ -258,6 +265,7 @@ updated-packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES)
258 258
                 -b $(PHOTON_CHROOT_PATH) \
259 259
                 -l $(PHOTON_LOGS_DIR) \
260 260
                 -p $(PHOTON_PUBLISH_RPMS_DIR) \
261
+				-e $(PHOTON_PUBLISH_XRPMS_DIR) \
261 262
                 -c $(PHOTON_BINTRAY_CONFIG) \
262 263
                 -d $(PHOTON_DIST_TAG) \
263 264
                 -n $(PHOTON_BUILD_NUMBER) \
... ...
@@ -326,11 +334,21 @@ publish-rpms:
326 326
 	@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
327 327
 	$(PHOTON_PULL_PUBLISH_RPMS) $(PHOTON_PUBLISH_RPMS_DIR)
328 328
 
329
+publish-x-rpms:
330
+	@echo "Pulling publish X rpms from bintray..."
331
+	@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
332
+	$(PHOTON_PULL_PUBLISH_X_RPMS) $(PHOTON_PUBLISH_XRPMS_DIR)
333
+
329 334
 publish-rpms-cached:
330 335
 	@echo "Using cached publish rpms..."
331 336
 	@$(MKDIR) -p $(PHOTON_PUBLISH_RPMS_DIR) && \
332 337
 	 $(CP) -rf $(PHOTON_PUBLISH_RPMS_PATH)/* $(PHOTON_PUBLISH_RPMS_DIR)/
333 338
 
339
+publish-x-rpms-cached:
340
+	@echo "Using ..."
341
+	@$(MKDIR) -p $(PHOTON_PUBLISH_XRPMS_DIR) && \
342
+        $(CP) -rf $(PHOTON_PUBLISH_XRPMS_PATH)/* $(PHOTON_PUBLISH_XRPMS_DIR)/			
343
+
334 344
 $(PHOTON_STAGE):
335 345
 	@echo "Creating staging folder..."
336 346
 	$(MKDIR) -p $(PHOTON_STAGE)
... ...
@@ -503,7 +521,7 @@ endif
503 503
 check-packer-ovf-plugin:
504 504
 	@[[ -e ~/.packer.d/plugins/packer-post-processor-vagrant-vmware-ovf ]] || { echo "Packer OVF post processor not installed. Aborting" >&2; exit 1; }
505 505
 
506
-%: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN)
506
+%: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_SOURCES) $(CONTAIN)
507 507
 	$(eval PKG_NAME = $@)
508 508
 	@echo "Building package $(PKG_NAME) ..."
509 509
 	@cd $(PHOTON_PKG_BUILDER_DIR) && \
... ...
@@ -514,6 +532,7 @@ check-packer-ovf-plugin:
514 514
                               -a $(PHOTON_SRPMS_DIR) \
515 515
                               -x $(PHOTON_SRCS_DIR) \
516 516
                               -p $(PHOTON_PUBLISH_RPMS_DIR) \
517
+							  -e $(PHOTON_PUBLISH_XRPMS_DIR) \
517 518
                               -c $(PHOTON_BINTRAY_CONFIG) \
518 519
                               -d $(PHOTON_DIST_TAG) \
519 520
                               -n $(PHOTON_BUILD_NUMBER) \
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Ant contrib
2 2
 Name:		ant-contrib
3 3
 Version:	1.0b3
4
-Release:	10%{?dist}
4
+Release:	11%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://ant-contrib.sourceforget.net
7 7
 Group:		Applications/System
... ...
@@ -10,9 +10,12 @@ Distribution: 	Photon
10 10
 BuildArch:      noarch
11 11
 Source0:	http://dl.bintray.com/vmware/photon_release_1.0_TP1_x86_64/%{name}-%{version}-src.tar.gz
12 12
 %define sha1 ant-contrib=b28d2bf18656b263611187fa9fbb95cec93d47c8
13
-Requires: openjre >= 1.8.0.112, apache-ant >= 1.9.6
14
-BuildRequires: openjre >= 1.8.0.112, apache-ant >= 1.9.6
15
-BuildRequires: openjdk >= 1.8.0.112
13
+%define java_macros_version 1.8.0.131-1%{?dist}
14
+BuildRequires: openjre >= %{java_macros_version}
15
+BuildRequires: openjdk >= %{java_macros_version}
16
+BuildRequires: apache-ant >= 1.9.6
17
+Requires: openjre >= %{java_macros_version}
18
+Requires: apache-ant >= 1.9.6
16 19
 %define _prefix /var/opt/ant-contrib
17 20
 
18 21
 %description
... ...
@@ -23,8 +26,8 @@ The Ant Contrib project is a collection of tasks for Apache Ant.
23 23
 find . -name '*.jar' -or -name '*.class' -exec rm -rf {} +
24 24
 
25 25
 %build
26
-ANT_HOME=/var/opt/apache-ant-1.9.6
27
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
26
+export ANT_HOME=%{_ant_home}
27
+export JAVA_HOME=%{_java_home}
28 28
 mkdir -p -m 700 %{_prefix}
29 29
 $ANT_HOME/bin/ant -Ddist.dir="%{_prefix}" -Dproject.version="1.0b3" dist
30 30
 %install
... ...
@@ -39,6 +42,8 @@ cd %{buildroot}/var/opt && tar xvzf %{_prefix}/ant-contrib-1.0b3-bin.tar.gz --wi
39 39
 %{_prefix}/lib/*.jar
40 40
 
41 41
 %changelog
42
+*	Mon May 01 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.0b3-11
43
+-	Use java_macros to determine the version on updating java to 1.8.0.131
42 44
 *   Fri Apr 07 2017 Divya Thaluru <dthaluru@vmware.com> 1.0b3-10
43 45
 -   Removed prebuilt binaries from source tar ball
44 46
 *   Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0b3-9
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Apache Ant
2 2
 Name:		apache-ant
3 3
 Version:	1.9.6
4
-Release:	5%{?dist}
4
+Release:	6%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://ant.apache.org
7 7
 Group:		Applications/System
... ...
@@ -14,9 +14,10 @@ Source1:	http://hamcrest.googlecode.com/files/hamcrest-1.3.tar.gz
14 14
 %define sha1 hamcrest=f0ab4d66186b894a06d89d103c5225cf53697db3
15 15
 Source2:    http://dl.bintray.com/vmware/photon_sources/1.0/maven-ant-tasks-2.1.3.tar.gz
16 16
 %define sha1 maven-ant-tasks=f38c0cc7b38007b09638366dbaa4ee902d9c255b
17
-Requires: openjre >= 1.8.0.112, python2
18
-BuildRequires: openjre >= 1.8.0.45
19
-BuildRequires: openjdk >= 1.8.0.45
17
+%define java_macros_version 1.8.0.131-1%{?dist}
18
+Requires: openjre >= %{java_macros_version}, python2
19
+BuildRequires: openjre >= %{java_macros_version}
20
+BuildRequires: openjdk >= %{java_macros_version}
20 21
 %define _prefix /var/opt/apache-ant-%{version}
21 22
 %define _bindir %{_prefix}/bin
22 23
 %define _libdir %{_prefix}/lib
... ...
@@ -36,7 +37,7 @@ cp -v ./hamcrest-1.3/hamcrest-core-1.3.jar ./lib/optional
36 36
 
37 37
 mkdir -p -m 700 $ANT_DIST_DIR
38 38
 
39
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
39
+export JAVA_HOME=%{_java_home}
40 40
 
41 41
 ./bootstrap.sh && ./build.sh -Ddist.dir=$ANT_DIST_DIR
42 42
 
... ...
@@ -59,13 +60,19 @@ cp %{_builddir}/%{name}-%{version}/maven-ant-tasks-2.1.3/README.txt $MAVEN_ANT_T
59 59
 chown -R root:root $MAVEN_ANT_TASKS_DIR
60 60
 chmod 644 $MAVEN_ANT_TASKS_DIR/*
61 61
 
62
+install -d -m 755 %{buildroot}/etc/profile.d/
63
+echo 'export ANT_HOME=/var/opt/%{name}-%{version}' > %{buildroot}/etc/profile.d/%{name}.sh
64
+
62 65
 %files
63 66
 %defattr(-,root,root)
64 67
 %{_bindir}/*
65 68
 %{_libdir}/*
66 69
 %{_prefix}/maven-ant-tasks/*
70
+%{_sysconfdir}/profile.d/%{name}.sh
67 71
 
68 72
 %changelog
73
+*	Mon May 01 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.9.6-6
74
+-	Update java to 1.8.0.131 & use java macros to update version
69 75
 *   Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.9.6-5
70 76
 -   Updated JAVA_HOME path to point to latest JDK.
71 77
 *   Tue Oct 04 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.9.6-4
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Apache Maven
2 2
 Name:		apache-maven
3 3
 Version:	3.3.9
4
-Release:	7%{?dist}
4
+Release:	8%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://maven.apache.org
7 7
 Group:		Applications/System
... ...
@@ -10,10 +10,14 @@ Distribution: 	Photon
10 10
 BuildArch:       noarch
11 11
 Source0:	http://apache.mirrors.lucidnetworks.net//maven/source/%{name}-%{version}-src.tar.gz
12 12
 %define sha1 apache-maven=1912316078f1f7041dd8cd2580f210d30f898162
13
-Requires: openjre >= 1.8.0.112
14
-BuildRequires: openjre >= 1.8.0.45, openjdk >= 1.8.0.45, apache-ant >= 1.9.6, wget >= 1.15
13
+%define java_macros_version 1.8.0.131-1%{?dist}
14
+Requires: openjre >= %{java_macros_version}
15
+BuildRequires: openjre >= %{java_macros_version}
16
+BuildRequires: openjdk >= %{java_macros_version}
17
+BuildRequires: apache-ant >= 1.9.6
18
+BuildRequires: wget >= 1.15
15 19
 
16
-%define _prefix /var/opt/apache-maven-3.3.9
20
+%define _prefix /var/opt/apache-maven-%{version}
17 21
 %define _bindir %{_prefix}/bin
18 22
 %define _libdir %{_prefix}/lib
19 23
 
... ...
@@ -26,22 +30,22 @@ The Maven package contains binaries for a build system
26 26
 find . -name build.xml | xargs sed -i 's/timeout="600000"/timeout="1200000"/g'
27 27
 
28 28
 %build
29
-MAVEN_DIST_DIR=/var/opt/apache-maven-3.3.9
29
+MAVEN_DIST_DIR=%{_prefix}
30 30
 
31
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
32
-export ANT_HOME=/var/opt/apache-ant-1.9.6
31
+export JAVA_HOME=%{_java_home}
32
+export ANT_HOME=%{_ant_home}
33 33
 export PATH=$PATH:$ANT_HOME/bin
34 34
 
35 35
 sed -i 's/www.opensource/opensource/g' DEPENDENCIES
36 36
 ant -Dmaven.home=$MAVEN_DIST_DIR
37 37
 
38 38
 %install
39
-
40
-[ %{buildroot} != "/"] && rm -rf %{buildroot}/*
39
+MAVEN_DIST_DIR=%{_prefix}
40
+[ %{buildroot} != "/" ] && rm -rf %{buildroot}/*
41 41
 
42 42
 mkdir -p -m 700 %{buildroot}/var/opt
43 43
 
44
-cp -r /var/opt/apache-maven-3.3.9  %{buildroot}/var/opt
44
+cp -r "$MAVEN_DIST_DIR"  %{buildroot}/var/opt
45 45
 
46 46
 install -d -m 755 %{buildroot}/etc/profile.d/
47 47
 
... ...
@@ -63,6 +67,8 @@ echo 'export MAVEN_OPTS=-Xms256m' >> %{buildroot}/etc/profile.d/%{name}.sh
63 63
 %{_prefix}/conf/toolchains.xml
64 64
 
65 65
 %changelog
66
+*	Mon May 01 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 3.3.9-8
67
+-	Update java to 1.8.0.131 & use java macros to update version
66 68
 *   Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 3.3.9-7
67 69
 -   Updated JAVA_HOME path to point to latest JDK.
68 70
 *   Thu Oct 27 2016 Alexey Makhalov <amakhalov@vmware.com> 3.3.9-6
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Apache Tomcat
2 2
 Name:		apache-tomcat
3 3
 Version:	8.5.13
4
-Release:	2%{?dist}
4
+Release:	3%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://tomcat.apache.org
7 7
 Group:		Applications/System
... ...
@@ -10,9 +10,12 @@ Distribution: 	Photon
10 10
 BuildArch:      noarch
11 11
 Source0:    http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v%{version}/src/%{name}-%{version}-src.tar.gz
12 12
 %define sha1 apache-tomcat=a2097a08b023c363098917078d9a23bd7a3b6032
13
-Requires: openjre >= 1.8.0.112, apache-ant >= 1.9.6
14
-BuildRequires: openjre >= 1.8.0.112, apache-ant >= 1.9.6
15
-BuildRequires: openjdk >= 1.8.0.112
13
+%define java_macros_version 1.8.0.131-1%{?dist}
14
+BuildRequires: openjre >= %{java_macros_version}
15
+BuildRequires: openjdk >= %{java_macros_version}
16
+BuildRequires: apache-ant >= 1.9.6
17
+Requires: openjre >= %{java_macros_version}
18
+Requires: apache-ant >= 1.9.6
16 19
 
17 20
 %define _prefix /var/opt/%{name}-%{version}
18 21
 %define _bindir %{_prefix}/bin
... ...
@@ -30,8 +33,8 @@ find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "
30 30
    -name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete
31 31
 
32 32
 %build
33
-ANT_HOME=/var/opt/apache-ant-1.9.6
34
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
33
+export ANT_HOME=%{_ant_home}
34
+export JAVA_HOME=%{_java_home}
35 35
 mkdir -p -m 700 %{_prefix}
36 36
 $ANT_HOME/bin/ant -Dbase.path="." deploy dist-prepare dist-source javadoc
37 37
 
... ...
@@ -70,6 +73,8 @@ rm -rf %{buildroot}/*
70 70
 %{_webappsdir}/*
71 71
 
72 72
 %changelog
73
+*	Tue May 02 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 8.5.13-3
74
+-	Updated openjdk to version 1.8.0.131 & used java macros to update version.
73 75
 *   Tue Apr 18 2017 Divya Thaluru <dthaluru@vmware.com> 8.5.13-2
74 76
 -   Added logic to package directories
75 77
 *   Mon Apr 10 2017 Divya Thaluru <dthaluru@vmware.com> 8.5.13-1
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Apache Commons Daemon
2 2
 Name:		commons-daemon
3 3
 Version:	1.0.15
4
-Release:	8%{?dist}
4
+Release:	9%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://commons.apache.org/proper/commons-daemon
7 7
 Group:		Applications/System
... ...
@@ -10,8 +10,11 @@ Distribution: 	Photon
10 10
 BuildArch:      x86_64
11 11
 Source0:	http://apache.mesi.com.ar//commons/daemon/source/commons-daemon-1.0.15-src.tar.gz
12 12
 %define sha1 commons-daemon=ca6a448d1d214f714e214b35809a2117568970e3
13
-Requires: openjre >= 1.8.0.112
14
-BuildRequires: openjre >= 1.8.0.45, openjdk >= 1.8.0.45, apache-ant >= 1.9.6
13
+%define java_macros_version 1.8.0.131-1%{?dist}
14
+Requires: openjre >= %{java_macros_version}
15
+BuildRequires: openjre >= %{java_macros_version}
16
+BuildRequires: openjdk >= %{java_macros_version}
17
+BuildRequires: apache-ant >= 1.9.6
15 18
 
16 19
 %define _prefix /var/opt/%{name}-%{version}
17 20
 %define _bindir %{_prefix}/bin
... ...
@@ -23,8 +26,8 @@ The JNA package contains libraries for interop from Java to native libraries.
23 23
 
24 24
 %setup -q -n %{name}-%{version}-src
25 25
 %build
26
-ANT_HOME=/var/opt/apache-ant-1.9.6
27
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
26
+ANT_HOME=%{_ant_home}
27
+export JAVA_HOME=%{_java_home}
28 28
 
29 29
 $ANT_HOME/bin/ant dist
30 30
 
... ...
@@ -39,7 +42,7 @@ cd $CURDIR
39 39
 
40 40
 %install
41 41
 
42
-ANT_HOME=/var/opt/apache-ant-1.9.6
42
+ANT_HOME=%{_ant_home}
43 43
 DIST_DIR=%{buildroot}%{_prefix}
44 44
 
45 45
 [ %{buildroot} != "/"] && rm -rf %{buildroot}/*
... ...
@@ -58,6 +61,8 @@ chmod -R 755 $DIST_DIR
58 58
 %{_prefix}/*.jar
59 59
 
60 60
 %changelog
61
+*	Mon May 01 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.0.15-9
62
+-	Update java to 1.8.0.131 & use java macros to update version
61 63
 *   Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0.15-8
62 64
 -   Updated JAVA_HOME path to point to latest JDK.
63 65
 *   Tue Oct 04 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0.15-7
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Java Native Access
2 2
 Name:		jna
3 3
 Version:	4.2.1
4
-Release:	6%{?dist}
4
+Release:	7%{?dist}
5 5
 License:	Apache
6 6
 URL:		http://github.com/twall/jna
7 7
 Group:		Applications/System
... ...
@@ -10,8 +10,11 @@ Distribution: 	Photon
10 10
 BuildArch:      x86_64
11 11
 Source0:	http://dl.bintray.com/vmware/photon_release_1.0_TP1_x86_64/%{name}-%{version}.tar.gz
12 12
 %define sha1 jna=30a1132f9ca6b3222eccd380a3f4149aa7df3f59
13
-Requires: openjre >= 1.8.0.112
14
-BuildRequires: openjre >= 1.8.0.45, openjdk >= 1.8.0.45, apache-ant >= 1.9.6
13
+%define java_macros_version 1.8.0.131-1%{?dist}
14
+Requires: openjre >= %{java_macros_version}
15
+BuildRequires: openjre >= %{java_macros_version}
16
+BuildRequires: openjdk >= %{java_macros_version}
17
+BuildRequires: apache-ant >= 1.9.6
15 18
 
16 19
 %define _prefix /var/opt/jna-4.2.1
17 20
 
... ...
@@ -30,8 +33,8 @@ Sources for JNA
30 30
 
31 31
 %setup -q
32 32
 %build
33
-ANT_HOME=/var/opt/apache-ant-1.9.6
34
-export JAVA_HOME=/var/opt/OpenJDK-1.8.0.112-bin
33
+ANT_HOME=%{_ant_home}
34
+export JAVA_HOME=%{_java_home}
35 35
 
36 36
 #disabling all tests
37 37
 $ANT_HOME/bin/ant -Dcflags_extra.native=-DNO_JAWT -Dtests.exclude-patterns="**/*.java" -Drelease=true
... ...
@@ -39,7 +42,7 @@ $ANT_HOME/bin/ant -Dcflags_extra.native=-DNO_JAWT -Dtests.exclude-patterns="**/*
39 39
 
40 40
 %install
41 41
 
42
-ANT_HOME=/var/opt/apache-ant-1.9.6
42
+ANT_HOME=%{_ant_home}
43 43
 JNA_DIST_DIR=%{buildroot}%{_prefix}
44 44
 
45 45
 [ %{buildroot} != "/"] && rm -rf %{buildroot}/*
... ...
@@ -65,6 +68,8 @@ $ANT_HOME/bin/ant -Ddist=$JNA_DIST_DIR dist -Drelease=true
65 65
 %{_prefix}/*sources.jar
66 66
 
67 67
 %changelog
68
+*	Mon May 01 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 4.2.1-7
69
+-	Update java to 1.8.0.131 & use java macros to update version
68 70
 *   Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.2.1-6
69 71
 -   Updated JAVA_HOME path to point to latest JDK.
70 72
 *   Tue Oct 04 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.2.1-5
71 73
new file mode 100644
... ...
@@ -0,0 +1,433 @@
0
+--- a/jdk/src/share/back/invoker.c	Tue Mar 29 23:02:04 2016 +0100
1
+@@ -211,6 +211,47 @@
2
+     return error;
3
+ }
4
+ 
5
++/*
6
++ * Delete global references from the request which got put there before a
7
++ * invoke request was carried out. See fillInvokeRequest() and invoker invoke*()
8
++ * impls.
9
++ */
10
++static void
11
++deleteGlobalRefs(JNIEnv *env, InvokeRequest *request)
12
++{
13
++    void *cursor;
14
++    jint argIndex = 0;
15
++    jvalue *argument = request->arguments;
16
++    jbyte argumentTag = firstArgumentTypeTag(request->methodSignature, &cursor);
17
++
18
++    if (request->clazz != NULL) {
19
++        tossGlobalRef(env, &(request->clazz));
20
++    }
21
++    if (request->instance != NULL) {
22
++        tossGlobalRef(env, &(request->instance));
23
++    }
24
++    /* Delete global argument references */
25
++    while (argIndex < request->argumentCount) {
26
++        if ((argumentTag == JDWP_TAG(OBJECT)) ||
27
++            (argumentTag == JDWP_TAG(ARRAY))) {
28
++            if (argument->l != NULL) {
29
++                tossGlobalRef(env, &(argument->l));
30
++            }
31
++        }
32
++        argument++;
33
++        argIndex++;
34
++        argumentTag = nextArgumentTypeTag(&cursor);
35
++    }
36
++    /* Delete potentially saved return values */
37
++    if ((request->invokeType == INVOKE_CONSTRUCTOR) ||
38
++        (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) ||
39
++        (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) {
40
++        if (request->returnValue.l != NULL) {
41
++            tossGlobalRef(env, &(request->returnValue.l));
42
++        }
43
++    }
44
++}
45
++
46
+ static jvmtiError
47
+ fillInvokeRequest(JNIEnv *env, InvokeRequest *request,
48
+                   jbyte invokeType, jbyte options, jint id,
49
+@@ -736,6 +777,13 @@
50
+         (void)outStream_writeObjectRef(env, &out, exc);
51
+         outStream_sendReply(&out);
52
+     }
53
++
54
++    /*
55
++     * At this time, there's no need to retain global references on
56
++     * arguments since the reply is processed. No one will deal with
57
++     * this request ID anymore, so we must call deleteGlobalRefs().
58
++     */
59
++    deleteGlobalRefs(env, request);
60
+ }
61
+ 
62
+ jboolean
63
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
64
+@@ -0,0 +1,1 @@
65
++-Xmx40m
66
+\ No newline at end of file
67
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
68
+@@ -0,0 +1,312 @@
69
++/*
70
++ * Copyright (c) 2016 Red Hat Inc.
71
++ *
72
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
73
++ *
74
++ * This code is free software; you can redistribute it and/or modify it
75
++ * under the terms of the GNU General Public License version 2 only, as
76
++ * published by the Free Software Foundation.
77
++ *
78
++ * This code is distributed in the hope that it will be useful, but WITHOUT
79
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
80
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
81
++ * version 2 for more details (a copy is included in the LICENSE file that
82
++ * accompanied this code).
83
++ *
84
++ * You should have received a copy of the GNU General Public License version
85
++ * 2 along with this work; if not, write to the Free Software Foundation,
86
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
87
++ *
88
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
89
++ * or visit www.oracle.com if you need additional information or have any
90
++ * questions.
91
++ */
92
++
93
++/**
94
++ *  @test
95
++ *  @bug 4858370
96
++ *  @summary JDWP: Memory Leak (global references not deleted after invokeMethod).
97
++ *
98
++ *  @author Severin Gehwolf <sgehwolf@redhat.com>
99
++ *
100
++ *  @library ..
101
++ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
102
++ *  @run compile -g OomDebugTest.java
103
++ *  @run shell OomDebugTestSetup.sh
104
++ *  @run main OomDebugTest OomDebugTestTarget test1
105
++ *  @run main OomDebugTest OomDebugTestTarget test2
106
++ *  @run main OomDebugTest OomDebugTestTarget test3
107
++ *  @run main OomDebugTest OomDebugTestTarget test4
108
++ *  @run main OomDebugTest OomDebugTestTarget test5
109
++ */
110
++import java.util.ArrayList;
111
++import java.util.Collections;
112
++import java.util.List;
113
++
114
++import com.sun.jdi.ArrayReference;
115
++import com.sun.jdi.ArrayType;
116
++import com.sun.jdi.ClassType;
117
++import com.sun.jdi.Field;
118
++import com.sun.jdi.InvocationException;
119
++import com.sun.jdi.Method;
120
++import com.sun.jdi.ObjectReference;
121
++import com.sun.jdi.ReferenceType;
122
++import com.sun.jdi.StackFrame;
123
++import com.sun.jdi.VMOutOfMemoryException;
124
++import com.sun.jdi.Value;
125
++import com.sun.jdi.event.BreakpointEvent;
126
++
127
++/***************** Target program **********************/
128
++
129
++class OomDebugTestTarget {
130
++
131
++    OomDebugTestTarget() {
132
++        System.out.println("DEBUG: invoked constructor");
133
++    }
134
++    static class FooCls {
135
++        @SuppressWarnings("unused")
136
++        private byte[] bytes = new byte[3000000];
137
++    };
138
++
139
++    FooCls fooCls = new FooCls();
140
++    byte[] byteArray = new byte[0];
141
++
142
++    void testMethod(FooCls foo) {
143
++        System.out.println("DEBUG: invoked 'void testMethod(FooCls)', foo == " + foo);
144
++    }
145
++
146
++    void testPrimitive(byte[] foo) {
147
++        System.out.println("DEBUG: invoked 'void testPrimitive(byte[])', foo == " + foo);
148
++    }
149
++
150
++    byte[] testPrimitiveArrRetval() {
151
++        System.out.println("DEBUG: invoked 'byte[] testPrimitiveArrRetval()'");
152
++        return new byte[3000000];
153
++    }
154
++
155
++    FooCls testFooClsRetval() {
156
++        System.out.println("DEBUG: invoked 'FooCls testFooClsRetval()'");
157
++        return new FooCls();
158
++    }
159
++
160
++    public void entry() {}
161
++
162
++    public static void main(String[] args){
163
++        System.out.println("DEBUG: OomDebugTestTarget.main");
164
++        new OomDebugTestTarget().entry();
165
++    }
166
++}
167
++
168
++/***************** Test program ************************/
169
++
170
++public class OomDebugTest extends TestScaffold {
171
++
172
++    private static final int TOTAL_TESTS = 1;
173
++    private ReferenceType targetClass;
174
++    private ObjectReference thisObject;
175
++    private int failedTests;
176
++    private final String testMethodName;
177
++
178
++    public OomDebugTest(String[] args) {
179
++        super(args);
180
++        if (args.length != 2) {
181
++            throw new RuntimeException("Test failed unexpectedly.");
182
++        }
183
++        testMethodName = args[1];
184
++    }
185
++
186
++    @Override
187
++    protected void runTests() throws Exception {
188
++        try {
189
++            /*
190
++             * Get to the top of entry()
191
++             * to determine targetClass and mainThread
192
++             */
193
++            BreakpointEvent bpe = startTo("OomDebugTestTarget", "entry", "()V");
194
++            targetClass = bpe.location().declaringType();
195
++
196
++            mainThread = bpe.thread();
197
++
198
++            StackFrame frame = mainThread.frame(0);
199
++            thisObject = frame.thisObject();
200
++            java.lang.reflect.Method m = findTestMethod();
201
++            m.invoke(this);
202
++        } catch (NoSuchMethodException e) {
203
++            e.printStackTrace();
204
++            failure();
205
++        } catch (SecurityException e) {
206
++            e.printStackTrace();
207
++            failure();
208
++        }
209
++    }
210
++
211
++    private java.lang.reflect.Method findTestMethod()
212
++            throws NoSuchMethodException, SecurityException {
213
++        return OomDebugTest.class.getDeclaredMethod(testMethodName);
214
++    }
215
++
216
++    private void failure() {
217
++        failedTests++;
218
++    }
219
++
220
++    /*
221
++     * Test case: Object reference as method parameter.
222
++     */
223
++    @SuppressWarnings("unused") // called via reflection
224
++    private void test1() throws Exception {
225
++        System.out.println("DEBUG: ------------> Running " + testMethodName);
226
++        try {
227
++            Field field = targetClass.fieldByName("fooCls");
228
++            ClassType clsType = (ClassType)field.type();
229
++            Method constructor = getConstructorForClass(clsType);
230
++            for (int i = 0; i < 15; i++) {
231
++                @SuppressWarnings({ "rawtypes", "unchecked" })
232
++                ObjectReference objRef = clsType.newInstance(mainThread,
233
++                                                             constructor,
234
++                                                             new ArrayList(0),
235
++                                                             ObjectReference.INVOKE_NONVIRTUAL);
236
++                invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
237
++            }
238
++        } catch (InvocationException e) {
239
++            handleFailure(e);
240
++        }
241
++    }
242
++
243
++    /*
244
++     * Test case: Array reference as method parameter.
245
++     */
246
++    @SuppressWarnings("unused") // called via reflection
247
++    private void test2() throws Exception {
248
++        System.out.println("DEBUG: ------------> Running " + testMethodName);
249
++        try {
250
++            Field field = targetClass.fieldByName("byteArray");
251
++            ArrayType arrType = (ArrayType)field.type();
252
++
253
++            for (int i = 0; i < 15; i++) {
254
++                ArrayReference byteArrayVal = arrType.newInstance(3000000);
255
++                invoke("testPrimitive", "([B)V", byteArrayVal);
256
++            }
257
++        } catch (VMOutOfMemoryException e) {
258
++            defaultHandleOOMFailure(e);
259
++        }
260
++    }
261
++
262
++    /*
263
++     * Test case: Array reference as return value.
264
++     */
265
++    @SuppressWarnings("unused") // called via reflection
266
++    private void test3() throws Exception {
267
++        System.out.println("DEBUG: ------------> Running " + testMethodName);
268
++        try {
269
++            for (int i = 0; i < 15; i++) {
270
++                invoke("testPrimitiveArrRetval",
271
++                       "()[B",
272
++                       Collections.EMPTY_LIST,
273
++                       vm().mirrorOfVoid());
274
++            }
275
++        } catch (InvocationException e) {
276
++            handleFailure(e);
277
++        }
278
++    }
279
++
280
++    /*
281
++     * Test case: Object reference as return value.
282
++     */
283
++    @SuppressWarnings("unused") // called via reflection
284
++    private void test4() throws Exception {
285
++        System.out.println("DEBUG: ------------> Running " + testMethodName);
286
++        try {
287
++            for (int i = 0; i < 15; i++) {
288
++                invoke("testFooClsRetval",
289
++                       "()LOomDebugTestTarget$FooCls;",
290
++                       Collections.EMPTY_LIST,
291
++                       vm().mirrorOfVoid());
292
++            }
293
++        } catch (InvocationException e) {
294
++            handleFailure(e);
295
++        }
296
++    }
297
++
298
++    /*
299
++     * Test case: Constructor
300
++     */
301
++    @SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
302
++    private void test5() throws Exception {
303
++        System.out.println("DEBUG: ------------> Running " + testMethodName);
304
++        try {
305
++            ClassType type = (ClassType)thisObject.type();
306
++            for (int i = 0; i < 15; i++) {
307
++                type.newInstance(mainThread,
308
++                                 findMethod(targetClass, "<init>", "()V"),
309
++                                 new ArrayList(0),
310
++                                 ObjectReference.INVOKE_NONVIRTUAL);
311
++            }
312
++        } catch (InvocationException e) {
313
++            handleFailure(e);
314
++        }
315
++    }
316
++
317
++    private Method getConstructorForClass(ClassType clsType) {
318
++        List<Method> methods = clsType.methodsByName("<init>");
319
++        if (methods.size() != 1) {
320
++            throw new RuntimeException("FAIL. Expected only one, the default, constructor");
321
++        }
322
++        return methods.get(0);
323
++    }
324
++
325
++    private void handleFailure(InvocationException e) {
326
++        // There is no good way to see the OOME diagnostic message in the target since the
327
++        // TestScaffold might throw an exception while trying to print the stack trace. I.e
328
++        // it might get a a VMDisconnectedException before the stack trace printing finishes.
329
++        System.err.println("FAILURE: InvocationException caused by OOM");
330
++        defaultHandleOOMFailure(e);
331
++    }
332
++
333
++    private void defaultHandleOOMFailure(Exception e) {
334
++        e.printStackTrace();
335
++        failure();
336
++    }
337
++
338
++    @SuppressWarnings({ "rawtypes", "unchecked" })
339
++    void invoke(String methodName, String methodSig, Value value)
340
++            throws Exception {
341
++        List args = new ArrayList(1);
342
++        args.add(value);
343
++        invoke(methodName, methodSig, args, value);
344
++    }
345
++
346
++    void invoke(String methodName,
347
++                String methodSig,
348
++                @SuppressWarnings("rawtypes") List args,
349
++                Value value) throws Exception {
350
++        Method method = findMethod(targetClass, methodName, methodSig);
351
++        if ( method == null) {
352
++            failure("FAILED: Can't find method: "
353
++                    + methodName  + " for class = " + targetClass);
354
++            return;
355
++        }
356
++        invoke(method, args, value);
357
++    }
358
++
359
++    @SuppressWarnings({ "rawtypes", "unchecked" })
360
++    void invoke(Method method, List args, Value value) throws Exception {
361
++        thisObject.invokeMethod(mainThread, method, args, 0);
362
++        System.out.println("DEBUG: Done invoking method via debugger.");
363
++    }
364
++
365
++    Value fieldValue(String fieldName) {
366
++        Field field = targetClass.fieldByName(fieldName);
367
++        return thisObject.getValue(field);
368
++    }
369
++
370
++    public static void main(String[] args) throws Exception {
371
++        OomDebugTest oomTest = new OomDebugTest(args);
372
++        oomTest.startTests();
373
++        if (oomTest.failedTests > 0) {
374
++            throw new RuntimeException(oomTest.failedTests
375
++                                       + " of " + TOTAL_TESTS + " test(s) failed.");
376
++        }
377
++        System.out.println("All " + TOTAL_TESTS + " tests passed.");
378
++    }
379
++
380
++}
381
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
382
+@@ -0,0 +1,46 @@
383
++#!/bin/sh
384
++#
385
++# Copyright (c) 2016 Red Hat Inc.
386
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
387
++#
388
++# This code is free software; you can redistribute it and/or modify it
389
++# under the terms of the GNU General Public License version 2 only, as
390
++# published by the Free Software Foundation.
391
++#
392
++# This code is distributed in the hope that it will be useful, but WITHOUT
393
++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
394
++# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
395
++# version 2 for more details (a copy is included in the LICENSE file that
396
++# accompanied this code).
397
++#
398
++# You should have received a copy of the GNU General Public License version
399
++# 2 along with this work; if not, write to the Free Software Foundation,
400
++# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
401
++#
402
++# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
403
++# or visit www.oracle.com if you need additional information or have any
404
++# questions.
405
++#
406
++
407
++
408
++if [ "${TESTSRC}" = "" ]
409
++then
410
++  echo "TESTSRC not set.  Test cannot execute.  Failed."
411
++  exit 1
412
++fi
413
++echo "TESTSRC=${TESTSRC}"
414
++
415
++if [ "${TESTJAVA}" = "" ]
416
++then
417
++  echo "TESTJAVA not set.  Test cannot execute.  Failed."
418
++  exit 1
419
++fi
420
++echo "TESTJAVA=${TESTJAVA}"
421
++
422
++if [ "${TESTCLASSES}" = "" ]
423
++then
424
++  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
425
++  exit 1
426
++fi
427
++
428
++cp ${TESTSRC}/@debuggeeVMOptions ${TESTCLASSES}/
0 429
new file mode 100644
... ...
@@ -0,0 +1,53 @@
0
+diff -r 6b81fd2227d1 -r 3334efeacd83 src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java
1
+--- a/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	Fri Apr 01 05:33:37 2016 +0100
2
+@@ -174,15 +174,20 @@
3
+                     storeFile = new File(storeFileName);
4
+                     fis = getFileInputStream(storeFile);
5
+                 } else {
6
+-                    String javaHome = props.get("javaHome");
7
+-                    storeFile = new File(javaHome + sep + "lib" + sep
8
+-                                                    + "security" + sep +
9
+-                                                    "jssecacerts");
10
++                    /* Check system cacerts DB first; /etc/pki/java/cacerts */
11
++                    storeFile = new File(sep + "etc" + sep + "pki" + sep
12
++                                         + "java" + sep + "cacerts");
13
+                     if ((fis = getFileInputStream(storeFile)) == null) {
14
++                        String javaHome = props.get("javaHome");
15
+                         storeFile = new File(javaHome + sep + "lib" + sep
16
+-                                                    + "security" + sep +
17
+-                                                    "cacerts");
18
+-                        fis = getFileInputStream(storeFile);
19
++                                             + "security" + sep +
20
++                                             "jssecacerts");
21
++                        if ((fis = getFileInputStream(storeFile)) == null) {
22
++                            storeFile = new File(javaHome + sep + "lib" + sep
23
++                                                 + "security" + sep +
24
++                                                 "cacerts");
25
++                            fis = getFileInputStream(storeFile);
26
++                        }
27
+                     }
28
+                 }
29
+ 
30
+diff -r 6b81fd2227d1 -r 3334efeacd83 src/share/classes/sun/security/tools/KeyStoreUtil.java
31
+--- a/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	Fri Apr 01 05:33:37 2016 +0100
32
+@@ -87,9 +87,14 @@
33
+         throws Exception
34
+     {
35
+         String sep = File.separator;
36
+-        File file = new File(System.getProperty("java.home") + sep
37
+-                             + "lib" + sep + "security" + sep
38
+-                             + "cacerts");
39
++        /* Check system cacerts DB first; /etc/pki/java/cacerts */
40
++        File file = new File(sep + "etc" + sep + "pki" + sep
41
++                             + "java" + sep + "cacerts");
42
++        if (!file.exists()) {
43
++            file = new File(System.getProperty("java.home") + sep
44
++                            + "lib" + sep + "security" + sep
45
++                            + "cacerts");
46
++        }
47
+         if (!file.exists()) {
48
+             return null;
49
+         }
50
+
0 51
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+--- a/jdk/make/CompileNativeLibraries.gmk       2017-04-07 20:06:07.668018356 +0000
1
+@@ -83,7 +83,7 @@
2
+
3
+ include lib/ServiceabilityLibraries.gmk
4
+
5
+-include lib/Awt2dLibraries.gmk
6
++#include lib/Awt2dLibraries.gmk
7
+
8
+ include lib/SoundLibraries.gmk
9
+
0 10
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+diff --git a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c
1
+--- openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/cmstypes.c
2
+@@ -1483,7 +1483,7 @@
3
+         if (!_cmsReadUInt32Number(io, &Offset)) goto Error;
4
+ 
5
+         // Check for overflow
6
+-        if (Offset < (SizeOfHeader + 8)) goto Error;
7
++        if ((Offset + Len) > SizeOfTag + :sunglasses: goto Error;
8
+ 
9
+         // True begin of the string
10
+         BeginOfThisString = Offset - SizeOfHeader - 8;
11
+
0 12
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+#java rpm macros
1
+%_java_exports        /etc/profile.d/java-exports.sh
2
+%_java_home %( [[ -f "%{_java_exports}" ]] && echo `cat "%{_java_exports}" | grep -m1 JAVA_HOME | cut -d'=' -f2` )
3
+#ant
4
+%_ant_exports        /etc/profile.d/apache-ant.sh
5
+%_ant_home %( [[ -f "%{_ant_exports}" ]] && echo `cat "%{_ant_exports}" | grep -m1 ANT_HOME | cut -d'=' -f2` )
6
+#maven
7
+%_maven_exports        /etc/profile.d/apache-maven.sh
8
+%_maven_home %( [[ -f "%{_maven_exports}" ]] && echo `cat "%{_maven_exports}" | grep -m1 MAVEN_HOME | cut -d'=' -f2` )
... ...
@@ -1,17 +1,30 @@
1 1
 %define _use_internal_dependency_generator 0
2
+%global security_hardening none
2 3
 Summary:	OpenJDK 
3 4
 Name:		openjdk
4
-Version:	1.8.0.112
5
+Version:	1.8.0.131
5 6
 Release:	1%{?dist}
6 7
 License:	GNU GPL
7 8
 URL:		https://openjdk.java.net
8 9
 Group:		Development/Tools
9 10
 Vendor:		VMware, Inc.
10 11
 Distribution:   Photon
11
-Source0:	http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK/OpenJDK-%{version}-x86_64-bin.tar.xz
12
-%define sha1 OpenJDK=c14a20158e16a8877940cfa6dbdf0900d4099a4a
12
+Source0:	http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK/openjdk-%{version}.tar.bz2
13
+%define sha1 openjdk=ae01c24fe5247d5aa246a60c0272ba92188a7d55
14
+Source1:    macros.java
15
+Patch0:		disable-awt-lib.patch
16
+Patch1:		fix-lcms.patch 
17
+Patch2:		Fix-memory-leak.patch
18
+Patch3:		check-system-ca-certs.patch
19
+BuildRequires:  pcre-devel
20
+BuildRequires:	which
21
+BuildRequires:	zip
22
+BuildRequires:	unzip
23
+BuildRequires:  zlib-devel
24
+BuildRequires:	ca-certificates
13 25
 Requires:       openjre = %{version}-%{release}
14 26
 AutoReqProv: 	no
27
+%define bootstrapjdkversion 1.8.0.112
15 28
 %description
16 29
 The OpenJDK package installs java class library and javac java compiler. 
17 30
 
... ...
@@ -45,14 +58,52 @@ This package provides the runtime library class sources.
45 45
 Requires:       %{name} = %{version}-%{release}
46 46
 
47 47
 %prep -p exit
48
-%setup -qn OpenJDK-%{version}-x86_64-bin
48
+%setup -q -n openjdk
49
+%patch0 -p1
50
+%patch1 -p1
51
+%patch2 -p1
52
+%patch3 -p1
53
+
49 54
 %build
55
+chmod a+x ./configure
56
+unset JAVA_HOME &&
57
+./configure \
58
+	FREETYPE_NOT_NEEDED=yes \
59
+	CUPS_NOT_NEEDED=yes \
60
+	--with-target-bits=64 \
61
+	--with-boot-jdk=/var/opt/OpenJDK-%bootstrapjdkversion-bin \
62
+	--enable-headful=no \
63
+	--with-cacerts-file=/var/opt/OpenJDK-%bootstrapjdkversion-bin/jre/lib/security/cacerts \
64
+	--with-extra-cxxflags="-Wno-error -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse" \
65
+	--with-extra-cflags="-std=gnu++98 -fno-delete-null-pointer-checks -Wno-error -fno-lifetime-dse" \
66
+	--with-stdc++lib=dynamic
67
+
68
+make \
69
+    DEBUG_BINARIES=true \
70
+    BUILD_HEADLESS_ONLY=yes \
71
+    OPENJDK_TARGET_OS=linux \
72
+    JAVAC_FLAGS=-g \
73
+    STRIP_POLICY=no_strip \
74
+    DISABLE_HOTSPOT_OS_VERSION_CHECK=ok \
75
+    CLASSPATH=/var/opt/OpenJDK-%bootstrapjdkversion-bin/jre \
76
+    POST_STRIP_CMD="" \
77
+    LOG=trace \
78
+    SCTP_WERROR=
50 79
 
51 80
 %install
52
-install -vdm755 %{buildroot}/var/opt/OpenJDK-%{version}-bin 
53
-mv -v %{_builddir}/OpenJDK-%{version}-x86_64-bin/* %{buildroot}/var/opt/OpenJDK-%{version}-bin/         
81
+make DESTDIR=%{buildroot} install \
82
+	BUILD_HEADLESS_ONLY=yes \
83
+	OPENJDK_TARGET_OS=linux \
84
+	DISABLE_HOTSPOT_OS_VERSION_CHECK=ok \
85
+	CLASSPATH=/var/opt/OpenJDK-%bootstrapjdkversion-bin/jre
86
+
87
+install -vdm755 %{buildroot}/var/opt/OpenJDK-%{version}-bin
54 88
 chown -R root:root %{buildroot}/var/opt/OpenJDK-%{version}-bin
89
+mkdir -p %{buildroot}/etc/profile.d
90
+install -vdm755 %{buildroot}%{_rpmconfigdir}/macros.d
91
+install -m 644 %{SOURCE1} %{buildroot}/%{_rpmconfigdir}/macros.d/
55 92
 install -vdm644 %{buildroot}/etc/profile.d
93
+mv /usr/local/jvm/openjdk-1.8.0-internal/* %{buildroot}/var/opt/OpenJDK-%{version}-bin/
56 94
 
57 95
 cat >> %{buildroot}/etc/profile.d/java-exports.sh <<- "EOF"
58 96
 export CLASSPATH=.:/usr/share/java
... ...
@@ -60,6 +111,11 @@ export JAVA_HOME=/var/opt/OpenJDK-%{version}-bin
60 60
 export PATH="$PATH:/var/opt/OpenJDK-%{version}-bin/bin:/var/opt/OpenJDK-%{version}-bin/jre/bin"
61 61
 EOF
62 62
 
63
+chmod a+x %{buildroot}/etc/profile.d/java-exports.sh
64
+
65
+%post
66
+source /etc/profile.d/java-exports.sh
67
+
63 68
 %clean
64 69
 rm -rf %{buildroot}/*
65 70
 
... ...
@@ -71,7 +127,6 @@ rm -rf %{buildroot}/*
71 71
 /var/opt/OpenJDK-%{version}-bin/THIRD_PARTY_README
72 72
 /var/opt/OpenJDK-%{version}-bin/lib
73 73
 /var/opt/OpenJDK-%{version}-bin/include/
74
-/var/opt/OpenJDK-%{version}-bin/bin/appletviewer
75 74
 /var/opt/OpenJDK-%{version}-bin/bin/extcheck
76 75
 /var/opt/OpenJDK-%{version}-bin/bin/idlj
77 76
 /var/opt/OpenJDK-%{version}-bin/bin/jar
... ...
@@ -95,7 +150,6 @@ rm -rf %{buildroot}/*
95 95
 /var/opt/OpenJDK-%{version}-bin/bin/jstack
96 96
 /var/opt/OpenJDK-%{version}-bin/bin/jstat
97 97
 /var/opt/OpenJDK-%{version}-bin/bin/jstatd
98
-/var/opt/OpenJDK-%{version}-bin/bin/mkcacerts
99 98
 /var/opt/OpenJDK-%{version}-bin/bin/native2ascii
100 99
 /var/opt/OpenJDK-%{version}-bin/bin/rmic
101 100
 /var/opt/OpenJDK-%{version}-bin/bin/schemagen
... ...
@@ -113,7 +167,6 @@ rm -rf %{buildroot}/*
113 113
 /var/opt/OpenJDK-%{version}-bin/bin/keytool
114 114
 /var/opt/OpenJDK-%{version}-bin/bin/orbd
115 115
 /var/opt/OpenJDK-%{version}-bin/bin/pack200
116
-/var/opt/OpenJDK-%{version}-bin/bin/policytool
117 116
 /var/opt/OpenJDK-%{version}-bin/bin/rmid
118 117
 /var/opt/OpenJDK-%{version}-bin/bin/rmiregistry
119 118
 /var/opt/OpenJDK-%{version}-bin/bin/servertool
... ...
@@ -121,6 +174,7 @@ rm -rf %{buildroot}/*
121 121
 /var/opt/OpenJDK-%{version}-bin/bin/unpack200
122 122
 /var/opt/OpenJDK-%{version}-bin/lib/amd64/jli/
123 123
 /etc/profile.d/java-exports.sh
124
+%{_rpmconfigdir}/macros.d/macros.java
124 125
 
125 126
 %files sample
126 127
 %defattr(-,root,root)
... ...
@@ -136,6 +190,10 @@ rm -rf %{buildroot}/*
136 136
 /var/opt/OpenJDK-%{version}-bin/src.zip
137 137
 
138 138
 %changelog
139
+*	Mon Apr 10 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.8.0.131-1
140
+-	Upgraded to version 1.8.0.131 and building Java from sources
141
+*       Tue Mar 28 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.8.0.112-2
142
+-       add java rpm macros
139 143
 *       Wed Dec 21 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.8.0.112-1
140 144
 -       Update to 1.8.0.112. addresses CVE-2016-5582 CVE-2016-5573
141 145
 *       Tue Oct 04 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.8.0.102-1
... ...
@@ -28,6 +28,7 @@ PHOTON_COMMON_DIR?=$(SRCROOT)/common
28 28
 PHOTON_DATA_DIR?=$(PHOTON_COMMON_DIR)/data
29 29
 PHOTON_SRCS_DIR=$(PHOTON_STAGE)/SOURCES
30 30
 PHOTON_PUBLISH_RPMS_DIR=$(PHOTON_STAGE)/PUBLISHRPMS
31
+PHOTON_PUBLISH_XRPMS_DIR=$(PHOTON_STAGE)/PUBLISHXRPMS
31 32
 PHOTON_GENERATED_DATA_DIR=$(PHOTON_STAGE)/common/data
32 33
 
33 34
 PHOTON_PKG_BUILDER_DIR=$(SRCROOT)/support/package-builder
... ...
@@ -41,6 +42,7 @@ PHOTON_SPECDEPS=$(PHOTON_SPECDEPS_DIR)/SpecDeps.py
41 41
 PHOTON_PACKAGE_BUILDER=$(PHOTON_PKG_BUILDER_DIR)/builder.py
42 42
 PHOTON_BINTRAY_CONFIG?=$(PHOTON_PKG_BUILDER_DIR)/pullsources.conf
43 43
 PHOTON_PULL_PUBLISH_RPMS=$(PHOTON_PULL_PUBLISH_RPMS_DIR)/pullpublishrpms.sh
44
+PHOTON_PULL_PUBLISH_X_RPMS=$(PHOTON_PULL_PUBLISH_RPMS_DIR)/pullpublishXrpms.sh
44 45
 PHOTON_CLOUD_IMAGE_BUILDER=$(PHOTON_CLOUD_IMAGE_BUILDER_DIR)/cloud-image-build.sh
45 46
 
46 47
 PHOTON_CHROOT_CLEANER=$(PHOTON_PKG_BUILDER_DIR)/clean-up-chroot.py
... ...
@@ -23,7 +23,7 @@ class PackageBuilder(object):
23 23
         self.listBuildOptionPackages=listBuildOptionPackages
24 24
         self.pkgBuildOptionFile=pkgBuildOptionFile
25 25
 
26
-    def prepareBuildRoot(self,chrootName,isToolChainPackage=False):
26
+    def prepareBuildRoot(self,chrootName,packageName, isToolChainPackage=False):
27 27
         chrootID=None
28 28
         try:
29 29
             chrUtils = ChrootUtils(self.logName,self.logPath)
... ...
@@ -35,7 +35,7 @@ class PackageBuilder(object):
35 35
 #            if isToolChainPackage:
36 36
 #                tUtils.installCoreToolChainPackages(chrootID)
37 37
 #            else:
38
-            tUtils.installToolChain(chrootID)
38
+            tUtils.installToolChain(chrootID, packageName)
39 39
         except Exception as e:
40 40
             if chrootID is not None:
41 41
                 self.logger.debug("Deleting chroot: " + chrootID)
... ...
@@ -99,7 +99,7 @@ class PackageBuilder(object):
99 99
         if package in constants.listToolChainPackages:
100 100
             isToolChainPackage=True
101 101
         try:
102
-            chrootID = self.prepareBuildRoot(chrootName,isToolChainPackage)
102
+            chrootID = self.prepareBuildRoot(chrootName, package, isToolChainPackage)
103 103
             destLogPath=constants.logPath+"/build-"+package
104 104
             if not os.path.isdir(destLogPath):
105 105
                 cmdUtils = CommandUtils()
... ...
@@ -80,7 +80,7 @@ class ToolChainUtils(object):
80 80
 
81 81
         self.logger.info("Successfully prepared chroot:"+chrootID)
82 82
 
83
-    def installToolChain(self,chrootID):
83
+    def installToolChain(self, chrootID, packageName):
84 84
         self.logger.info("Installing toolchain.....")
85 85
         self.prepareBuildRoot(chrootID)
86 86
         cmdUtils = CommandUtils()
... ...
@@ -113,7 +113,9 @@ class ToolChainUtils(object):
113 113
             self.logger.error("Installing toolchain rpms failed")
114 114
             raise Exception("RPM installation failed")
115 115
         
116
-        self.logger.info("Installed toolchain successfully on chroot:"+chrootID)
116
+        self.logger.info("Installed default toolchain successfully on chroot:"+chrootID)
117
+        if "openjdk" in packageName or "openjre" in packageName:
118
+            self.installToolChainXRPMS(chrootID);
117 119
     
118 120
     def installCoreToolChainPackages(self,chrootID):
119 121
         self.logger.info("Installing toolchain.....")
... ...
@@ -182,7 +184,7 @@ class ToolChainUtils(object):
182 182
                 if not returnVal:
183 183
                     self.logger.error("Creating chroot failed")
184 184
                     raise Exception("creating chroot failed")
185
-                self.installToolChainRPMS(chrootID)
185
+                self.installToolChainRPMS(chrootID, package)
186 186
                 pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath)
187 187
                 pkgUtils.buildRPMSForGivenPackage(package, chrootID, listBuildOptionPackages, pkgBuildOptionFile, destLogPath)
188 188
                 chrUtils.destroyChroot(chrootID)
... ...
@@ -196,7 +198,7 @@ class ToolChainUtils(object):
196 196
             traceback.print_exc()
197 197
             raise e
198 198
                 
199
-    def installToolChainRPMS(self,chrootID):
199
+    def installToolChainRPMS(self,chrootID, packageName):
200 200
         cmdUtils = CommandUtils()
201 201
         self.prepareBuildRoot(chrootID)
202 202
         self.logger.info("Installing Tool Chain RPMS.......")
... ...
@@ -227,5 +229,31 @@ class ToolChainUtils(object):
227 227
             self.logger.error("Installing tool chain  failed")
228 228
             raise Exception("RPM installation failed")
229 229
             
230
-        self.logger.info("Successfully installed all Tool Chain RPMS in Chroot:"+chrootID)    
231
-    
230
+        self.logger.info("Successfully installed default Tool Chain RPMS in Chroot:"+chrootID)
231
+        if "openjdk" in packageName or "openjre" in packageName:
232
+            self.installToolChainXRPMS(chrootID);
233
+   
234
+    def installToolChainXRPMS(self, chrootID):
235
+        self.logger.info("Installing Tool Chain X package RPMS.......")
236
+        rpmFiles = ""
237
+        packages = ""
238
+        for package in constants.listToolChainXRPMsToInstall:
239
+            pkgUtils=PackageUtils(self.logName,self.logPath)
240
+	    print "DEBUG:" + package
241
+            rpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishXRPMRepo)
242
+            if rpmFile is None:
243
+                self.logger.error("Unable to find rpm "+ package +" in current and previous versions")
244
+                raise Exception("Input Error")
245
+            rpmFiles += " " + rpmFile
246
+            packages += " " + package
247
+
248
+        self.logger.debug("Installing rpms:"+packages)
249
+	cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
250
+	print "Command Executed:" + cmd 
251
+        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
252
+        retval = process.wait()
253
+        if retval != 0:
254
+            self.logger.error("Installing tool chain  failed")
255
+            raise Exception("RPM installation failed")
256
+        self.logger.info("Successfully installed all Tool Chain X RPMS")
257
+ 
... ...
@@ -22,6 +22,7 @@ def main():
22 22
     parser.add_option("-r",  "--rpm-path",  dest="rpmPath",  default="../../stage/RPMS")
23 23
     parser.add_option("-i",  "--install-package", dest="installPackage",  default=False,  action ="store_true")
24 24
     parser.add_option("-p",  "--publish-RPMS-path", dest="publishRPMSPath",  default="../../stage/PUBLISHRPMS")
25
+    parser.add_option("-e",  "--publish-XRPMS-path", dest="publishXRPMSPath",  default="../../stage/PUBLISHXRPMS")
25 26
     parser.add_option("-l",  "--log-path", dest="logPath",  default="../../stage/LOGS")
26 27
     parser.add_option("-z",  "--top-dir-path", dest="topDirPath",  default="/usr/src/photon")
27 28
     parser.add_option("-b",  "--build-root-path", dest="buildRootPath",  default="/mnt")
... ...
@@ -59,15 +60,20 @@ def main():
59 59
     if not os.path.isdir(options.publishRPMSPath+"/x86_64"):
60 60
         logger.error("Given RPMS Path is missing x86_64 sub-directory:"+options.publishRPMSPath)
61 61
         errorFlag = True
62
+    if not os.path.isdir(options.publishXRPMSPath):
63
+        logger.error("Given X RPMS Path is not a directory:"+options.publishXRPMSPath)
64
+        errorFlag = True
62 65
     if not os.path.isdir(options.publishRPMSPath+"/noarch"):
63 66
         logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath)
64 67
         errorFlag = True
65
-
68
+    if not os.path.isdir(options.publishXRPMSPath+"/noarch"):
69
+        logger.error("Given X RPMS Path is missing noarch sub-directory:"+options.publishXRPMSPath)
70
+        errorFlag = True
66 71
     if not os.path.isfile(options.pkgBuildOptionFile):
67 72
         logger.warning("Given JSON File is not a file:"+options.pkgBuildOptionFile)
68 73
 
69 74
     if options.inputRPMSPath is not None and not os.path.isdir(options.inputRPMSPath):
70
-        logger.error("Given input RPMS Path is not a directory:"+options.publishRPMSPath)
75
+        logger.error("Given input RPMS Path is not a directory:"+options.inputRPMSPath)
71 76
         errorFlag = True
72 77
 
73 78
     if options.installPackage :
... ...
@@ -98,7 +104,7 @@ def main():
98 98
     logger.info("Log Path :" + options.logPath)
99 99
     logger.info("Top Dir Path :" + options.topDirPath)
100 100
     logger.info("Publish RPMS Path :" + options.publishRPMSPath)
101
-
101
+    logger.info("Publish X RPMS Path :" + options.publishXRPMSPath)
102 102
     if options.installPackage:
103 103
         logger.info("Package to build:"+package)
104 104
 
... ...
@@ -12,6 +12,7 @@ class constants(object):
12 12
     specData=None
13 13
     buildRootPath="/mnt"
14 14
     prevPublishRPMRepo=""
15
+    prevPublishXRPMRepo=""
15 16
     pullsourcesConfig=""
16 17
     buildPatch=False
17 18
     inputRPMSPath=""
... ...
@@ -100,6 +101,48 @@ class constants(object):
100 100
         "readline",
101 101
         "bash"]
102 102
 
103
+    # List of X library RPMS that will be installed in a chroot prior to build openjdk & openjre package. 
104
+    listToolChainXRPMsToInstall=[
105
+        "glib-devel",
106
+        "icu-devel",
107
+	"openjdk",
108
+	"openjre",
109
+        "icu",
110
+        "harfbuzz",
111
+        "harfbuzz-devel",
112
+        "freetype2",
113
+        "freetype2-devel",
114
+        "alsa-lib",
115
+        "alsa-lib-devel",
116
+        "xcb-proto",
117
+        "libXdmcp-devel",
118
+        "libXau-devel",
119
+        "util-macros",
120
+        "xtrans",
121
+        "libxcb-devel",
122
+        "fontconfig-devel",
123
+        "proto",
124
+        "libXdmcp",
125
+        "libxcb",
126
+        "libXau",
127
+        "fontconfig",
128
+        "xtrans-devel",
129
+        "libX11",
130
+        "libX11-devel",
131
+        "libXext",
132
+        "libXext-devel",
133
+        "libICE-devel",
134
+        "libSM",
135
+        "libICE",
136
+        "libSM-devel",
137
+        "libXt",
138
+        "libXmu",
139
+        "libXt-devel",
140
+        "libXmu-devel",
141
+        "libXrender",
142
+        "libXrender-devel"
143
+	]
144
+
103 145
     listToolChainRPMPkgsToInstall=[
104 146
         "linux-api-headers",
105 147
         "glibc",
... ...
@@ -264,7 +307,8 @@ class constants(object):
264 264
         constants.topDirPath = options.topDirPath
265 265
         constants.logPath = options.logPath
266 266
         constants.prevPublishRPMRepo=options.publishRPMSPath
267
-        constants.buildRootPath=options.buildRootPath
267
+        constants.prevPublishXRPMRepo = options.publishXRPMSPath
268
+	constants.buildRootPath=options.buildRootPath
268 269
         constants.specData = SerializableSpecObjectsUtils(constants.logPath)
269 270
         constants.specData.readSpecsAndConvertToSerializableObjects(constants.specPath)
270 271
         constants.pullsourcesConfig = options.pullsourcesConfig
271 272
new file mode 100755
... ...
@@ -0,0 +1,18 @@
0
+#!/bin/bash
1
+#################################################
2
+#	Title:	pullpublishxrpms.sh	   	#
3
+#        Date:	04-10-2017          		#
4
+#     Version:	1.0				#
5
+#      Author:	hudaiyakumar@vmware.com         #
6
+#################################################
7
+
8
+PRGNAME=${0##*/}
9
+
10
+if [ $# -lt 1 ]; then
11
+    echo "${PRGNAME}: No publish rpms path and log path are specified. Usage : ${PRGNAME} <publish-rpms-path>"
12
+    exit 1
13
+fi
14
+
15
+PUBLISHRPMSPATHDIR=$1
16
+
17
+cat xrpmfilelist | awk '{print "https://bintray.com/artifact/download/vmware/photon_publish_x_rpms/"$1}' | xargs -n 1 -P 10 wget --user-agent Mozilla/4.0 -c -nv -nc -r -nH --cut-dirs=4 -P ${PUBLISHRPMSPATHDIR}
0 18
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+noarch/proto-7.7-1.noarch.rpm
1
+noarch/util-macros-1.19.0-1.noarch.rpm
2
+x86_64/openjdk-1.8.0.112-1.x86_64.rpm
3
+x86_64/openjre-1.8.0.112-1.x86_64.rpm
4
+x86_64/alsa-lib-1.0.29-1.x86_64.rpm
5
+x86_64/alsa-lib-devel-1.0.29-1.x86_64.rpm
6
+x86_64/fontconfig-2.11.1-1.x86_64.rpm
7
+x86_64/fontconfig-devel-2.11.1-1.x86_64.rpm
8
+x86_64/freetype2-2.5.5-1.x86_64.rpm
9
+x86_64/freetype2-devel-2.5.5-1.x86_64.rpm
10
+x86_64/glib-2.48.2-1.ph1.x86_64.rpm
11
+x86_64/glib-devel-2.48.2-1.ph1.x86_64.rpm
12
+x86_64/harfbuzz-0.9.40-1.x86_64.rpm
13
+x86_64/harfbuzz-devel-0.9.40-1.x86_64.rpm
14
+x86_64/icu-55.1-1.x86_64.rpm
15
+x86_64/icu-devel-55.1-1.x86_64.rpm
16
+x86_64/libICE-1.0.9-1.x86_64.rpm
17
+x86_64/libICE-devel-1.0.9-1.x86_64.rpm
18
+x86_64/libSM-1.2.2-1.x86_64.rpm
19
+x86_64/libSM-devel-1.2.2-1.x86_64.rpm
20
+x86_64/libX11-1.6.3-1.x86_64.rpm
21
+x86_64/libX11-devel-1.6.3-1.x86_64.rpm
22
+x86_64/libXau-1.0.8-1.x86_64.rpm
23
+x86_64/libXau-devel-1.0.8-1.x86_64.rpm
24
+x86_64/libXdmcp-1.1.2-1.x86_64.rpm
25
+x86_64/libXdmcp-devel-1.1.2-1.x86_64.rpm
26
+x86_64/libXext-1.3.3-1.x86_64.rpm
27
+x86_64/libXext-devel-1.3.3-1.x86_64.rpm
28
+x86_64/libXmu-1.1.2-1.x86_64.rpm
29
+x86_64/libXmu-devel-1.1.2-1.x86_64.rpm
30
+x86_64/libXrender-0.9.8-1.x86_64.rpm
31
+x86_64/libXrender-devel-0.9.8-1.x86_64.rpm
32
+x86_64/libXt-1.1.4-1.x86_64.rpm
33
+x86_64/libXt-devel-1.1.4-1.x86_64.rpm
34
+x86_64/libxcb-1.11-1.x86_64.rpm
35
+x86_64/libxcb-devel-1.11-1.x86_64.rpm
36
+x86_64/xcb-proto-1.11-1.x86_64.rpm
37
+x86_64/xtrans-1.3.5-1.x86_64.rpm
38
+x86_64/xtrans-devel-1.3.5-1.x86_64.rpm