Skip to content

Commit

Permalink
[Rename] refactor the distribution module. (#316)
Browse files Browse the repository at this point in the history
Refactor the `distribution` module to rename elasticsearch to opensearch. The commit doesn't rename the files in the `src/bin` directory as git doesn't detect `git mv`, so that change will be done in a subsequent commit.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
  • Loading branch information
adnapibar authored and nknize committed Mar 22, 2021
1 parent 7fd65d1 commit 7c32313
Show file tree
Hide file tree
Showing 90 changed files with 751 additions and 722 deletions.
8 changes: 4 additions & 4 deletions distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* under the License.
*/

apply plugin: 'elasticsearch.internal-distribution-archive-setup'
apply plugin: 'opensearch.internal-distribution-archive-setup'

CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean jdk) {
return copySpec {
into("elasticsearch-${version}") {
into("opensearch-${version}") {
into('lib') {
with libFiles()
}
Expand Down Expand Up @@ -129,7 +129,7 @@ distribution_archives {

subprojects {
apply plugin: 'distribution'
apply plugin: 'elasticsearch.internal-distribution-archive-check'
apply plugin: 'opensearch.internal-distribution-archive-check'

group = "org.elasticsearch.distribution.oss"
group = "org.opensearch.distribution.oss"
}
14 changes: 7 additions & 7 deletions distribution/archives/integ-test-zip/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.elasticsearch.gradle.MavenFilteringHack
import org.opensearch.gradle.MavenFilteringHack

apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.rest-test'

// The integ-test-distribution is published to maven
apply plugin: 'elasticsearch.publish'
apply plugin: 'opensearch.publish'

group = "org.elasticsearch.distribution.integ-test-zip"
group = "org.opensearch.distribution.integ-test-zip"

integTest {
dependsOn assemble
Expand All @@ -35,8 +35,8 @@ processTestResources {
MavenFilteringHack.filter(it, project(':distribution').restTestExpansions)
}

// make the pom file name use elasticsearch instead of the project name
archivesBaseName = "elasticsearch"
// make the pom file name use opensearch instead of the project name
archivesBaseName = "opensearch"
ext.buildDist = parent.tasks.named("buildIntegTestZip")

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

package org.elasticsearch.test.rest;
package org.opensearch.test.rest;

import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request;
import org.opensearch.client.Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.elasticsearch.test.rest;
package org.opensearch.test.rest;

import org.elasticsearch.common.logging.JsonLogsIntegTestCase;
import org.hamcrest.Matcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

package org.elasticsearch.test.rest;
package org.opensearch.test.rest;

import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request;
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

package org.elasticsearch.test.rest;
package org.opensearch.test.rest;

import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.ResponseException;
import org.opensearch.client.Request;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* under the License.
*/

package org.elasticsearch.test.rest;
package org.opensearch.test.rest;

import org.apache.http.util.EntityUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.action.ActionFuture;
import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.client.Request;
Expand Down
68 changes: 34 additions & 34 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@


import org.apache.tools.ant.filters.FixCrLfFilter
import org.elasticsearch.gradle.ConcatFilesTask
import org.elasticsearch.gradle.DependenciesInfoTask
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.NoticeTask
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.ConcatFilesTask
import org.opensearch.gradle.DependenciesInfoTask
import org.opensearch.gradle.MavenFilteringHack
import org.opensearch.gradle.NoticeTask
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.info.BuildParams

import java.nio.file.Files
import java.nio.file.Path
Expand All @@ -41,7 +41,7 @@ tasks.register("generateDependenciesReport", ConcatFilesTask) {
dependsOn rootProject.allprojects.collect { it.tasks.withType(DependenciesInfoTask) }
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv')
headerLine = "name,version,url,license,sourceURL"
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/opensearch-dependencies.csv")

// explicitly add our dependency on the JDK
String jdkVersion = VersionProperties.versions.get('bundled_jdk')
Expand Down Expand Up @@ -170,7 +170,7 @@ void copyModule(TaskProvider<Sync> copyTask, Project module) {
exclude 'config/log4j2.properties'

eachFile { details ->
String name = module.plugins.hasPlugin('elasticsearch.esplugin') ? module.esplugin.name : module.es_meta_plugin.name
String name = module.plugins.hasPlugin('opensearch.opensearchplugin') ? module.opensearchplugin.name : module.opensearch_meta_plugin.name
// Copy all non config/bin files
// Note these might be unde a subdirectory in the case of a meta plugin
if ((details.relativePath.pathString ==~ /([^\/]+\/)?(config|bin)\/.*/) == false) {
Expand Down Expand Up @@ -275,8 +275,8 @@ project(':test:external-modules').subprojects.each { Project testModule ->

configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {

apply plugin: 'elasticsearch.jdk-download'
apply plugin: 'elasticsearch.repositories'
apply plugin: 'opensearch.jdk-download'
apply plugin: 'opensearch.repositories'

// Setup all required JDKs
project.jdks {
Expand Down Expand Up @@ -312,7 +312,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {

dependencies {
libs project(':server')
libs project(':libs:elasticsearch-plugin-classloader')
libs project(':libs:opensearch-plugin-classloader')
libs project(':distribution:tools:java-version-checker')
libs project(':distribution:tools:launchers')

Expand Down Expand Up @@ -461,7 +461,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {

/**
* Build some variables that are replaced in the packages. This includes both
* scripts like bin/elasticsearch and bin/elasticsearch-plugin that a user might run and also
* scripts like bin/opensearch and bin/opensearch-plugin that a user might run and also
* scripts like postinst which are run as part of the installation.
*
* <dl>
Expand All @@ -473,27 +473,27 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
* <dt>path.conf</dt>
* <dd>The default directory from which to load configuration. This is used in
* the packaging scripts, but in that context it is always
* /etc/elasticsearch. Its also used in bin/elasticsearch-plugin, where it is
* /etc/elasticsearch for the os packages but $ESHOME/config otherwise.</dd>
* /etc/opensearch. Its also used in bin/opensearch-plugin, where it is
* /etc/opensearch for the os packages but $OPENSEARCHHOME/config otherwise.</dd>
* <dt>path.env</dt>
* <dd>The env file sourced before bin/elasticsearch to set environment
* variables. Think /etc/defaults/elasticsearch.</dd>
* <dd>The env file sourced before bin/opensearch to set environment
* variables. Think /etc/defaults/opensearch.</dd>
* <dt>heap.min and heap.max</dt>
* <dd>Default min and max heap</dd>
* <dt>scripts.footer</dt>
* <dd>Footer appended to control scripts embedded in the distribution that is
* (almost) entirely there for cosmetic reasons.</dd>
* <dt>stopping.timeout</dt>
* <dd>RPM's init script needs to wait for elasticsearch to stop before
* <dd>RPM's init script needs to wait for opensearch to stop before
* returning from stop and it needs a maximum time to wait. This is it. One
* day. DEB retries forever.</dd>
* </dl>
*/
subprojects {
ext.expansionsForDistribution = { distributionType, jdk ->
final String defaultHeapSize = "1g"
final String packagingPathData = "path.data: /var/lib/elasticsearch"
final String pathLogs = "/var/log/elasticsearch"
final String packagingPathData = "path.data: /var/lib/opensearch"
final String pathLogs = "/var/log/opensearch"
final String packagingPathLogs = "path.logs: ${pathLogs}"
final String packagingLoggc = "${pathLogs}/gc.log"

Expand All @@ -508,26 +508,26 @@ subprojects {
'project.version': version,

'path.conf': [
'deb': '/etc/elasticsearch',
'rpm': '/etc/elasticsearch',
'def': '"$ES_HOME"/config'
'deb': '/etc/opensearch',
'rpm': '/etc/opensearch',
'def': '"$OPENSEARCH_HOME"/config'
],
'path.data': [
'deb': packagingPathData,
'rpm': packagingPathData,
'def': '#path.data: /path/to/data'
],
'path.env': [
'deb': '/etc/default/elasticsearch',
'rpm': '/etc/sysconfig/elasticsearch',
'deb': '/etc/default/opensearch',
'rpm': '/etc/sysconfig/opensearch',
/* There isn't one of these files for tar or zip but its important to
make an empty string here so the script can properly skip it. */
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; done',
],
'source.path.env': [
'deb': 'source /etc/default/elasticsearch',
'rpm': 'source /etc/sysconfig/elasticsearch',
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
'deb': 'source /etc/default/opensearch',
'rpm': 'source /etc/sysconfig/opensearch',
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; fi',
],
'path.logs': [
'deb': packagingPathLogs,
Expand All @@ -544,14 +544,14 @@ subprojects {
'heap.max': defaultHeapSize,

'heap.dump.path': [
'deb': "-XX:HeapDumpPath=/var/lib/elasticsearch",
'rpm': "-XX:HeapDumpPath=/var/lib/elasticsearch",
'deb': "-XX:HeapDumpPath=/var/lib/opensearch",
'rpm': "-XX:HeapDumpPath=/var/lib/opensearch",
'def': "-XX:HeapDumpPath=data"
],

'error.file': [
'deb': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
'rpm': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
'deb': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
'rpm': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
'def': "-XX:ErrorFile=logs/hs_err_pid%p.log"
],

Expand All @@ -566,14 +566,14 @@ subprojects {
'def': footer
],

'es.distribution.type': [
'opensearch.distribution.type': [
'deb': 'deb',
'rpm': 'rpm',
'tar': 'tar',
'zip': 'zip'
],

'es.bundled_jdk': [
'opensearch.bundled_jdk': [
'def': jdk ? 'true' : 'false'
],

Expand Down
8 changes: 4 additions & 4 deletions distribution/bwc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* under the License.
*/

apply plugin:"elasticsearch.internal-distribution-bwc-setup"
apply plugin:"opensearch.internal-distribution-bwc-setup"

import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.Version
import org.opensearch.gradle.info.BuildParams


BuildParams.getBwcVersions().forPreviousUnreleased { unreleasedVersion ->
Expand All @@ -36,4 +36,4 @@ BuildParams.getBwcVersions().forPreviousUnreleased { unreleasedVersion ->
}
}
}
}
}
Loading

0 comments on commit 7c32313

Please sign in to comment.