Remove strange checks and clean dirs

This commit is contained in:
Nik Everett 2015-11-28 19:44:24 -05:00
parent 45e71329ee
commit eba594fc08
1 changed files with 10 additions and 14 deletions

View File

@ -60,11 +60,12 @@ class ClusterFormationTasks {
/** Adds a dependency on the given distribution */
static void configureDistributionDependency(Project project, String distro) {
String elasticsearchVersion = VersionProperties.elasticsearch
String packaging = distro == 'tar' ? 'tar.gz' : distro
project.configurations {
elasticsearchDistro
}
project.dependencies {
elasticsearchDistro "org.elasticsearch.distribution.${distro}:elasticsearch:${elasticsearchVersion}"
elasticsearchDistro "org.elasticsearch.distribution.${distro}:elasticsearch:${elasticsearchVersion}@${packaging}"
}
}
@ -156,22 +157,14 @@ class ClusterFormationTasks {
File rpmExtracted = new File(node.baseDir, 'rpm-extracted')
/* Delay reading the location of the rpm file until task execution */
Object rpm = "${ -> project.configurations.elasticsearchDistro.singleFile}"
extract = project.tasks.create(name: name, type: Exec, dependsOn: extractDependsOn) {
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
commandLine 'rpm', '--badreloc', '--nodeps', '--noscripts', '--notriggers',
'--dbpath', rpmDatabase,
'--relocate', "/=${rpmExtracted}",
'-i', rpm
standardOutput = new ByteArrayOutputStream()
errorOutput = standardOutput
/* rpm complains about the database being corrupted and exits. But it gets far
enough for us to use it as an extractor. This is kind of funky but it works
and its how Elasticsearch's maven build used to do it. */
ignoreExitValue true
doLast {
String out = standardOutput.toString()
if (out.indexOf('DB_RUNRECOVERY') < 0) {
throw new GradleException("Didn't detect the usual error message when exracting the rpm. Something went wrong? Output:\n${out}")
}
doFirst {
rpmDatabase.deleteDir()
rpmExtracted.deleteDir()
}
}
break;
@ -179,8 +172,11 @@ class ClusterFormationTasks {
/* Delay reading the location of the deb file until task execution */
File debExtracted = new File(node.baseDir, 'deb-extracted')
Object deb = "${ -> project.configurations.elasticsearchDistro.singleFile}"
extract = project.tasks.create(name: name, type: Exec, dependsOn: extractDependsOn) {
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
commandLine 'dpkg-deb', '-x', deb, debExtracted
doFirst {
debExtracted.deleteDir()
}
}
break;
default: