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

View File

@ -60,11 +60,12 @@ class ClusterFormationTasks {
/** Adds a dependency on the given distribution */ /** Adds a dependency on the given distribution */
static void configureDistributionDependency(Project project, String distro) { static void configureDistributionDependency(Project project, String distro) {
String elasticsearchVersion = VersionProperties.elasticsearch String elasticsearchVersion = VersionProperties.elasticsearch
String packaging = distro == 'tar' ? 'tar.gz' : distro
project.configurations { project.configurations {
elasticsearchDistro elasticsearchDistro
} }
project.dependencies { 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') File rpmExtracted = new File(node.baseDir, 'rpm-extracted')
/* Delay reading the location of the rpm file until task execution */ /* Delay reading the location of the rpm file until task execution */
Object rpm = "${ -> project.configurations.elasticsearchDistro.singleFile}" 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', commandLine 'rpm', '--badreloc', '--nodeps', '--noscripts', '--notriggers',
'--dbpath', rpmDatabase, '--dbpath', rpmDatabase,
'--relocate', "/=${rpmExtracted}", '--relocate', "/=${rpmExtracted}",
'-i', rpm '-i', rpm
standardOutput = new ByteArrayOutputStream() doFirst {
errorOutput = standardOutput rpmDatabase.deleteDir()
/* rpm complains about the database being corrupted and exits. But it gets far rpmExtracted.deleteDir()
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}")
}
} }
} }
break; break;
@ -179,8 +172,11 @@ class ClusterFormationTasks {
/* Delay reading the location of the deb file until task execution */ /* Delay reading the location of the deb file until task execution */
File debExtracted = new File(node.baseDir, 'deb-extracted') File debExtracted = new File(node.baseDir, 'deb-extracted')
Object deb = "${ -> project.configurations.elasticsearchDistro.singleFile}" 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 commandLine 'dpkg-deb', '-x', deb, debExtracted
doFirst {
debExtracted.deleteDir()
}
} }
break; break;
default: default: