From e22edf40841e8408da30aca56dbba20a99dc1e72 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Fri, 23 Apr 2021 13:34:59 -0700 Subject: [PATCH 1/4] Renaming CPU architecture from x86_64, aarch64 to x64, arm64 Signed-off-by: Sarat Vemulapalli --- Vagrantfile | 24 +++++++-------- buildSrc/build.gradle | 2 +- .../DistributionDownloadPluginFuncTest.groovy | 2 +- .../DistributionDownloadFixture.groovy | 2 +- ...lDistributionBwcSetupPluginFuncTest.groovy | 2 +- .../remote/distribution/archives/build.gradle | 2 +- .../gradle/test/ClusterFormationTasks.groovy | 2 +- .../org/opensearch/gradle/Architecture.java | 4 +-- .../gradle/DistributionDownloadPlugin.java | 4 +-- .../main/java/org/opensearch/gradle/Jdk.java | 2 +- .../opensearch/gradle/JdkDownloadPlugin.java | 20 +++++++++++-- .../InternalDistributionBwcSetupPlugin.java | 8 ++--- .../gradle/test/DistroTestPlugin.java | 4 +-- .../gradle/JdkDownloadPluginTests.java | 2 +- distribution/archives/build.gradle | 30 +++++++++---------- .../build.gradle | 0 distribution/build.gradle | 10 +++---- distribution/docker/build.gradle | 24 +++++++-------- .../build.gradle | 0 .../{aarch64-deb => arm64-deb}/build.gradle | 0 .../{aarch64-rpm => arm64-rpm}/build.gradle | 0 distribution/packages/build.gradle | 16 +++++----- .../plugins/InstallPluginCommandTests.java | 4 +-- .../src/main/resources/regexes.yml | 26 ++++++++-------- .../bootstrap/SystemCallFilter.java | 2 +- .../org/opensearch/plugins/Platforms.java | 12 ++++---- .../org/opensearch/plugins/PluginsTests.java | 10 +++---- settings.gradle | 10 +++---- 28 files changed, 119 insertions(+), 105 deletions(-) rename distribution/archives/{linux-aarch64-tar => linux-arm64-tar}/build.gradle (100%) rename distribution/docker/{docker-aarch64-export => docker-arm64-export}/build.gradle (100%) rename distribution/packages/{aarch64-deb => arm64-deb}/build.gradle (100%) rename distribution/packages/{aarch64-rpm => arm64-rpm}/build.gradle (100%) diff --git a/Vagrantfile b/Vagrantfile index a7955246088a9..8af16683d3e4f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -71,7 +71,7 @@ Vagrant.configure(2) do |config| 'ubuntu-1604'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/ubuntu-16.04-x86_64' + config.vm.box = 'elastic/ubuntu-16.04-x64' deb_common config, box, extra: <<-SHELL # Install Jayatana so we can work around it being present. [ -f /usr/share/java/jayatanaag.jar ] || install jayatana @@ -81,7 +81,7 @@ Vagrant.configure(2) do |config| end 'ubuntu-1804'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/ubuntu-18.04-x86_64' + config.vm.box = 'elastic/ubuntu-18.04-x64' deb_common config, box, extra: <<-SHELL # Install Jayatana so we can work around it being present. [ -f /usr/share/java/jayatanaag.jar ] || install jayatana @@ -94,7 +94,7 @@ Vagrant.configure(2) do |config| # jessie and stretch for testing debian and it works fine. 'debian-8'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/debian-8-x86_64' + config.vm.box = 'elastic/debian-8-x64' deb_common config, box, extra: <<-SHELL # this sometimes gets a bad ip, and doesn't appear to be needed rm -f /etc/apt/sources.list.d/http_debian_net_debian.list @@ -103,59 +103,59 @@ Vagrant.configure(2) do |config| end 'debian-9'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/debian-9-x86_64' + config.vm.box = 'elastic/debian-9-x64' deb_common config, box deb_docker config end end 'centos-6'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/centos-6-x86_64' + config.vm.box = 'elastic/centos-6-x64' rpm_common config, box end end 'centos-7'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/centos-7-x86_64' + config.vm.box = 'elastic/centos-7-x64' rpm_common config, box rpm_docker config end end 'oel-6'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/oraclelinux-6-x86_64' + config.vm.box = 'elastic/oraclelinux-6-x64' rpm_common config, box end end 'oel-7'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/oraclelinux-7-x86_64' + config.vm.box = 'elastic/oraclelinux-7-x64' rpm_common config, box end end 'fedora-28'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/fedora-28-x86_64' + config.vm.box = 'elastic/fedora-28-x64' dnf_common config, box dnf_docker config end end 'fedora-29'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/fedora-29-x86_64' + config.vm.box = 'elastic/fedora-29-x64' dnf_common config, box dnf_docker config end end 'sles-12'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/sles-12-x86_64' + config.vm.box = 'elastic/sles-12-x64' sles_common config, box end end 'rhel-8'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/rhel-8-x86_64' + config.vm.box = 'elastic/rhel-8-x64' rpm_common config, box end end diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index c168a5a0dd8e4..1020cd229030e 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -185,7 +185,7 @@ if (project != rootProject) { distribution project(':distribution:archives:windows-zip') distribution project(':distribution:archives:darwin-tar') distribution project(':distribution:archives:linux-tar') - distribution project(':distribution:archives:linux-aarch64-tar') + distribution project(':distribution:archives:linux-arm64-tar') integTestRuntimeOnly(project(":libs:opensearch-core")) } diff --git a/buildSrc/src/integTest/groovy/org/opensearch/gradle/DistributionDownloadPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/opensearch/gradle/DistributionDownloadPluginFuncTest.groovy index ff8c534373567..d49c85f0f0e17 100644 --- a/buildSrc/src/integTest/groovy/org/opensearch/gradle/DistributionDownloadPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/opensearch/gradle/DistributionDownloadPluginFuncTest.groovy @@ -119,7 +119,7 @@ class DistributionDownloadPluginFuncTest extends AbstractGradleFuncTest { then: result.tasks.size() == 3 - result.output.count("Unpacking opensearch-${version}-linux-x86_64.tar.gz " + + result.output.count("Unpacking opensearch-${version}-linux-x64.tar.gz " + "using SymbolicLinkPreservingUntarTransform.") == 1 } diff --git a/buildSrc/src/integTest/groovy/org/opensearch/gradle/fixtures/DistributionDownloadFixture.groovy b/buildSrc/src/integTest/groovy/org/opensearch/gradle/fixtures/DistributionDownloadFixture.groovy index 6d33f8e82c533..30c96b8c4c68b 100644 --- a/buildSrc/src/integTest/groovy/org/opensearch/gradle/fixtures/DistributionDownloadFixture.groovy +++ b/buildSrc/src/integTest/groovy/org/opensearch/gradle/fixtures/DistributionDownloadFixture.groovy @@ -65,7 +65,7 @@ class DistributionDownloadFixture { private static String urlPath(String version, OpenSearchDistribution.Platform platform) { String fileType = ((platform == OpenSearchDistribution.Platform.LINUX || platform == OpenSearchDistribution.Platform.DARWIN)) ? "tar.gz" : "zip" - "/releases/core/opensearch/${version}/opensearch-${version}-${platform}-x86_64.$fileType" + "/releases/core/opensearch/${version}/opensearch-${version}-${platform}-x64.$fileType" } private static byte[] filebytes(String urlPath) throws IOException { diff --git a/buildSrc/src/integTest/groovy/org/opensearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy b/buildSrc/src/integTest/groovy/org/opensearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy index fc70ac25f264e..9d5e8009e3553 100644 --- a/buildSrc/src/integTest/groovy/org/opensearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy +++ b/buildSrc/src/integTest/groovy/org/opensearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy @@ -102,7 +102,7 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest result.output.contains("[8.0.1] > Task :distribution:archives:darwin-tar:assemble") normalizedOutput(result.output) .contains("distfile /distribution/bwc/bugfix/build/bwc/checkout-8.0/distribution/archives/darwin-tar/" + - "build/distributions/opensearch-8.0.1-SNAPSHOT-darwin-x86_64.tar.gz") + "build/distributions/opensearch-8.0.1-SNAPSHOT-darwin-x64.tar.gz") } def "bwc expanded distribution folder can be resolved as bwc project artifact"() { diff --git a/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle b/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle index 7e182af81b83e..fbd5936061779 100644 --- a/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle +++ b/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/distribution/archives/build.gradle @@ -36,7 +36,7 @@ subprojects { destinationDirectory.set(file('build/distributions')) archiveBaseName.set("opensearch") archiveVersion.set("8.0.1-SNAPSHOT") - archiveClassifier.set("darwin-x86_64") + archiveClassifier.set("darwin-x64") archiveExtension.set('tar.gz') } diff --git a/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy index 169490f81d64a..c3dd2526de385 100644 --- a/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy @@ -206,7 +206,7 @@ class ClusterFormationTasks { Version version = Version.fromString(opensearchVersion) String os = getOs() - String classifier = "-${os}-x86_64" + String classifier = "-${os}-x64" String packaging = os.equals('windows') ? 'zip' : 'tar.gz' String artifactName = 'opensearch' Object dependency diff --git a/buildSrc/src/main/java/org/opensearch/gradle/Architecture.java b/buildSrc/src/main/java/org/opensearch/gradle/Architecture.java index bdb56bb086da4..38d6db8c9916e 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/Architecture.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/Architecture.java @@ -35,7 +35,7 @@ public enum Architecture { X64, - AARCH64; + ARM64; public static Architecture current() { final String architecture = System.getProperty("os.arch", ""); @@ -44,7 +44,7 @@ public static Architecture current() { case "x86_64": return X64; case "aarch64": - return AARCH64; + return ARM64; default: throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]"); } diff --git a/buildSrc/src/main/java/org/opensearch/gradle/DistributionDownloadPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/DistributionDownloadPlugin.java index a5d232c978535..c6721f49ead18 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/DistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/DistributionDownloadPlugin.java @@ -187,11 +187,11 @@ private String dependencyNotation(OpenSearchDistribution distribution) { Version distroVersion = Version.fromString(distribution.getVersion()); String extension = distribution.getType().toString(); - String classifier = ":x86_64"; + String classifier = ":x64"; if (distribution.getType() == Type.ARCHIVE) { extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz"; if (distroVersion.onOrAfter("7.0.0")) { - classifier = ":" + distribution.getPlatform() + "-x86_64"; + classifier = ":" + distribution.getPlatform() + "-x64"; } else { classifier = ""; } diff --git a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java index baf7fc2b771fd..52d842da158f9 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java @@ -48,7 +48,7 @@ public class Jdk implements Buildable, Iterable { - private static final List ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("aarch64", "x64")); + private static final List ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("arm64", "x64")); private static final List ALLOWED_VENDORS = Collections.unmodifiableList(Arrays.asList("adoptopenjdk", "openjdk")); private static final List ALLOWED_PLATFORMS = Collections.unmodifiableList(Arrays.asList("darwin", "linux", "windows", "mac")); private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)(\\.\\d+\\.\\d+)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?"); diff --git a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java index b8d4bcb007e8d..48c86173b2b1d 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java @@ -116,14 +116,18 @@ private void setupRepository(Project project, Jdk jdk) { + jdk.getBaseVersion() + "-" + jdk.getBuild() - + "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk"; + + "/[module]/" + + getClassifier(jdk) + + "/jdk/hotspot/normal/adoptopenjdk"; } else { // current pattern since JDK 9 artifactPattern = "jdk-" + jdk.getBaseVersion() + "+" + jdk.getBuild() - + "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk"; + + "/[module]/" + + getClassifier(jdk) + + "/jdk/hotspot/normal/adoptopenjdk"; } } else if (jdk.getVendor().equals(VENDOR_OPENJDK)) { repoUrl = "https://download.oracle.com"; @@ -135,7 +139,9 @@ private void setupRepository(Project project, Jdk jdk) { + jdk.getHash() + "/" + jdk.getBuild() - + "/GPL/openjdk-[revision]_[module]-[classifier]_bin.[ext]"; + + "/GPL/openjdk-[revision]_[module]-" + + getClassifier(jdk) + + "_bin.[ext]"; } else { // simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back artifactPattern = "java/GA/jdk" @@ -160,6 +166,14 @@ private void setupRepository(Project project, Jdk jdk) { } } + private String getClassifier(Jdk jdk) { + if (jdk.getArchitecture() == "arm64") { + return "aarch64"; + } else { + return "[classifier]"; + } + } + @SuppressWarnings("unchecked") public static NamedDomainObjectContainer getContainer(Project project) { return (NamedDomainObjectContainer) project.getExtensions().getByName(EXTENSION_NAME); diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java index 233d480ac99ac..8934ce03c0ef0 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java @@ -135,7 +135,7 @@ private void registerDistributionArchiveArtifact(Project bwcProject, Distributio String artifactName = "opensearch"; String suffix = artifactFileName.endsWith("tar.gz") ? "tar.gz" : artifactFileName.substring(artifactFileName.length() - 3); - int archIndex = artifactFileName.indexOf("x86_64"); + int archIndex = artifactFileName.indexOf("x64"); bwcProject.getConfigurations().create(distributionProject.name); bwcProject.getArtifacts().add(distributionProject.name, distributionProject.getDistFile(), artifact -> { @@ -146,7 +146,7 @@ private void registerDistributionArchiveArtifact(Project bwcProject, Distributio String classifier = ""; if (archIndex != -1) { int osIndex = artifactFileName.lastIndexOf('-', archIndex - 2); - classifier = "-" + artifactFileName.substring(osIndex + 1, archIndex - 1) + "-x86_64"; + classifier = "-" + artifactFileName.substring(osIndex + 1, archIndex - 1) + "-x64"; } artifact.setClassifier(classifier); }); @@ -171,7 +171,7 @@ private static List resolveArchiveProjects(File checkoutDir if (name.contains("zip") || name.contains("tar")) { int index = name.lastIndexOf('-'); String baseName = name.substring(0, index); - classifier = "-" + baseName + "-x86_64"; + classifier = "-" + baseName + "-x64"; extension = name.substring(index + 1); if (extension.equals("tar")) { extension += ".gz"; @@ -179,7 +179,7 @@ private static List resolveArchiveProjects(File checkoutDir } else if (name.contains("deb")) { classifier = "-amd64"; } else if (name.contains("rpm")) { - classifier = "-x86_64"; + classifier = "-x64"; } } else { extension = name.substring(4); diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java index ab80cf6d39232..8f66e263dcdd8 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java @@ -381,8 +381,8 @@ private List configureDistributions(Project project) { )) { for (boolean bundledJdk : Arrays.asList(true, false)) { if (bundledJdk == false) { - // We'll never publish an ARM (aarch64) build without a bundled JDK. - if (architecture == Architecture.AARCH64) { + // We'll never publish an ARM (arm64) build without a bundled JDK. + if (architecture == Architecture.ARM64) { continue; } // All our Docker images include a bundled JDK so it doesn't make sense to test without one. diff --git a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java index 1d3ab3935c692..1a43f010e2f20 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java @@ -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]" + "unknown architecture [unknown] for jdk [testjdk], must be one of [arm64, x64]" ); } diff --git a/distribution/archives/build.gradle b/distribution/archives/build.gradle index fe36929d84d3b..801b42c6ee453 100644 --- a/distribution/archives/build.gradle +++ b/distribution/archives/build.gradle @@ -89,51 +89,51 @@ distribution_archives { } windowsZip { - archiveClassifier = 'windows-x86_64' + archiveClassifier = 'windows-x64' content { - archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', true) + archiveFiles(modulesFiles('windows-x64'), 'zip', 'windows', 'x64', true) } } noJdkWindowsZip { - archiveClassifier = 'no-jdk-windows-x86_64' + archiveClassifier = 'no-jdk-windows-x64' content { - archiveFiles(modulesFiles('windows-x86_64'), 'zip', 'windows', 'x64', false) + archiveFiles(modulesFiles('windows-x64'), 'zip', 'windows', 'x64', false) } } darwinTar { - archiveClassifier = 'darwin-x86_64' + archiveClassifier = 'darwin-x64' content { - archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', true) + archiveFiles(modulesFiles('darwin-x64'), 'tar', 'darwin', 'x64', true) } } noJdkDarwinTar { - archiveClassifier = 'no-jdk-darwin-x86_64' + archiveClassifier = 'no-jdk-darwin-x64' content { - archiveFiles(modulesFiles('darwin-x86_64'), 'tar', 'darwin', 'x64', false) + archiveFiles(modulesFiles('darwin-x64'), 'tar', 'darwin', 'x64', false) } } - linuxAarch64Tar { - archiveClassifier = 'linux-aarch64' + linuxArm64Tar { + archiveClassifier = 'linux-arm64' content { - archiveFiles(modulesFiles('linux-aarch64'), 'tar', 'linux', 'aarch64', true) + archiveFiles(modulesFiles('linux-arm64'), 'tar', 'linux', 'arm64', true) } } linuxTar { - archiveClassifier = 'linux-x86_64' + archiveClassifier = 'linux-x64' content { - archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', true) + archiveFiles(modulesFiles('linux-x64'), 'tar', 'linux', 'x64', true) } } noJdkLinuxTar { - archiveClassifier = 'no-jdk-linux-x86_64' + archiveClassifier = 'no-jdk-linux-x64' content { - archiveFiles(modulesFiles('linux-x86_64'), 'tar', 'linux', 'x64', false) + archiveFiles(modulesFiles('linux-x64'), 'tar', 'linux', 'x64', false) } } } diff --git a/distribution/archives/linux-aarch64-tar/build.gradle b/distribution/archives/linux-arm64-tar/build.gradle similarity index 100% rename from distribution/archives/linux-aarch64-tar/build.gradle rename to distribution/archives/linux-arm64-tar/build.gradle diff --git a/distribution/build.gradle b/distribution/build.gradle index c9df196edd260..31e43b70d5aa8 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -252,7 +252,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { // Setup all required JDKs project.jdks { ['darwin', 'windows', 'linux'].each { platform -> - (platform == 'linux' ? ['x64', 'aarch64'] : ['x64']).each { architecture -> + (platform == 'linux' ? ['x64', 'arm64'] : ['x64']).each { architecture -> "bundled_${platform}_${architecture}" { it.platform = platform it.version = VersionProperties.getBundledJdk(platform) @@ -312,7 +312,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { modulesFiles = { platform -> copySpec { eachFile { - if (it.relativePath.segments[-2] == 'bin' || (platform == 'darwin-x86_64' && it.relativePath.segments[-2] == 'MacOS')) { + if (it.relativePath.segments[-2] == 'bin' || (platform == 'darwin-x64' && it.relativePath.segments[-2] == 'MacOS')) { // bin files, wherever they are within modules (eg platform specific) should be executable // and MacOS is an alternative to bin on macOS it.mode = 0755 @@ -321,7 +321,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { } } def buildModules = buildModulesTaskProvider - List excludePlatforms = ['linux-x86_64', 'linux-aarch64', 'windows-x86_64', 'darwin-x86_64'] + List excludePlatforms = ['linux-x64', 'linux-arm64', 'windows-x64', 'darwin-x64'] if (platform != null) { excludePlatforms.remove(excludePlatforms.indexOf(platform)) } else { @@ -585,11 +585,11 @@ subprojects { ['archives:windows-zip', 'archives:darwin-tar', - 'archives:linux-aarch64-tar', + 'archives:linux-arm64-tar', 'archives:linux-tar', 'archives:integ-test-zip', 'packages:rpm', 'packages:deb', - 'packages:aarch64-rpm', 'packages:aarch64-deb' + 'packages:arm64-rpm', 'packages:arm64-deb' ].forEach { subName -> Project subproject = project("${project.path}:${subName}") Configuration configuration = configurations.create(subproject.name) diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index e0da5bd2f3b19..bce24b8f59b32 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -24,22 +24,22 @@ apply plugin: 'opensearch.rest-resources' testFixtures.useFixture() configurations { - aarch64DockerSource + arm64DockerSource dockerSource } dependencies { - aarch64DockerSource project(path: ":distribution:archives:linux-aarch64-tar", configuration:"default") + arm64DockerSource project(path: ":distribution:archives:linux-arm64-tar", configuration:"default") dockerSource project(path: ":distribution:archives:linux-tar", configuration:"default") } ext.expansions = { Architecture architecture, DockerBase base, boolean local -> String classifier if (local) { - if (architecture == Architecture.AARCH64) { - classifier = "linux-aarch64" + if (architecture == Architecture.ARM64) { + classifier = "linux-arm64" } else if (architecture == Architecture.X64) { - classifier = "linux-x86_64" + classifier = "linux-x64" } else { throw new IllegalArgumentException("Unsupported architecture [" + architecture + "]") } @@ -82,13 +82,13 @@ RUN curl --retry 8 -S -L \\ private static String buildPath(Architecture architecture, DockerBase base) { return 'build/' + - (architecture == Architecture.AARCH64 ? 'aarch64-' : '') + + (architecture == Architecture.ARM64 ? 'arm64-' : '') + 'docker' } private static String taskName(String prefix, Architecture architecture, DockerBase base, String suffix) { return prefix + - (architecture == Architecture.AARCH64 ? 'Aarch64' : '') + + (architecture == Architecture.ARM64 ? 'Arm64' : '') + suffix } @@ -123,8 +123,8 @@ void addCopyDockerContextTask(Architecture architecture, DockerBase base) { with dockerBuildContext(architecture, base, true) - if (architecture == Architecture.AARCH64) { - from configurations.aarch64DockerSource + if (architecture == Architecture.ARM64) { + from configurations.arm64DockerSource } else { from configurations.dockerSource } @@ -142,7 +142,7 @@ def createAndSetWritable(Object... locations) { opensearch_distributions { Architecture.values().each { eachArchitecture -> - "docker${ eachArchitecture == Architecture.AARCH64 ? '_aarch64' : '' }" { + "docker${ eachArchitecture == Architecture.ARM64 ? '_arm64' : '' }" { architecture = eachArchitecture type = 'docker' version = VersionProperties.getOpenSearch() @@ -225,10 +225,10 @@ subprojects { Project subProject -> if (subProject.name.endsWith('-export')) { apply plugin: 'distribution' - final Architecture architecture = subProject.name.contains('aarch64-') ? Architecture.AARCH64 : Architecture.X64 + final Architecture architecture = subProject.name.contains('arm64-') ? Architecture.ARM64 : Architecture.X64 final DockerBase base = DockerBase.CENTOS - final String arch = architecture == Architecture.AARCH64 ? '-aarch64' : '' + final String arch = architecture == Architecture.ARM64 ? '-arm64' : '' final String extension = 'docker.tar' final String artifactName = "opensearch${arch}_test" diff --git a/distribution/docker/docker-aarch64-export/build.gradle b/distribution/docker/docker-arm64-export/build.gradle similarity index 100% rename from distribution/docker/docker-aarch64-export/build.gradle rename to distribution/docker/docker-arm64-export/build.gradle diff --git a/distribution/packages/aarch64-deb/build.gradle b/distribution/packages/arm64-deb/build.gradle similarity index 100% rename from distribution/packages/aarch64-deb/build.gradle rename to distribution/packages/arm64-deb/build.gradle diff --git a/distribution/packages/aarch64-rpm/build.gradle b/distribution/packages/arm64-rpm/build.gradle similarity index 100% rename from distribution/packages/aarch64-rpm/build.gradle rename to distribution/packages/arm64-rpm/build.gradle diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index 25c2de2a1fe6d..c7eaadfdfcf51 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -116,7 +116,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { if (architecture == 'x64') { arch('amd64') } else { - assert architecture == 'aarch64' : architecture + assert architecture == 'arm64' : architecture arch('arm64') } } else { @@ -124,13 +124,13 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { if (architecture == 'x64') { arch('X86_64') } else { - assert architecture == 'aarch64' : architecture + assert architecture == 'arm64' : architecture arch('aarch64') } } // Follow opensearch's file naming convention String jdkString = jdk ? "" : "-no-jdk" - String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}${jdk ? '' : 'no-jdk-'}${type}" + String prefix = "${architecture == 'arm64' ? 'arm64-' : ''}${jdk ? '' : 'no-jdk-'}${type}" destinationDirectory = file("${prefix}/build/distributions") // SystemPackagingTask overrides default archive task convention mappings, but doesn't provide a setter so we have to override the convention mapping itself @@ -166,7 +166,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { with libFiles() } into('modules') { - with modulesFiles('linux-' + ((architecture == 'x64') ? 'x86_64' : architecture)) + with modulesFiles('linux-' + ((architecture == 'x64') ? 'x64' : architecture)) } if (jdk) { into('jdk') { @@ -345,8 +345,8 @@ Closure commonDebConfig(boolean jdk, String architecture) { } } -tasks.register('buildAarch64Deb', Deb) { - configure(commonDebConfig(true, 'aarch64')) +tasks.register('buildArm64Deb', Deb) { + configure(commonDebConfig(true, 'arm64')) } tasks.register('buildDeb', Deb) { @@ -382,8 +382,8 @@ Closure commonRpmConfig(boolean jdk, String architecture) { } } -tasks.register('buildAarch64Rpm', Rpm) { - configure(commonRpmConfig(true, 'aarch64')) +tasks.register('buildArm64Rpm', Rpm) { + configure(commonRpmConfig(true, 'arm64')) } tasks.register('buildRpm', Rpm) { diff --git a/distribution/tools/plugin-cli/src/test/java/org/opensearch/plugins/InstallPluginCommandTests.java b/distribution/tools/plugin-cli/src/test/java/org/opensearch/plugins/InstallPluginCommandTests.java index 9608aedfd4b3e..4147fbe96264f 100644 --- a/distribution/tools/plugin-cli/src/test/java/org/opensearch/plugins/InstallPluginCommandTests.java +++ b/distribution/tools/plugin-cli/src/test/java/org/opensearch/plugins/InstallPluginCommandTests.java @@ -647,7 +647,7 @@ public void testPluginPermissions() throws Exception { final Path pluginDir = createPluginDir(temp); final Path resourcesDir = pluginDir.resolve("resources"); final Path platformDir = pluginDir.resolve("platform"); - final Path platformNameDir = platformDir.resolve("linux-x86_64"); + final Path platformNameDir = platformDir.resolve("linux-x64"); final Path platformBinDir = platformNameDir.resolve("bin"); Files.createDirectories(platformBinDir); @@ -664,7 +664,7 @@ public void testPluginPermissions() throws Exception { final Path fake = env.v2().pluginsFile().resolve("fake"); final Path resources = fake.resolve("resources"); final Path platform = fake.resolve("platform"); - final Path platformName = platform.resolve("linux-x86_64"); + final Path platformName = platform.resolve("linux-x64"); final Path bin = platformName.resolve("bin"); assert755(fake); assert644(fake.resolve("fake-" + Version.CURRENT + ".jar")); diff --git a/modules/ingest-user-agent/src/main/resources/regexes.yml b/modules/ingest-user-agent/src/main/resources/regexes.yml index ac309ae7ab5b6..1931cbc944da3 100644 --- a/modules/ingest-user-agent/src/main/resources/regexes.yml +++ b/modules/ingest-user-agent/src/main/resources/regexes.yml @@ -92,7 +92,7 @@ user_agent_parsers: # Pingdom - regex: '(Pingdom\.com_bot_version_)(\d+)\.(\d+)' family_replacement: 'PingdomBot' - # 'Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PingdomTMS/0.8.5 Safari/534.34' + # 'Mozilla/5.0 (Unknown; Linux x64) AppleWebKit/534.34 (KHTML, like Gecko) PingdomTMS/0.8.5 Safari/534.34' - regex: '(PingdomTMS)/(\d+)\.(\d+)\.(\d+)' family_replacement: 'PingdomBot' @@ -1093,8 +1093,8 @@ os_parsers: # Note, this needs to come before the windows parsers as the app doesn't # properly identify as Chrome OS # - # ex: Mozilla/5.0 (X11; Windows aarch64 10718.88.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.118 Safari/537.36 CitrixChromeApp - - regex: '(x86_64|aarch64)\ (\d+)\.(\d+)\.(\d+).*Chrome.*(?:CitrixChromeApp)$' + # ex: Mozilla/5.0 (X11; Windows arm64 10718.88.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.118 Safari/537.36 CitrixChromeApp + - regex: '(x64|arm64)\ (\d+)\.(\d+)\.(\d+).*Chrome.*(?:CitrixChromeApp)$' os_replacement: 'Chrome OS' ########## @@ -1209,27 +1209,27 @@ os_parsers: os_v2_replacement: '$2' os_v3_replacement: '$3' # Leopard - - regex: ' (Dar)(win)/(9).(\d+).*\((?:i386|x86_64|Power Macintosh)\)' + - regex: ' (Dar)(win)/(9).(\d+).*\((?:i386|x64|Power Macintosh)\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '5' # Snow Leopard - - regex: ' (Dar)(win)/(10).(\d+).*\((?:i386|x86_64)\)' + - regex: ' (Dar)(win)/(10).(\d+).*\((?:i386|x64)\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '6' # Lion - - regex: ' (Dar)(win)/(11).(\d+).*\((?:i386|x86_64)\)' + - regex: ' (Dar)(win)/(11).(\d+).*\((?:i386|x64)\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '7' # Mountain Lion - - regex: ' (Dar)(win)/(12).(\d+).*\((?:i386|x86_64)\)' + - regex: ' (Dar)(win)/(12).(\d+).*\((?:i386|x64)\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '8' # Mavericks - - regex: ' (Dar)(win)/(13).(\d+).*\((?:i386|x86_64)\)' + - regex: ' (Dar)(win)/(13).(\d+).*\((?:i386|x64)\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '9' @@ -1339,15 +1339,15 @@ os_parsers: # CFNetwork macOS Apps (must be before CFNetwork iOS Apps # @ref: https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history ########## - - regex: 'CFNetwork/.* Darwin/17\.\d+.*\(x86_64\)' + - regex: 'CFNetwork/.* Darwin/17\.\d+.*\(x64\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '13' - - regex: 'CFNetwork/.* Darwin/16\.\d+.*\(x86_64\)' + - regex: 'CFNetwork/.* Darwin/16\.\d+.*\(x64\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '12' - - regex: 'CFNetwork/8.* Darwin/15\.\d+.*\(x86_64\)' + - regex: 'CFNetwork/8.* Darwin/15\.\d+.*\(x64\)' os_replacement: 'Mac OS X' os_v1_replacement: '10' os_v2_replacement: '11' @@ -1625,7 +1625,7 @@ os_parsers: # Wget/x.x.x (linux-gnu) - regex: '\(linux-gnu\)' os_replacement: 'Linux' - - regex: '\(x86_64-redhat-linux-gnu\)' + - regex: '\(x64-redhat-linux-gnu\)' os_replacement: 'Red Hat' - regex: '\((freebsd)(\d+)\.(\d+)\)' os_replacement: 'FreeBSD' @@ -5099,7 +5099,7 @@ device_parsers: model_replacement: '$1$2,$3' # @note: newer desktop applications don't show device info # This is here so as to not have them recorded as iOS-Device - - regex: 'CFNetwork/.* Darwin/\d+\.\d+\.\d+ \(x86_64\)' + - regex: 'CFNetwork/.* Darwin/\d+\.\d+\.\d+ \(x64\)' device_replacement: 'Mac' brand_replacement: 'Apple' model_replacement: 'Mac' diff --git a/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java b/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java index 7fd07bbfb0979..2d46234c3c66b 100644 --- a/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java +++ b/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java @@ -255,7 +255,7 @@ static class Arch { static { Map m = new HashMap<>(); 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("arm64", new Arch(0xC00000B7, 0xFFFFFFFF, 1079, 1071, 221, 281, 277)); ARCHITECTURES = Collections.unmodifiableMap(m); } diff --git a/server/src/main/java/org/opensearch/plugins/Platforms.java b/server/src/main/java/org/opensearch/plugins/Platforms.java index e2831dc27d2cb..26fdbb6d56565 100644 --- a/server/src/main/java/org/opensearch/plugins/Platforms.java +++ b/server/src/main/java/org/opensearch/plugins/Platforms.java @@ -69,13 +69,13 @@ public static Path nativeControllerPath(Path plugin) { /** * Return the platform name based on the OS name and architecture, for example: - * - darwin-x86_64 - * - linux-x86-64 - * - windows-x86_64 + * - darwin-x64 + * - linux-x64 + * - windows-x64 * For *nix platforms this is more-or-less `uname -s`-`uname -m` converted to lower case. * However, for consistency between different operating systems on the same architecture - * "amd64" is replaced with "x86_64" and "i386" with "x86". - * For Windows it's "windows-" followed by either "x86" or "x86_64". + * "amd64" is replaced with "x64" and "i386" with "x86". + * For Windows it's "windows-" followed by either "x86" or "x64". */ public static String platformName(final String osName, final String osArch) { final String lowerCaseOs = osName.toLowerCase(Locale.ROOT); @@ -91,7 +91,7 @@ public static String platformName(final String osName, final String osArch) { final String lowerCaseArch = osArch.toLowerCase(Locale.ROOT); final String normalizedArch; if (lowerCaseArch.equals("amd64")) { - normalizedArch = "x86_64"; + normalizedArch = "x64"; } else if (lowerCaseArch.equals("i386")) { normalizedArch = "x86"; } else { diff --git a/server/src/test/java/org/opensearch/plugins/PluginsTests.java b/server/src/test/java/org/opensearch/plugins/PluginsTests.java index 0374a3b4b96dd..5901bd67716d5 100644 --- a/server/src/test/java/org/opensearch/plugins/PluginsTests.java +++ b/server/src/test/java/org/opensearch/plugins/PluginsTests.java @@ -50,13 +50,13 @@ public void testMakePlatformName() { } public void testMakeSpecificPlatformNames() { - assertEquals("darwin-x86_64", Platforms.platformName("Mac OS X", "x86_64")); - assertEquals("linux-x86_64", Platforms.platformName("Linux", "amd64")); + assertEquals("darwin-x64", Platforms.platformName("Mac OS X", "x64")); + assertEquals("linux-x64", Platforms.platformName("Linux", "amd64")); assertEquals("linux-x86", Platforms.platformName("Linux", "i386")); - assertEquals("windows-x86_64", Platforms.platformName("Windows Server 2008 R2", "amd64")); + assertEquals("windows-x64", Platforms.platformName("Windows Server 2008 R2", "amd64")); assertEquals("windows-x86", Platforms.platformName("Windows Server 2008", "x86")); - assertEquals("windows-x86_64", Platforms.platformName("Windows 8.1", "amd64")); - assertEquals("sunos-x86_64", Platforms.platformName("SunOS", "amd64")); + assertEquals("windows-x64", Platforms.platformName("Windows 8.1", "amd64")); + assertEquals("sunos-x64", Platforms.platformName("SunOS", "amd64")); } } diff --git a/settings.gradle b/settings.gradle index 096347b20b319..06f8cb9e9a870 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,18 +33,18 @@ List projects = [ 'distribution:archives:no-jdk-windows-zip', 'distribution:archives:darwin-tar', 'distribution:archives:no-jdk-darwin-tar', - 'distribution:archives:linux-aarch64-tar', + 'distribution:archives:linux-arm64-tar', 'distribution:archives:linux-tar', 'distribution:archives:no-jdk-linux-tar', 'distribution:docker', - 'distribution:docker:docker-aarch64-build-context', - 'distribution:docker:docker-aarch64-export', + 'distribution:docker:docker-arm64-build-context', + 'distribution:docker:docker-arm64-export', 'distribution:docker:docker-build-context', 'distribution:docker:docker-export', - 'distribution:packages:aarch64-deb', + 'distribution:packages:arm64-deb', 'distribution:packages:deb', 'distribution:packages:no-jdk-deb', - 'distribution:packages:aarch64-rpm', + 'distribution:packages:arm64-rpm', 'distribution:packages:rpm', 'distribution:packages:no-jdk-rpm', 'distribution:bwc:bugfix', From a2ad60849719af752e9c64c9fea16a7183ff8b3f Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Fri, 23 Apr 2021 17:30:24 -0700 Subject: [PATCH 2/4] Updating in a few more places Signed-off-by: Sarat Vemulapalli --- Vagrantfile | 24 +++++++++---------- .../opensearch/gradle/JdkDownloadPlugin.java | 1 + .../bootstrap/SystemCallFilter.java | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 8af16683d3e4f..a7955246088a9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -71,7 +71,7 @@ Vagrant.configure(2) do |config| 'ubuntu-1604'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/ubuntu-16.04-x64' + config.vm.box = 'elastic/ubuntu-16.04-x86_64' deb_common config, box, extra: <<-SHELL # Install Jayatana so we can work around it being present. [ -f /usr/share/java/jayatanaag.jar ] || install jayatana @@ -81,7 +81,7 @@ Vagrant.configure(2) do |config| end 'ubuntu-1804'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/ubuntu-18.04-x64' + config.vm.box = 'elastic/ubuntu-18.04-x86_64' deb_common config, box, extra: <<-SHELL # Install Jayatana so we can work around it being present. [ -f /usr/share/java/jayatanaag.jar ] || install jayatana @@ -94,7 +94,7 @@ Vagrant.configure(2) do |config| # jessie and stretch for testing debian and it works fine. 'debian-8'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/debian-8-x64' + config.vm.box = 'elastic/debian-8-x86_64' deb_common config, box, extra: <<-SHELL # this sometimes gets a bad ip, and doesn't appear to be needed rm -f /etc/apt/sources.list.d/http_debian_net_debian.list @@ -103,59 +103,59 @@ Vagrant.configure(2) do |config| end 'debian-9'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/debian-9-x64' + config.vm.box = 'elastic/debian-9-x86_64' deb_common config, box deb_docker config end end 'centos-6'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/centos-6-x64' + config.vm.box = 'elastic/centos-6-x86_64' rpm_common config, box end end 'centos-7'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/centos-7-x64' + config.vm.box = 'elastic/centos-7-x86_64' rpm_common config, box rpm_docker config end end 'oel-6'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/oraclelinux-6-x64' + config.vm.box = 'elastic/oraclelinux-6-x86_64' rpm_common config, box end end 'oel-7'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/oraclelinux-7-x64' + config.vm.box = 'elastic/oraclelinux-7-x86_64' rpm_common config, box end end 'fedora-28'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/fedora-28-x64' + config.vm.box = 'elastic/fedora-28-x86_64' dnf_common config, box dnf_docker config end end 'fedora-29'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/fedora-29-x64' + config.vm.box = 'elastic/fedora-29-x86_64' dnf_common config, box dnf_docker config end end 'sles-12'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/sles-12-x64' + config.vm.box = 'elastic/sles-12-x86_64' sles_common config, box end end 'rhel-8'.tap do |box| config.vm.define box, define_opts do |config| - config.vm.box = 'elastic/rhel-8-x64' + config.vm.box = 'elastic/rhel-8-x86_64' rpm_common config, box end end diff --git a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java index 48c86173b2b1d..f2869f7791376 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java @@ -167,6 +167,7 @@ private void setupRepository(Project project, Jdk jdk) { } private String getClassifier(Jdk jdk) { + // JDK uses aarch64 for arm64. if (jdk.getArchitecture() == "arm64") { return "aarch64"; } else { diff --git a/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java b/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java index 2d46234c3c66b..7fd07bbfb0979 100644 --- a/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java +++ b/server/src/main/java/org/opensearch/bootstrap/SystemCallFilter.java @@ -255,7 +255,7 @@ static class Arch { static { Map m = new HashMap<>(); m.put("amd64", new Arch(0xC000003E, 0x3FFFFFFF, 57, 58, 59, 322, 317)); - m.put("arm64", new Arch(0xC00000B7, 0xFFFFFFFF, 1079, 1071, 221, 281, 277)); + m.put("aarch64", new Arch(0xC00000B7, 0xFFFFFFFF, 1079, 1071, 221, 281, 277)); ARCHITECTURES = Collections.unmodifiableMap(m); } From 6fc52ede0293aaceea07776cb93b25454ed4a4db Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Sun, 25 Apr 2021 18:56:44 -0700 Subject: [PATCH 3/4] Added clean translation for OpenSearch CPU Arch to Jdk CPU Arch Signed-off-by: Sarat Vemulapalli --- .../main/java/org/opensearch/gradle/Jdk.java | 18 +++++++++++++--- .../opensearch/gradle/JdkDownloadPlugin.java | 21 +++---------------- .../gradle/JdkDownloadPluginTests.java | 2 +- distribution/build.gradle | 8 ++++++- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java index 52d842da158f9..53e28fa106134 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java @@ -48,7 +48,7 @@ public class Jdk implements Buildable, Iterable { - private static final List ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("arm64", "x64")); + private static final List ALLOWED_ARCHITECTURES = Collections.unmodifiableList(Arrays.asList("aarch64", "x64")); private static final List ALLOWED_VENDORS = Collections.unmodifiableList(Arrays.asList("adoptopenjdk", "openjdk")); private static final List ALLOWED_PLATFORMS = Collections.unmodifiableList(Arrays.asList("darwin", "linux", "windows", "mac")); private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)(\\.\\d+\\.\\d+)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?"); @@ -120,9 +120,10 @@ public String getArchitecture() { } public void setArchitecture(final String architecture) { - if (ALLOWED_ARCHITECTURES.contains(architecture) == false) { + String jdkArchitecture = translateJdkArchitecture(architecture); + if (ALLOWED_ARCHITECTURES.contains(jdkArchitecture) == false) { throw new IllegalArgumentException( - "unknown architecture [" + architecture + "] for jdk [" + name + "], must be one of " + ALLOWED_ARCHITECTURES + "unknown architecture [" + jdkArchitecture + "] for jdk [" + name + "], must be one of " + ALLOWED_ARCHITECTURES ); } this.architecture.set(architecture); @@ -229,4 +230,15 @@ private void parseVersion(String version) { hash = jdkVersionMatcher.group(5); } + private String translateJdkArchitecture(String architecture) { + /* + * Jdk uses aarch64 from ARM. Translating from arm64 to aarch64 which Jdk understands. + */ + if (architecture == "arm64") { + return "aarch64"; + } else { + return architecture; + } + } + } diff --git a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java index f2869f7791376..b8d4bcb007e8d 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java @@ -116,18 +116,14 @@ private void setupRepository(Project project, Jdk jdk) { + jdk.getBaseVersion() + "-" + jdk.getBuild() - + "/[module]/" - + getClassifier(jdk) - + "/jdk/hotspot/normal/adoptopenjdk"; + + "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk"; } else { // current pattern since JDK 9 artifactPattern = "jdk-" + jdk.getBaseVersion() + "+" + jdk.getBuild() - + "/[module]/" - + getClassifier(jdk) - + "/jdk/hotspot/normal/adoptopenjdk"; + + "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk"; } } else if (jdk.getVendor().equals(VENDOR_OPENJDK)) { repoUrl = "https://download.oracle.com"; @@ -139,9 +135,7 @@ private void setupRepository(Project project, Jdk jdk) { + jdk.getHash() + "/" + jdk.getBuild() - + "/GPL/openjdk-[revision]_[module]-" - + getClassifier(jdk) - + "_bin.[ext]"; + + "/GPL/openjdk-[revision]_[module]-[classifier]_bin.[ext]"; } else { // simpler legacy pattern from JDK 9 to JDK 12 that we are advocating to Oracle to bring back artifactPattern = "java/GA/jdk" @@ -166,15 +160,6 @@ private void setupRepository(Project project, Jdk jdk) { } } - private String getClassifier(Jdk jdk) { - // JDK uses aarch64 for arm64. - if (jdk.getArchitecture() == "arm64") { - return "aarch64"; - } else { - return "[classifier]"; - } - } - @SuppressWarnings("unchecked") public static NamedDomainObjectContainer getContainer(Project project) { return (NamedDomainObjectContainer) project.getExtensions().getByName(EXTENSION_NAME); diff --git a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java index 1a43f010e2f20..1d3ab3935c692 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java @@ -108,7 +108,7 @@ public void testUnknownArchitecture() { "11.0.2+33", "linux", "unknown", - "unknown architecture [unknown] for jdk [testjdk], must be one of [arm64, x64]" + "unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64]" ); } diff --git a/distribution/build.gradle b/distribution/build.gradle index 31e43b70d5aa8..3e242aa1a2fc0 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -252,7 +252,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { // Setup all required JDKs project.jdks { ['darwin', 'windows', 'linux'].each { platform -> - (platform == 'linux' ? ['x64', 'arm64'] : ['x64']).each { architecture -> + (platform == 'linux' ? ['x64', 'aarch64'] : ['x64']).each { architecture -> "bundled_${platform}_${architecture}" { it.platform = platform it.version = VersionProperties.getBundledJdk(platform) @@ -408,6 +408,12 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { jdkFiles = { Project project, String platform, String architecture -> return copySpec { + /* + * Jdk uses aarch64 from ARM. Translating from arm64 to aarch64 which Jdk understands. + */ + if ("arm64".equals(architecture)) { + architecture = "aarch64" + } from project.jdks."bundled_${platform}_${architecture}" exclude "demo/**" /* From 82a312895747884c937c58dccf8b66bd6db72527 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 26 Apr 2021 09:05:01 -0700 Subject: [PATCH 4/4] Addressing comments Signed-off-by: Sarat Vemulapalli --- buildSrc/src/main/java/org/opensearch/gradle/Jdk.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java index 53e28fa106134..782cfabcd65c8 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/Jdk.java @@ -234,11 +234,7 @@ private String translateJdkArchitecture(String architecture) { /* * Jdk uses aarch64 from ARM. Translating from arm64 to aarch64 which Jdk understands. */ - if (architecture == "arm64") { - return "aarch64"; - } else { - return architecture; - } + return architecture == "arm64" ? "aarch64" : architecture; } }