Include a test in the RPM to check the build has the correct vendor information.
This commit is contained in:
parent
0b8fc9968d
commit
3fa84eff00
57
CheckVendor.java
Normal file
57
CheckVendor.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/* CheckVendor -- Check the vendor properties match specified values.
|
||||||
|
Copyright (C) 2020 Red Hat, Inc.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public class CheckVendor {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if (args.length < 3) {
|
||||||
|
System.err.println("CheckVendor <VENDOR> <VENDOR-URL> <VENDOR-BUG-URL>");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String vendor = System.getProperty("java.vendor");
|
||||||
|
String expectedVendor = args[0];
|
||||||
|
String vendorURL = System.getProperty("java.vendor.url");
|
||||||
|
String expectedVendorURL = args[1];
|
||||||
|
String vendorBugURL = System.getProperty("java.vendor.url.bug");
|
||||||
|
String expectedVendorBugURL = args[2];
|
||||||
|
|
||||||
|
if (!expectedVendor.equals(vendor)) {
|
||||||
|
System.err.printf("Invalid vendor %s, expected %s\n",
|
||||||
|
vendor, expectedVendor);
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!expectedVendorURL.equals(vendorURL)) {
|
||||||
|
System.err.printf("Invalid vendor URL %s, expected %s\n",
|
||||||
|
vendorURL, expectedVendorURL);
|
||||||
|
System.exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!expectedVendorBugURL.equals(vendorBugURL)) {
|
||||||
|
System.err.printf("Invalid vendor bug URL%s, expected %s\n",
|
||||||
|
vendorBugURL, expectedVendorBugURL);
|
||||||
|
System.exit(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.err.printf("Vendor information verified as %s, %s, %s\n",
|
||||||
|
vendor, vendorURL, vendorBugURL);
|
||||||
|
}
|
||||||
|
}
|
@ -290,6 +290,26 @@
|
|||||||
%global lts_designator_zip ""
|
%global lts_designator_zip ""
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# Define vendor information used by OpenJDK
|
||||||
|
%global oj_vendor Red Hat, Inc.
|
||||||
|
%global oj_vendor_url "https://www.redhat.com/"
|
||||||
|
# Define what url should JVM offer in case of a crash report
|
||||||
|
# order may be important, epel may have rhel declared
|
||||||
|
%if 0%{?epel}
|
||||||
|
%global oj_vendor_bug_url https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora%20EPEL&component=%{name}&version=epel%{epel}
|
||||||
|
%else
|
||||||
|
%if 0%{?fedora}
|
||||||
|
# Does not work for rawhide, keeps the version field empty
|
||||||
|
%global oj_vendor_bug_url https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=%{name}&version=%{fedora}
|
||||||
|
%else
|
||||||
|
%if 0%{?rhel}
|
||||||
|
%global oj_vendor_bug_url https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%20%{rhel}&component=%{name}
|
||||||
|
%else
|
||||||
|
%global oj_vendor_bug_url https://bugzilla.redhat.com/enter_bug.cgi
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
# Define IcedTea version used for SystemTap tapsets and desktop file
|
# Define IcedTea version used for SystemTap tapsets and desktop file
|
||||||
%global icedteaver 3.15.0
|
%global icedteaver 3.15.0
|
||||||
|
|
||||||
@ -340,23 +360,6 @@
|
|||||||
%global eaprefix 0.
|
%global eaprefix 0.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Define what url should JVM offer in case of a crash report
|
|
||||||
# order may be important, epel may have rhel declared
|
|
||||||
%if 0%{?epel}
|
|
||||||
%global bugs https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora%20EPEL&component=%{name}&version=epel%{epel}
|
|
||||||
%else
|
|
||||||
%if 0%{?fedora}
|
|
||||||
# Does not work for rawhide, keeps the version field empty
|
|
||||||
%global bugs https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=%{name}&version=%{fedora}
|
|
||||||
%else
|
|
||||||
%if 0%{?rhel}
|
|
||||||
%global bugs https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%20%{rhel}&component=%{name}
|
|
||||||
%else
|
|
||||||
%global bugs https://bugzilla.redhat.com/enter_bug.cgi
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# parametrized macros are order-sensitive
|
# parametrized macros are order-sensitive
|
||||||
%global compatiblename java-%{featurever}-%{origin}
|
%global compatiblename java-%{featurever}-%{origin}
|
||||||
%global fullversion %{compatiblename}-%{version}-%{release}
|
%global fullversion %{compatiblename}-%{version}-%{release}
|
||||||
@ -1146,6 +1149,9 @@ Source14: TestECDSA.java
|
|||||||
# Verify system crypto (policy) can be disabled via a property
|
# Verify system crypto (policy) can be disabled via a property
|
||||||
Source15: TestSecurityProperties.java
|
Source15: TestSecurityProperties.java
|
||||||
|
|
||||||
|
# Ensure vendor settings are correct
|
||||||
|
Source16: CheckVendor.java
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
#
|
#
|
||||||
# RPM/distribution specific patches
|
# RPM/distribution specific patches
|
||||||
@ -1660,10 +1666,10 @@ bash ../configure \
|
|||||||
--with-version-pre="%{ea_designator}" \
|
--with-version-pre="%{ea_designator}" \
|
||||||
--with-version-opt=%{lts_designator} \
|
--with-version-opt=%{lts_designator} \
|
||||||
--with-vendor-version-string="%{vendor_version_string}" \
|
--with-vendor-version-string="%{vendor_version_string}" \
|
||||||
--with-vendor-name="Red Hat, Inc." \
|
--with-vendor-name="%{oj_vendor}" \
|
||||||
--with-vendor-url="https://www.redhat.com/" \
|
--with-vendor-url="%{oj_vendor_url}" \
|
||||||
--with-vendor-bug-url="%{bugs}" \
|
--with-vendor-bug-url="%{oj_vendor_bug_url}" \
|
||||||
--with-vendor-vm-bug-url="%{bugs}" \
|
--with-vendor-vm-bug-url="%{oj_vendor_bug_url}" \
|
||||||
--with-boot-jdk=/usr/lib/jvm/java-%{buildjdkver}-openjdk \
|
--with-boot-jdk=/usr/lib/jvm/java-%{buildjdkver}-openjdk \
|
||||||
--with-debug-level=$debugbuild \
|
--with-debug-level=$debugbuild \
|
||||||
--with-native-debug-symbols=internal \
|
--with-native-debug-symbols=internal \
|
||||||
@ -1763,6 +1769,10 @@ nm $JAVA_HOME/bin/%{alt_java_name} | grep set_speculation
|
|||||||
if ! nm $JAVA_HOME/bin/%{alt_java_name} | grep set_speculation ; then true ; else false; fi
|
if ! nm $JAVA_HOME/bin/%{alt_java_name} | grep set_speculation ; then true ; else false; fi
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# Check correct vendor values have been set
|
||||||
|
$JAVA_HOME/bin/javac -d . %{SOURCE16}
|
||||||
|
$JAVA_HOME/bin/java $(echo $(basename %{SOURCE16})|sed "s|\.java||") "%{oj_vendor}" %{oj_vendor_url} %{oj_vendor_bug_url}
|
||||||
|
|
||||||
# Check debug symbols in static libraries (smoke test)
|
# Check debug symbols in static libraries (smoke test)
|
||||||
export STATIC_LIBS_HOME=$(pwd)/%{buildoutputdir -- $suffix}/images/%{static_libs_image}
|
export STATIC_LIBS_HOME=$(pwd)/%{buildoutputdir -- $suffix}/images/%{static_libs_image}
|
||||||
readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep w_remainder.c
|
readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep w_remainder.c
|
||||||
@ -2189,6 +2199,9 @@ require "copy_jdk_configs.lua"
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Jan 24 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.10.0.8-0.4.ea
|
||||||
|
- Include a test in the RPM to check the build has the correct vendor information.
|
||||||
|
|
||||||
* Sun Jan 24 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.10.0.8-0.4.ea
|
* Sun Jan 24 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.10.0.8-0.4.ea
|
||||||
- Update build documentation to reflect this is java-11-openjdk, not java-1.8.0-openjdk
|
- Update build documentation to reflect this is java-11-openjdk, not java-1.8.0-openjdk
|
||||||
- Remove redundant closure and immediate reopening of include_normal_build block.
|
- Remove redundant closure and immediate reopening of include_normal_build block.
|
||||||
|
Loading…
Reference in New Issue
Block a user