forked from adoptium/installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> adoptium#430
- Loading branch information
Gerd Aschemann
committed
Jan 14, 2023
1 parent
e8dea4e
commit 04e4dd6
Showing
22 changed files
with
662 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tasks.register("packageJre") { | ||
group = "packaging" | ||
description = "Creates Linux packages of a JRE." | ||
} | ||
|
||
tasks.register("checkJrePackage") { | ||
description = "Tests the generated JRE packages." | ||
group = "verification" | ||
} | ||
|
||
rootProject.package.dependsOn(packageJre) | ||
rootProject.checkPackage.dependsOn(checkJrePackage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
plugins { | ||
id "java" | ||
} | ||
|
||
ext { | ||
junitVersion = "5.9.1" | ||
testcontainersVersion = "1.17.6" | ||
assertjCoreVersion = "3.24.1" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
group "org.adoptium" | ||
version "1.0.0-SNAPSHOT" | ||
|
||
/* | ||
* The versions list defines the Debian and Ubuntu versions that this package is uploaded to. | ||
* | ||
* If a version like sid is missing here, the package won't be included in the sid repository and therefore not | ||
* installable via apt. Never use suite names like testing or unstable. This list is usually bigger than the list | ||
* of versions we test with as defined by the class DebianFlavours in the source set packageTest. | ||
* | ||
* **Attention**: If you alter the list, check if the class DebianFlavours needs to be updated, too. | ||
*/ | ||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
sourceSets { | ||
packageTest { | ||
compileClasspath += sourceSets.main.output | ||
runtimeClasspath += sourceSets.main.output | ||
} | ||
} | ||
|
||
configurations { | ||
packageTestImplementation.extendsFrom implementation | ||
packageTestRuntimeOnly.extendsFrom runtimeOnly | ||
} | ||
|
||
dependencies { | ||
packageTestImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" | ||
packageTestImplementation "org.testcontainers:testcontainers:$testcontainersVersion" | ||
packageTestImplementation "org.testcontainers:junit-jupiter:$testcontainersVersion" | ||
packageTestImplementation "org.assertj:assertj-core:$assertjCoreVersion" | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events "passed", "skipped", "failed" | ||
} | ||
} | ||
|
||
task packageJreDebian { | ||
dependsOn "assemble" | ||
|
||
group = "packaging" | ||
description = "Creates deb JRE package for Debian flavours." | ||
|
||
def outputDir = new File(project.buildDir.absolutePath, "ospackage") | ||
outputs.dir(outputDir) | ||
|
||
def product = getProduct() | ||
def productVersion = getProductVersion() | ||
def arch = getArch() | ||
|
||
doLast { | ||
if (!file("src/main/packaging/$product/$productVersion").exists()) { | ||
throw new IllegalArgumentException("Unknown product $product/$productVersion") | ||
} | ||
|
||
project.copy { | ||
from("src/main/packaging/$product/$productVersion/") | ||
into("${buildDir}/generated/packaging") | ||
} | ||
project.exec { | ||
workingDir "src/main/packaging" | ||
commandLine "docker", "build", | ||
"-t", "adoptium-packages-linux-jdk-debian", | ||
"-f", "Dockerfile", | ||
getProjectDir().absolutePath + "/src/main/packaging" | ||
} | ||
|
||
project.exec { | ||
workingDir getRootDir() | ||
commandLine "docker", "run", | ||
"--rm", | ||
"-e", "buildArch=${arch}", | ||
"--mount", "type=bind,source=${buildDir},target=/home/builder/build", | ||
"--mount", "type=bind,source=${outputDir.absolutePath},target=/home/builder/out", | ||
"adoptium-packages-linux-jdk-debian:latest" | ||
} | ||
} | ||
} | ||
|
||
task checkJreDebian(type: Test) { | ||
dependsOn packageJreDebian | ||
|
||
description = 'Tests the generated Debian packages.' | ||
group = 'verification' | ||
|
||
testClassesDirs = sourceSets.packageTest.output.classesDirs | ||
classpath = sourceSets.packageTest.runtimeClasspath | ||
|
||
def product = getProduct() | ||
def productVersion = getProductVersion() | ||
|
||
environment "PACKAGE", "${product}-${productVersion}-jre" | ||
|
||
useJUnitPlatform() | ||
testLogging { | ||
events "passed", "skipped", "failed" | ||
} | ||
|
||
doFirst { | ||
if (!file("src/main/packaging/$product/$productVersion").exists()) { | ||
throw new IllegalArgumentException("Unknown product $product/$productVersion") | ||
} | ||
} | ||
} | ||
|
||
parent.packageJre.dependsOn(packageJreDebian) | ||
parent.checkJrePackage.dependsOn(checkJreDebian) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM debian:bullseye | ||
|
||
# Combine apt-get update with apt-get install to prevent stale package indexes. | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \ | ||
debhelper \ | ||
lsb-release \ | ||
reprepro \ | ||
gosu \ | ||
java-common \ | ||
libasound2 \ | ||
libc6 \ | ||
libx11-6 \ | ||
libfontconfig1 \ | ||
libfreetype6 \ | ||
libxext6 \ | ||
libxi6 \ | ||
libxrender1 \ | ||
libxtst6 \ | ||
zlib1g \ | ||
tini \ | ||
wget | ||
|
||
# Create unprivileged user for building, see | ||
# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid | ||
RUN groupadd -g 10001 builder \ | ||
&& useradd -m -d /home/builder -u 10000 -g 10001 builder | ||
|
||
# Prepare entrypoint and build scripts | ||
ADD entrypoint.sh /entrypoint.sh | ||
ADD build.sh /home/builder/build.sh | ||
RUN chmod +x /home/builder/build.sh | ||
|
||
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
# Copy build scripts into a directory within the container. Avoids polluting the mounted | ||
# directory and permission errors. | ||
mkdir /home/builder/workspace | ||
cp -R /home/builder/build/generated/packaging /home/builder/workspace | ||
|
||
|
||
# $ and $ARCH are env variables passing in from "docker run" | ||
debVersionList="bookworm bullseye buster kinetic jammy focal bionic" | ||
|
||
# the target package is only based on the host machine's ARCH | ||
# ${buildArch} is only used for debug purpose what really matter is the label on the jenkins agent | ||
echo "DEBUG: building Debian arch ${buildArch}" | ||
|
||
# Build package and set distributions it supports | ||
cd /home/builder/workspace/packaging | ||
dpkg-buildpackage -us -uc -b | ||
changestool /home/builder/workspace/*.changes setdistribution ${debVersionList} | ||
|
||
# Copy resulting files into mounted directory where artifacts should be placed. | ||
mv /home/builder/workspace/*.{deb,changes,buildinfo} /home/builder/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -euox pipefail | ||
|
||
# The directory mounted into the container has the UID/GID of the host user. In order to allow the user builder to write | ||
# into it without changing its ownership (which could render the folder or its contents inaccessible to the host user), | ||
# add the user builder to the group with the same GID as the host user. | ||
HOST_USER_GID=$(stat -c "%g" /home/builder/out) | ||
getent group "$HOST_USER_GID" || groupadd -g "$HOST_USER_GID" hostusrg | ||
usermod -a -G "$HOST_USER_GID" builder | ||
chmod g+w /home/builder/out | ||
|
||
# Drop root privileges and build the package. | ||
gosu builder /home/builder/build.sh |
5 changes: 5 additions & 0 deletions
5
linux/jre/debian/src/main/packaging/temurin/8/debian/changelog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
temurin-8-jre (8.0.352.0.0+8-2) STABLE; urgency=medium | ||
|
||
* Eclipse Temurin 8.0.352.0.0+8-2 release. | ||
|
||
-- Eclipse Adoptium Package Maintainers <temurin-dev@eclipse.org> Fri, 13 Dec 2023 13:13:00 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
11 |
39 changes: 39 additions & 0 deletions
39
linux/jre/debian/src/main/packaging/temurin/8/debian/control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Source: temurin-8-jre | ||
Section: java | ||
Priority: optional | ||
Maintainer: Eclipse Adoptium Package Maintainers <temurin-dev@eclipse.org> | ||
Build-Depends: debhelper (>= 11), lsb-release | ||
|
||
Package: temurin-8-jre | ||
Architecture: amd64 armhf arm64 ppc64el | ||
Depends: adoptium-ca-certificates, | ||
fonts-dejavu, | ||
java-common, | ||
libasound2, | ||
libatomic1 [armhf], | ||
libc6, | ||
libfontconfig1, | ||
libfreetype6, | ||
libx11-6, | ||
libxext6, | ||
libxi6, | ||
libxrender1, | ||
libxtst6, | ||
zlib1g | ||
Recommends: fonts-dejavu-core, | ||
fonts-dejavu-extra | ||
Provides: java-runtime, | ||
java-runtime-headless, | ||
java2-runtime, | ||
java5-runtime, | ||
java6-runtime, | ||
java7-runtime, | ||
java8-runtime, | ||
java2-runtime-headless, | ||
java5-runtime-headless, | ||
java6-runtime-headless, | ||
java7-runtime-headless, | ||
java8-runtime-headless | ||
Description: Eclipse Temurin 8 JRE | ||
Eclipse Temurin JRE is an OpenJDK-based runtime environment to execute | ||
Java applications and services. |
5 changes: 5 additions & 0 deletions
5
linux/jre/debian/src/main/packaging/temurin/8/debian/copyright
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
16 changes: 16 additions & 0 deletions
16
linux/jre/debian/src/main/packaging/temurin/8/debian/jinfo.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name=@pkg_alias@ | ||
alias=@pkg_alias@ | ||
priority=@priority@ | ||
section=contrib | ||
|
||
hl java /usr/lib/jvm/@jvm_dir@/bin/java | ||
hl jjs /usr/lib/jvm/@jvm_dir@/bin/jjs | ||
hl keytool /usr/lib/jvm/@jvm_dir@/bin/keytool | ||
hl orbd /usr/lib/jvm/@jvm_dir@/bin/orbd | ||
hl pack200 /usr/lib/jvm/@jvm_dir@/bin/pack200 | ||
hl rmid /usr/lib/jvm/@jvm_dir@/bin/rmid | ||
hl rmiregistry /usr/lib/jvm/@jvm_dir@/bin/rmiregistry | ||
jre policytool /usr/lib/jvm/@jvm_dir@/bin/policytool | ||
hl servertool /usr/lib/jvm/@jvm_dir@/bin/servertool | ||
hl tnameserv /usr/lib/jvm/@jvm_dir@/bin/tnameserv | ||
hl unpack200 /usr/lib/jvm/@jvm_dir@/bin/unpack200 |
42 changes: 42 additions & 0 deletions
42
linux/jre/debian/src/main/packaging/temurin/8/debian/postinst.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
priority="@priority@" | ||
jdk_base_dir="/usr/lib/jvm/@jvm_dir@" | ||
tools="@jvm_tools@" | ||
|
||
case "$1" in | ||
configure) | ||
for tool in $tools; do | ||
for tool_path in "$jdk_base_dir/bin/$tool" "$jdk_base_dir/lib/$tool"; do | ||
if [ ! -e "$tool_path" ]; then | ||
continue | ||
fi | ||
|
||
slave="" | ||
tool_man_path="$jdk_base_dir/man/man1/$tool.1" | ||
if [ -e "$tool_man_path" ]; then | ||
slave="--slave /usr/share/man/man1/$tool.1 $tool.1 $tool_man_path" | ||
fi | ||
|
||
update-alternatives \ | ||
--install \ | ||
"/usr/bin/$tool" \ | ||
"$tool" \ | ||
"$tool_path" \ | ||
"$priority" \ | ||
$slave | ||
done | ||
done | ||
;; | ||
|
||
abort-upgrade | abort-remove | abort-deconfigure) | ||
# Nothing to do | ||
;; | ||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
28 changes: 28 additions & 0 deletions
28
linux/jre/debian/src/main/packaging/temurin/8/debian/prerm.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
jdk_base_dir="/usr/lib/jvm/@jvm_dir@" | ||
tools="@jvm_tools@" | ||
|
||
case "$1" in | ||
purge) | ||
# Nothing to do | ||
;; | ||
remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear | deconfigure) | ||
for tool in $tools; do | ||
for tool_path in "$jdk_base_dir/bin/$tool" "$jdk_base_dir/lib/$tool"; do | ||
if [ ! -e "$tool_path" ]; then | ||
continue | ||
fi | ||
|
||
update-alternatives --remove "$tool" "$tool_path" | ||
done | ||
done | ||
;; | ||
*) | ||
echo "prerm called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
Oops, something went wrong.