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 initial JDK20 packaging with default versions #627

Merged
merged 2 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion linux/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pipeline {
}
parameters {
choice(name: 'TYPE', choices: Types.ALL, description: 'Build JDK or JRE')
choice(name: 'VERSION', choices: ['8', '11', '17', '19'], description: 'Build for specific JDK VERSION')
choice(name: 'VERSION', choices: ['8', '11', '17', '20'], description: 'Build for specific JDK VERSION')
choice(name: 'ARCH', choices: ['x86_64', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'all'], description: 'Build for specific platform\n s390x not for VERSION 8\n')
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
98 changes: 98 additions & 0 deletions linux/jdk/alpine/src/main/packaging/temurin/20/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Maintainer: Eclipse Adoptium Package Maintainers <temurin-dev@eclipse.org>
pkgname=temurin-20
pkgver=20.0.0_p1
# replace _p1 with _1
_pkgver=${pkgver/_p/_}
# _pkgver=19_36 # remove this line and uncomment the above line when the next version is released
_pkgverplus=${pkgver/_p/+}
# _pkgverplus=19+36 # remove this line and uncomment the above line when the next version is released
_pkgvername=${_pkgverplus/+/%2B}
pkgrel=0
pkgdesc="Eclipse Temurin 20"
provider_priority=20
url="https://adoptium.net"
arch="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="$pkgname-jdk" # for the virtual package
subpackages="$pkgname-src:_src:noarch
$pkgname-jdk:_jdk"
source="https://github.com/adoptium/20-binaries/releases/download/jdk-$_pkgvername/OpenJDK20U-jdk_x64_alpine-linux_hotspot_$_pkgver.tar.gz

HelloWorld.java
TestECDSA.java
TestCryptoLevel.java
"

_java_home="/usr/lib/jvm/java-19-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 20 (sources)"
mkdir -p "$subpkgdir/$_java_home"/lib
mv "$pkgdir"/$_java_home/lib/src.zip \
"$subpkgdir"/$_java_home/lib/
}

_jdk() {
pkgdesc="Eclipse Temurin 20 (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/lib" "$_toroot"
mv "$_fromroot/include" "$_toroot"

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

sha256sums="
e2d971400ad2db25ad43ea6fa2058b269c0236e3977986dcdee2097da301beb2 OpenJDK20U-jdk_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/20/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-20-jdk (20.0.0.0.0+1) STABLE; urgency=medium

* Eclipse Temurin 20.0.0.0.0+1 release.

-- Eclipse Adoptium Package Maintainers <temurin-dev@eclipse.org> Wed, 22 Mar 2023 09:43:20 +0000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
96 changes: 96 additions & 0 deletions linux/jdk/debian/src/main/packaging/temurin/20/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Source: temurin-20-jdk
Section: java
Priority: optional
Maintainer: Eclipse Adoptium Package Maintainers <temurin-dev@eclipse.org>
Build-Depends: debhelper (>= 11), lsb-release

Package: temurin-20-jdk
Architecture: amd64 armhf arm64 ppc64el s390x
Depends: adoptium-ca-certificates,
java-common,
libasound2,
libc6,
libx11-6,
libfontconfig1,
libfreetype6,
libxext6,
libxi6,
libxrender1,
libxtst6,
zlib1g
Recommends: fonts-dejavu-core,
fonts-dejavu-extra
Provides: java-compiler,
java-sdk,
java-sdk-headless,
java10-sdk,
java11-sdk,
java12-sdk,
java13-sdk,
java14-sdk,
java15-sdk,
java16-sdk,
java17-sdk,
java18-sdk,
java2-sdk,
java5-sdk,
java6-sdk,
java7-sdk,
java8-sdk,
java9-sdk,
java10-sdk-headless,
java11-sdk-headless,
java12-sdk-headless,
java13-sdk-headless,
java14-sdk-headless,
java15-sdk-headless,
java16-sdk-headless,
java17-sdk-headless,
java18-sdk-headless,
java19-sdk-headless,
java2-sdk-headless,
java20-sdk-headless,
java5-sdk-headless,
java6-sdk-headless,
java7-sdk-headless,
java8-sdk-headless,
java9-sdk-headless,
java-runtime,
java-runtime-headless,
java10-runtime,
java11-runtime,
java12-runtime,
java13-runtime,
java14-runtime,
java15-runtime,
java16-runtime,
java17-runtime,
java18-runtime,
java19-runtime,
java2-runtime,
java20-runtime,
java5-runtime,
java6-runtime,
java7-runtime,
java8-runtime,
java9-runtime,
java10-runtime-headless,
java11-runtime-headless,
java12-runtime-headless,
java13-runtime-headless,
java14-runtime-headless,
java15-runtime-headless,
java16-runtime-headless,
java17-runtime-headless,
java18-runtime-headless,
java19-runtime-headless,
java2-runtime-headless,
java20-runtime-headless,
java5-runtime-headless,
java6-runtime-headless,
java7-runtime-headless,
java8-runtime-headless,
java9-runtime-headless
Description: Eclipse Temurin 20 JDK
Eclipse Temurin JDK is an OpenJDK-based development environment to create
applications and components using the programming language Java.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: *
Copyright: Oracle and/or its affiliates
License: GPL-2.0+CE
36 changes: 36 additions & 0 deletions linux/jdk/debian/src/main/packaging/temurin/20/debian/jinfo.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name=@pkg_alias@
alias=@pkg_alias@
priority=@priority@
section=contrib

jdkhl jar /usr/lib/jvm/@jvm_dir@/bin/jar
jdkhl jarsigner /usr/lib/jvm/@jvm_dir@/bin/jarsigner
hl java /usr/lib/jvm/@jvm_dir@/bin/java
jdkhl javac /usr/lib/jvm/@jvm_dir@/bin/javac
jdkhl javadoc /usr/lib/jvm/@jvm_dir@/bin/javadoc
jdkhl javap /usr/lib/jvm/@jvm_dir@/bin/javap
jdkhl jcmd /usr/lib/jvm/@jvm_dir@/bin/jcmd
jdk jconsole /usr/lib/jvm/@jvm_dir@/bin/jconsole
jdkhl jdb /usr/lib/jvm/@jvm_dir@/bin/jdb
jdkhl jdeprscan /usr/lib/jvm/@jvm_dir@/bin/jdeprscan
jdkhl jdeps /usr/lib/jvm/@jvm_dir@/bin/jdeps
hl jfr /usr/lib/jvm/@jvm_dir@/bin/jfr
jdkhl jhsdb /usr/lib/jvm/@jvm_dir@/bin/jhsdb
jdkhl jimage /usr/lib/jvm/@jvm_dir@/bin/jimage
jdkhl jinfo /usr/lib/jvm/@jvm_dir@/bin/jinfo
jdkhl jlink /usr/lib/jvm/@jvm_dir@/bin/jlink
jdkhl jmap /usr/lib/jvm/@jvm_dir@/bin/jmap
jdkhl jmod /usr/lib/jvm/@jvm_dir@/bin/jmod
jdkhl jpackage /usr/lib/jvm/@jvm_dir@/bin/jpackage
jdkhl jps /usr/lib/jvm/@jvm_dir@/bin/jps
hl jrunscript /usr/lib/jvm/@jvm_dir@/bin/jrunscript
jdkhl jshell /usr/lib/jvm/@jvm_dir@/bin/jshell
jdkhl jstack /usr/lib/jvm/@jvm_dir@/bin/jstack
jdkhl jstat /usr/lib/jvm/@jvm_dir@/bin/jstat
jdkhl jstatd /usr/lib/jvm/@jvm_dir@/bin/jstatd
jdkhl jwebserver /usr/lib/jvm/@jvm_dir@/bin/jwebserver
hl keytool /usr/lib/jvm/@jvm_dir@/bin/keytool
hl rmiregistry /usr/lib/jvm/@jvm_dir@/bin/rmiregistry
jdkhl serialver /usr/lib/jvm/@jvm_dir@/bin/serialver
hl jexec /usr/lib/jvm/@jvm_dir@/lib/jexec
hl jspawnhelper /usr/lib/jvm/@jvm_dir@/lib/jspawnhelper
Loading