Skip to content

Commit

Permalink
Merge pull request adoptium#4 from vsebe/semeru_ce_17
Browse files Browse the repository at this point in the history
Add spec file for Semeru Certified 17
  • Loading branch information
AdamBrousseau authored and GitHub Enterprise committed Oct 12, 2021
2 parents 6acee25 + f476579 commit 361785b
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ buildConfiguration = [
github_api_credentials_id: 'bd97cfc5-8e24-40c8-8aaf-6f1c1089ec2a',
jvm_vm: ['jdk'],
os: 'linux',
pipeline_architectures: ['x64', 'ppc64le', 's390x'],
pipeline_architectures: ['x64', 'ppc64le', 's390x', 'aarch64'],
product: 'IBM',
product_name: 'IBM Semeru Certified',
signing_certificate: 'WindowsSHA',
Expand All @@ -40,8 +40,9 @@ buildConfiguration = [

jdk11: [
binaries_repo: 'https://github.ibm.com/runtimes/openjdk11-binaries.git',
binaries_tag: 'latest'
]
binaries_tag: 'latest',
pipeline_architectures: ['x64', 'ppc64le', 's390x']
]
]

def get_binary_name_prefix(jvmType, arch) {
Expand Down
49 changes: 39 additions & 10 deletions linuxNew/jdk/redhat/pipelines/jobs/package_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ def init_parameters() {
// default platforms for srpm packages: Linux x86-84, PowerPC LE, s390x
ARCHITECTURE = (params.ARCHITECTURE) ?: ''
_ARCHITECTURE_LIST = []

def defaultArchitectures = get_architecture_list()

if (ARCHITECTURE) {
// filter out unsupported architectures
_ARCHITECTURE_LIST.addAll(buildConfiguration.pipeline_architectures.intersect(ARCHITECTURE.trim().replaceAll("\\s","").tokenize(',')))
_ARCHITECTURE_LIST.addAll(defaultArchitectures.intersect(ARCHITECTURE.trim().replaceAll("\\s","").tokenize(',')))
} else {
_ARCHITECTURE_LIST = buildConfiguration.pipeline_architectures
_ARCHITECTURE_LIST = defaultArchitectures
}

println("Build architectures: ${_ARCHITECTURE_LIST}")
Expand Down Expand Up @@ -205,20 +208,32 @@ def setup() {
if (!VERSION) {
// compose version string
def versionMap = binaryProperties['version']
println("Extracting VERSION from metadata: ${versionMap}")

if (!(versionMap instanceof Map) || (versionMap.size() <= 1)) {
error("Invalid version JSON! Cannot infer VERSION from the upstream build metadata (see ${get_base_name(binaryJsonFiles[0])} upstream)!")
}

// compose version
if ("${versionMap['major']}" == "8") {
def versBuild = versionMap['build']
if (versionMap['build'] < 10) {
// "0" padding for single digit build number
versBuild = "0${versionMap['build']}"
}
// e.g. 8u212-b03
//<major>u<security>-b<build>, e.g. 8u212-b03
VERSION = "${versionMap['major']}u${versionMap['security']}-b${versBuild}"
} else {
VERSION = "${versionMap['major']}.${versionMap['minor']}.${versionMap['security']}+${versionMap['build']}"
VERSION = versionMap['version']
if (!VERSION || versionMap['pre']) {
//<major>.<minor>.<security>+<build>, e.g. 11.0.13+5
VERSION = "${versionMap['major']}.${versionMap['minor']}.${versionMap['security']}+${versionMap['build']}"

// jdk17+: <major>+<build>, e.g. 17+35
if (JDK_VERSION.toInteger() >= 17) {
VERSION = "${versionMap['major']}+${versionMap['build']}"
}
}
}

println("VERSION: ${VERSION}")
Expand Down Expand Up @@ -281,9 +296,11 @@ def checksum() {
* Build SRPM package.
*/
def build_source_rpm(jvmType) {
def defaultArchList = get_architecture_list()

// SRPM build requires all Linux platforms -aarch64, x64, ppc64le and s390x - tarballs
// or FORCE_SRPM flag to build a custom package
if ((_ARCHITECTURE_LIST.size() == buildConfiguration.pipeline_architectures.size()) || (FORCE_SRPM)) {
if ((_ARCHITECTURE_LIST.size() == defaultArchList.size()) || (FORCE_SRPM)) {
def specFile = get_base_name(_SPEC_FILES[jvmType])

// work-around for custom SRPM
Expand All @@ -306,7 +323,7 @@ def build_source_rpm(jvmType) {

if (PACKAGE_TYPE.toLowerCase().equals('srpm')) {
// srpm build only, fail current build
error("Missing achitecture: ${buildConfiguration.pipeline_architectures.minus(_ARCHITECTURE_LIST)}! Retry with ARCHITECTURE: ${buildConfiguration.pipeline_architectures.join(',')}!")
error("Missing achitecture: ${defaultArchList.minus(_ARCHITECTURE_LIST)}! Retry with ARCHITECTURE: ${defaultArchList.join(',')}!")
}

// do not fail the build, just print a message and keep going
Expand Down Expand Up @@ -362,7 +379,7 @@ def copy_sources_from_upstream_job() {
for (vm in _JVM_VM_LIST) {
def fileNameFilter = configFile.get_binary_name_prefix(vm, arch)
for (suffix in ['*.tar.gz', '*.sha256.txt', '*.json']) {
artifactsFilter.add("target/linux/${arch}/${VARIANT}/${fileNameFilter}${suffix}")
artifactsFilter.add("**/${fileNameFilter}${suffix}")
}
}
}
Expand Down Expand Up @@ -583,10 +600,10 @@ def get_parameter_value(name) {
def configName = name.toLowerCase()

if (!value) {
if (buildConfiguration.containsKey(configName)) {
value = buildConfiguration."${configName}"
} else if (buildConfiguration."jdk${JDK_VERSION}" && buildConfiguration."jdk${JDK_VERSION}".containsKey(configName)) {
if (buildConfiguration."jdk${JDK_VERSION}" && buildConfiguration."jdk${JDK_VERSION}".containsKey(configName)) {
value = buildConfiguration."jdk${JDK_VERSION}"."${configName}"
} else if (buildConfiguration.containsKey(configName)) {
value = buildConfiguration."${configName}"
} else {
value = ''
}
Expand Down Expand Up @@ -646,3 +663,15 @@ def get_rpmbuild_options(jvmType) {
println("rpmbuild options: ${rpmbuildOptions}")
return rpmbuildOptions
}

def get_architecture_list() {
def defaultArchList = []

if (buildConfiguration."jdk${JDK_VERSION}" && buildConfiguration."jdk${JDK_VERSION}".containsKey('pipeline_architectures')) {
defaultArchList.addAll(buildConfiguration."jdk${JDK_VERSION}".pipeline_architectures)
} else if (buildConfiguration.pipeline_architectures) {
defaultArchList.addAll(buildConfiguration.pipeline_architectures)
}

return defaultArchList
}
54 changes: 54 additions & 0 deletions linuxNew/jdk/redhat/src/main/packaging/ibm/17/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Semeru RPM packaging prototype

This is a prototype for packaging IBM Semeru Certified Edition
via an RPM and also be able to rebuild it downstream via the provided SRPM.

## Prerequisites

Packages `rpmdevtools` and `rpm-build` are installed on the
system. For example:

```
$ rpm -q rpmdevtools rpm-build
rpmdevtools-9.3-3.fc33.noarch
rpm-build-4.16.1.3-1.fc33.x86_64
```

## Basic Usage

On update, change the version numbers according to the new release
in `jdk/redhat/src/main/packaging/ibm/17/ibm-jdk-17.spec`.

First we download the release tarballs
from https://github.ibm.com/runtimes/semeru17-binaries/releases
or
https://na.artifactory.swg-devops.com/ui/native/hyc-rt-java-delivery-generic-local/IBM/java/semeru-certified/17.0

Next, we build the SRPM via:

```
$ rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \
--define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \
--define "_rpmdir $(pwd)" --nodeps -bs ibm-jdk-17.spec
```

Finally, we can build the binary RPM from the SRPM on the spec-file
supported architectures: aarch64, x86_64, ppc64le, s390x:

```
$ rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \
--define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \
--define "_rpmdir $(pwd)" --rebuild *.src.rpm
```

## Building for a different architecture

Use the `--target` switch to `rpm-build` so as to build for a different
archicture. Suppose the host architecture is `x86_64` and we want to build
for target architecture `ppc64le`:

```
$ rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \
--define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \
--define "_rpmdir $(pwd)" --target ppc64le --rebuild *.src.rpm
```
Loading

0 comments on commit 361785b

Please sign in to comment.