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 support for ppc64le architecture #5459

Merged
merged 5 commits into from
Dec 19, 2022
Merged
Changes from 1 commit
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
Next Next commit
add support for ppc64le architecture
Signed-off-by: Priya Seth <sethp@us.ibm.com>
seth-priya committed Dec 6, 2022
commit e2c7b9353c7122c73b98d218a7f0403940163fbd
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Test] Add IAE test for deprecated edgeNGram analyzer name ([#5040](https://github.com/opensearch-project/OpenSearch/pull/5040))
- Allow mmap to use new JDK-19 preview APIs in Apache Lucene 9.4+ ([#5151](https://github.com/opensearch-project/OpenSearch/pull/5151))
- Add feature flag for extensions ([#5211](https://github.com/opensearch-project/OpenSearch/pull/5211))
- Add support for ppc64le architecture ([#5408](https://github.com/opensearch-project/OpenSearch/pull/5457))

### Dependencies
- Bumps `log4j-core` from 2.18.0 to 2.19.0
Original file line number Diff line number Diff line change
@@ -36,7 +36,8 @@ public enum Architecture {

X64,
ARM64,
S390X;
S390X,
PPC64LE;

public static Architecture current() {
final String architecture = System.getProperty("os.arch", "");
@@ -48,6 +49,8 @@ public static Architecture current() {
return ARM64;
case "s390x":
return S390X;
case "ppc64le":
return PPC64LE;
default:
throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
}
Original file line number Diff line number Diff line change
@@ -220,6 +220,9 @@ private String dependencyNotation(OpenSearchDistribution distribution) {
case S390X:
classifier = ":" + distribution.getPlatform() + "-s390x";
break;
case PPC64LE:
classifier = ":" + distribution.getPlatform() + "-ppc64le";
break;
default:
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
}
4 changes: 3 additions & 1 deletion buildSrc/src/main/java/org/opensearch/gradle/Jdk.java
Original file line number Diff line number Diff line change
@@ -49,7 +49,9 @@

public class Jdk implements Buildable, Iterable<File> {

private static final List<String> ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("aarch64", "x64", "s390x"));
private static final List<String> ALLOWED_ARCHITECTURES = Collections.unmodifiableList(
Arrays.asList("aarch64", "x64", "s390x", "ppc64le")
);
private static final List<String> ALLOWED_VENDORS = Collections.unmodifiableList(Arrays.asList("adoptium", "adoptopenjdk", "openjdk"));
private static final List<String> ALLOWED_PLATFORMS = Collections.unmodifiableList(
Arrays.asList("darwin", "freebsd", "linux", "mac", "windows")
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ public void testCurrentArchitecture() {
assertEquals(Architecture.X64, currentArchitecture("x86_64"));
assertEquals(Architecture.ARM64, currentArchitecture("aarch64"));
assertEquals(Architecture.S390X, currentArchitecture("s390x"));
assertEquals(Architecture.PPC64LE, currentArchitecture("ppc64le"));
}

public void testInvalidCurrentArchitecture() {
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public void testUnknownArchitecture() {
"11.0.2+33",
"linux",
"unknown",
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x]"
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x, ppc64le]"
);
}

9 changes: 9 additions & 0 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
@@ -167,6 +167,15 @@ distribution_archives {
}
}

// Should really be `no-jdk-linux-ppc64le` as it ships without a JDK, however it seems that the build can't handle
// the absence of the `linux-ppc64le` target.
linuxPpc64leTar {
archiveClassifier = 'linux-ppc64le'
content {
archiveFiles(modulesFiles('linux-ppc64le'), 'tar', 'linux', 'ppc64le', false)
}
}

windowsZip {
archiveClassifier = 'windows-x64'
content {
4 changes: 2 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
@@ -280,7 +280,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
// Setup all required JDKs
project.jdks {
['darwin', 'linux', 'windows'].each { platform ->
(platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64', 's390x'] : ['x64']).each { architecture ->
(platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64', 's390x', 'ppc64le'] : ['x64']).each { architecture ->
"bundled_${platform}_${architecture}" {
it.platform = platform
it.version = VersionProperties.getBundledJdk(platform)
@@ -353,7 +353,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
}
def buildModules = buildModulesTaskProvider
List excludePlatforms = ['darwin-x64', 'freebsd-x64', 'linux-x64', 'linux-arm64', 'linux-s390x', 'windows-x64', 'darwin-arm64']
List excludePlatforms = ['darwin-x64', 'freebsd-x64', 'linux-x64', 'linux-arm64', 'linux-s390x', 'linux-ppc64le', 'windows-x64', 'darwin-arm64']
if (platform != null) {
excludePlatforms.remove(excludePlatforms.indexOf(platform))
} else {
8 changes: 8 additions & 0 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
@@ -28,12 +28,14 @@ testFixtures.useFixture()
configurations {
arm64DockerSource
s390xDockerSource
ppc64leDockerSource
dockerSource
}

dependencies {
arm64DockerSource project(path: ":distribution:archives:linux-arm64-tar", configuration:"default")
s390xDockerSource project(path: ":distribution:archives:linux-s390x-tar", configuration:"default")
ppc64leDockerSource project(path: ":distribution:archives:linux-ppc64le-tar", configuration:"default")
dockerSource project(path: ":distribution:archives:linux-tar", configuration:"default")
}

@@ -46,6 +48,8 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local ->
classifier = "linux-x64"
} else if (architecture == Architecture.S390X) {
classifier = "linux-s390x"
} else if (architecture == Architecture.PPC64LE) {
classifier = "linux-ppc64le"
} else {
throw new IllegalArgumentException("Unsupported architecture [" + architecture + "]")
}
@@ -90,13 +94,15 @@ private static String buildPath(Architecture architecture, DockerBase base) {
return 'build/' +
(architecture == Architecture.ARM64 ? 'arm64-' : '') +
(architecture == Architecture.S390X ? 's390x-' : '') +
(architecture == Architecture.PPC64LE ? 'ppc64le-' : '') +
'docker'
}

private static String taskName(String prefix, Architecture architecture, DockerBase base, String suffix) {
return prefix +
(architecture == Architecture.ARM64 ? 'Arm64' : '') +
(architecture == Architecture.S390X ? 'S390x' : '') +
(architecture == Architecture.PPC64LE ? 'Ppc64le' : '') +
suffix
}

@@ -135,6 +141,8 @@ void addCopyDockerContextTask(Architecture architecture, DockerBase base) {
from configurations.arm64DockerSource
} else if (architecture == Architecture.S390X) {
from configurations.s390xDockerSource
} else if (architecture == Architecture.PPC64LE) {
from configurations.ppc64leDockerSource
} else {
from configurations.dockerSource
}
13 changes: 13 additions & 0 deletions distribution/docker/docker-ppc64le-export/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

// This file is intentionally blank. All configuration of the
// export is done in the parent project.
Original file line number Diff line number Diff line change
@@ -260,6 +260,7 @@ static class Arch {
m.put("amd64", new Arch(0xC000003E, 0x3FFFFFFF, 57, 58, 59, 322, 317));
m.put("aarch64", new Arch(0xC00000B7, 0xFFFFFFFF, 1079, 1071, 221, 281, 277));
m.put("s390x", new Arch(0x80000016, 0xFFFFFFFF, 2, 190, 11, 354, 348));
m.put("ppc64le", new Arch(0xC0000015, 0xFFFFFFFF, 2, 189, 11, 362, 358));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Preference) I would really like if at least some these values could be made constants. I see above they correspond to AUDIT_ARCH_XXX, __NR_xxx, etc.

ARCHITECTURES = Collections.unmodifiableMap(m);
}

2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -49,12 +49,14 @@ List projects = [
'distribution:archives:linux-arm64-tar',
'distribution:archives:no-jdk-linux-arm64-tar',
'distribution:archives:linux-s390x-tar',
'distribution:archives:linux-ppc64le-tar',
'distribution:archives:linux-tar',
'distribution:archives:no-jdk-linux-tar',
'distribution:docker',
'distribution:docker:docker-arm64-build-context',
'distribution:docker:docker-arm64-export',
'distribution:docker:docker-s390x-export',
'distribution:docker:docker-ppc64le-export',
'distribution:docker:docker-build-context',
'distribution:docker:docker-export',
'distribution:packages:arm64-deb',