Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JDK23 For September 2023 CPU #998

Merged
merged 9 commits into from
Sep 19, 2024
24 changes: 19 additions & 5 deletions linux/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pipeline {
}
parameters {
choice(name: 'TYPE', choices: Types.ALL, description: 'Build JDK or JRE')
choice(name: 'VERSION', choices: ['8', '11', '17', '21', '22'], description: 'Build for specific JDK VERSION')
choice(name: 'VERSION', choices: ['8', '11', '17', '21', '22', '23'], description: 'Build for specific JDK VERSION')
choice(name: 'ARCH', choices: ['x86_64', 'armv7hl', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'riscv64', 'all'], description: 'Build for specific platform\n s390x not for VERSION 8\n Use armv7l for DebARM32 armv7hl for RH/Suse')
choice(name: 'DISTRO', choices: ['all', 'Alpine', 'Debian', 'RedHat', 'Suse'], description: 'Build for specific Distro\n Select RPM builds for RedHat and Suse')
booleanParam(name: 'uploadPackage', defaultValue: false, description: 'Tick this box to upload the deb/rpm files (exclude src.rpm) to Artifactory for official release')
Expand Down Expand Up @@ -259,6 +259,9 @@ def jenkinsStepDeb() {
// for one single ARCH add into array
debArchAllList.add("${ARCH}")

// Due to the jenkinsfile issues with string/numberic comparisons
// The individual if statements ensure stability and consistency

// when ARCH = all, rewrite list
if ("${ARCH}" == 'all') {
debArchAllList = ['x86_64', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'riscv64']
Expand All @@ -279,6 +282,10 @@ def jenkinsStepDeb() {
if ("${VERSION}" == '22' && "${ARCH}" == 'all') {
debArchAllList = ['x86_64', 'aarch64', 'ppc64le', 's390x', 'riscv64']
}
// remove Arm32 & add riscv64 for JDK23
if ("${VERSION}" == '23' && "${ARCH}" == 'all') {
debArchAllList = ['x86_64', 'aarch64', 'ppc64le', 's390x', 'riscv64']
}

debArchAllList.each { DebARCH ->
// special handle: no label x86_64 only x64 for debian agent
Expand Down Expand Up @@ -413,6 +420,9 @@ def buildAndTest(String DISTRO, String buildArch, String VERSION) {
case "22":
debArchList.remove('armv7l')
break
case "23":
debArchList.remove('armv7l')
break
default:
// Handle Any other cases by defaulting to the main list.
break
Expand Down Expand Up @@ -490,7 +500,7 @@ def uploadDebArtifacts(String buildArch, String Version) {
'riscv64' : 'riscv64'
]

if (['8', '11', '17', '21', '22'].contains(VERSION)) {
if (['8', '11', '17', '21', '22', '23'].contains(VERSION)) {
debArchList = [
'x86_64' : 'amd64',
'armv7l': 'armhf',
Expand All @@ -499,8 +509,8 @@ def uploadDebArtifacts(String buildArch, String Version) {
's390x' : 's390x',
'riscv64' : 'riscv64'
]
if (['21', '22'].contains(VERSION)) {
debArchList.remove('armv7l') // Removing armv7l for versions 21 and 22
if (['21', '22', '23'].contains(VERSION)) {
debArchList.remove('armv7l') // Removing armv7l for versions 21,22,23
}
if (VERSION == "8") {
debArchList.remove('s390x') // Removing s390x for version 8
Expand All @@ -513,7 +523,7 @@ def uploadDebArtifacts(String buildArch, String Version) {
echo "Debian Architecture Upload List = ${debArchList}"

/*
Debian/Ubuntu 10.0 11.0 16.04 20.04 22.04 22.10
Debian/Ubuntu 10.0 11.0 16.04 20.04 22.04 22.10 24.04
add more into list when available for release
also update linux/{jdk,jre}/debian/main/packing/build.sh
*/
Expand Down Expand Up @@ -611,6 +621,10 @@ def uploadRpmArtifacts(String DISTRO, String rpmArch, String Version) {
rpmArchList['s390x'] = 's390x'
rpmArchList['riscv64'] = 'riscv64'
}
if (VERSION == '23') {
rpmArchList['s390x'] = 's390x'
rpmArchList['riscv64'] = 'riscv64'
}

if ("${rpmArch}" != 'all') {
// when only build and upload one arch, reset
Expand Down
112 changes: 112 additions & 0 deletions linux/jdk/alpine/src/main/packaging/temurin/23/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Maintainer: Eclipse Adoptium Package Maintainers <[email protected]>
pkgname=temurin-23
pkgver=23_p37
# replace _p1 with _1
_pkgver=${pkgver/_p/_}
_pkgverplus=${pkgver/_p/+}
_pkgvername=${_pkgverplus/+/%2B}
pkgrel=1
pkgdesc="Eclipse Temurin 23"
provider_priority=23
url="https://adoptium.net"
arch="aarch64 x86_64"
license="GPL-2.0-with-classpath-exception"
makedepends="
alsa-lib-dev
freetype-dev
libffi-dev
libjpeg-turbo-dev
libx11-dev
libxext-dev
libxrandr-dev
libxrender-dev
libxt-dev
libxtst-dev
"
depends=""
subpackages="$pkgname-src:_src:noarch
$pkgname-jdk:_jdk"
source="
https://github.com/adoptium/temurin23-binaries/releases/download/jdk-$_pkgvername/OpenJDK23u-jdk_${CARCH/x86_64/x64}_alpine-linux_hotspot_$_pkgver.tar.gz

HelloWorld.java
TestECDSA.java
TestCryptoLevel.java
"

_java_home="/usr/lib/jvm/java-23-temurin"

ldpath="$_java_home/lib:$_java_home/lib/server"
sonameprefix="$pkgname:"

prepare() {
default_prepare
}

check() {
local _java_bin="./jdk-$_pkgverplus/bin"

# 1) compile and run a simple hello world
$_java_bin/javac -d . "$srcdir"/HelloWorld.java
$_java_bin/java HelloWorld

# 2) compile and run a testcase for unlimited policy
$_java_bin/javac -d . "$srcdir"/TestCryptoLevel.java
$_java_bin/java -cp . --add-opens java.base/javax.crypto=ALL-UNNAMED TestCryptoLevel

# 3) compile and run a testcase for ECDSA signatures
$_java_bin/javac -d . "$srcdir"/TestECDSA.java
$_java_bin/java TestECDSA
}

package() {
mkdir -p "$pkgdir/$_java_home"
cp -r "$srcdir"/jdk-"$_pkgverplus"/* "$pkgdir/$_java_home"
}

_src() {
pkgdesc="Eclipse Temurin 23 (sources)"
mkdir -p "$subpkgdir/$_java_home"/lib
mv "$pkgdir"/$_java_home/lib/src.zip \
"$subpkgdir"/$_java_home/lib/
}

_jdk() {
pkgdesc="Eclipse Temurin 23 (JDK)"
provides="java-jdk java-jre"
depends="java-common java-cacerts"
_fromroot="$pkgdir/$_java_home"
_toroot="$subpkgdir/$_java_home"

mkdir -p "$_toroot"
mv "$_fromroot/bin" "$_toroot"
mv "$_fromroot/conf" "$_toroot"
mv "$_fromroot/include" "$_toroot"
mv "$_fromroot/jmods" "$_toroot"
mv "$_fromroot/legal" "$_toroot"
mv "$_fromroot/lib" "$_toroot"
mv "$_fromroot/man" "$_toroot"
mv "$_fromroot/release" "$_toroot"
mv "$_fromroot/NOTICE" "$_toroot"

# symlink to shared cacerts store
rm "$_toroot/lib/security/cacerts"
ln -sf /etc/ssl/certs/java/cacerts \
"$_toroot/lib/security/cacerts"
}

case "$CARCH" in
x86_64)
_arch_sum="bff4c78f30d8d173e622bf2f40c36113df47337fc6d1ee5105ed2459841165aa"
;;
aarch64)
_arch_sum="7e842c9b8a44a5a21d83a3e38ae3b141cfbdb429dde70ff264d3da4bff44e1c7"
;;
esac

sha256sums="
$_arch_sum OpenJDK23u-jdk_${CARCH/x86_64/x64}_alpine-linux_hotspot_$_pkgver.tar.gz
e9185736dde99a4dc570a645a20407bdb41c1f48dfc34d9c3eb246cf0435a378 HelloWorld.java
22d2ff9757549ebc64e09afd3423f84b5690dcf972cd6535211c07c66d38fab0 TestCryptoLevel.java
9fb00c7b0220de8f3ee2aa398459a37d119f43fd63321530a00b3bb9217dd933 TestECDSA.java
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class HelloWorld {
public static void main(String[] args) { System.out.println("Hello World!"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* TestCryptoLevel -- Ensure unlimited crypto policy is in use.
Copyright (C) 2012 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/>.
*/

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;

import java.security.Permission;
import java.security.PermissionCollection;

public class TestCryptoLevel
{
public static void main(String[] args)
throws NoSuchFieldException, ClassNotFoundException,
IllegalAccessException, InvocationTargetException
{
Class<?> cls = null;
Method def = null, exempt = null;

try
{
cls = Class.forName("javax.crypto.JceSecurity");
}
catch (ClassNotFoundException ex)
{
System.err.println("Running a non-Sun JDK.");
System.exit(0);
}
try
{
def = cls.getDeclaredMethod("getDefaultPolicy");
exempt = cls.getDeclaredMethod("getExemptPolicy");
}
catch (NoSuchMethodException ex)
{
System.err.println("Running IcedTea with the original crypto patch.");
System.exit(0);
}
def.setAccessible(true);
exempt.setAccessible(true);
PermissionCollection defPerms = (PermissionCollection) def.invoke(null);
PermissionCollection exemptPerms = (PermissionCollection) exempt.invoke(null);
Class<?> apCls = Class.forName("javax.crypto.CryptoAllPermission");
Field apField = apCls.getDeclaredField("INSTANCE");
apField.setAccessible(true);
Permission allPerms = (Permission) apField.get(null);
if (defPerms.implies(allPerms) && (exemptPerms == null || exemptPerms.implies(allPerms)))
{
System.err.println("Running with the unlimited policy.");
System.exit(0);
}
else
{
System.err.println("WARNING: Running with a restricted crypto policy.");
System.exit(-1);
}
}
}
49 changes: 49 additions & 0 deletions linux/jdk/alpine/src/main/packaging/temurin/23/TestECDSA.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* TestECDSA -- Ensure ECDSA signatures are working.
Copyright (C) 2016 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/>.
*/

import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.Signature;

/**
* @test
*/
public class TestECDSA {

public static void main(String[] args) throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
KeyPair key = keyGen.generateKeyPair();

byte[] data = "This is a string to sign".getBytes("UTF-8");

Signature dsa = Signature.getInstance("NONEwithECDSA");
dsa.initSign(key.getPrivate());
dsa.update(data);
byte[] sig = dsa.sign();
System.out.println("Signature: " + new BigInteger(1, sig).toString(16));

Signature dsaCheck = Signature.getInstance("NONEwithECDSA");
dsaCheck.initVerify(key.getPublic());
dsaCheck.update(data);
boolean success = dsaCheck.verify(sig);
if (!success) {
throw new RuntimeException("Test failed. Signature verification error");
}
System.out.println("Test passed.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
temurin-23-jdk (23.0.0.0.0+37) STABLE; urgency=medium

* Eclipse Temurin 23.0.0.0.0+37 release.

-- Eclipse Adoptium Package Maintainers <[email protected]> Wed, 18 Sep 2024 00:00:00 +0000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
Loading