2015-11-02 20:48:15 -05:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2017-12-11 15:40:10 -05:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
|
|
|
|
2015-11-02 20:48:15 -05:00
|
|
|
task buildRpm(type: Rpm) {
|
2016-11-07 18:29:35 -05:00
|
|
|
dependsOn preparePackagingFiles
|
2015-11-28 14:30:49 -05:00
|
|
|
baseName 'elasticsearch' // this is what pom generation uses for artifactId
|
2015-11-05 15:47:54 -05:00
|
|
|
// Follow elasticsearch's rpm file naming convention
|
2015-11-25 19:21:38 -05:00
|
|
|
archiveName "${packageName}-${project.version}.rpm"
|
2015-11-05 15:47:54 -05:00
|
|
|
packageGroup 'Application/Internet'
|
|
|
|
prefix '/usr'
|
|
|
|
packager 'Elasticsearch'
|
2016-05-24 15:11:13 -04:00
|
|
|
version = project.version.replace('-', '_')
|
|
|
|
release = '1'
|
2016-04-02 04:38:34 -04:00
|
|
|
arch 'NOARCH'
|
|
|
|
os 'LINUX'
|
|
|
|
license '2009'
|
|
|
|
distribution 'Elasticsearch'
|
|
|
|
vendor 'Elasticsearch'
|
2016-04-18 17:31:28 -04:00
|
|
|
dirMode 0755
|
|
|
|
fileMode 0644
|
2016-05-05 17:21:14 -04:00
|
|
|
addParentDirs false
|
2015-11-05 15:47:54 -05:00
|
|
|
// TODO ospackage doesn't support icon but we used to have one
|
2016-09-13 10:37:19 -04:00
|
|
|
|
|
|
|
// Declare the folders so that the RPM package manager removes
|
|
|
|
// them when upgrading or removing the package
|
|
|
|
directory('/usr/share/elasticsearch/bin', 0755)
|
|
|
|
directory('/usr/share/elasticsearch/lib', 0755)
|
|
|
|
directory('/usr/share/elasticsearch/modules', 0755)
|
|
|
|
modulesFiles.eachFile { FileCopyDetails fcp ->
|
|
|
|
if (fcp.name == "plugin-descriptor.properties") {
|
|
|
|
directory('/usr/share/elasticsearch/modules/' + fcp.file.parentFile.name, 0755)
|
|
|
|
}
|
|
|
|
}
|
2015-11-02 20:48:15 -05:00
|
|
|
}
|
2015-11-03 01:19:29 -05:00
|
|
|
|
2015-11-02 20:48:15 -05:00
|
|
|
artifacts {
|
2015-11-25 19:21:38 -05:00
|
|
|
'default' buildRpm
|
2016-03-18 20:22:25 -04:00
|
|
|
archives buildRpm
|
2015-11-02 20:48:15 -05:00
|
|
|
}
|
2015-11-03 01:19:29 -05:00
|
|
|
|
2017-12-11 15:40:10 -05:00
|
|
|
integTest.enabled = false
|
|
|
|
licenseHeaders.enabled = false
|
|
|
|
|
|
|
|
// task that sanity checks if the RPM archive can be extracted
|
|
|
|
task checkRpm(type: LoggedExec) {
|
|
|
|
onlyIf { new File('/bin/rpm').exists() || new File('/usr/bin/rpm').exists() || new File('/usr/local/bin/rpm').exists() }
|
|
|
|
final File rpmDatabase = new File("${buildDir}", 'rpm-database')
|
|
|
|
final File rpmExtracted = new File("${buildDir}", 'rpm-extracted')
|
|
|
|
commandLine 'rpm',
|
|
|
|
'--badreloc',
|
|
|
|
'--nodeps',
|
|
|
|
'--noscripts',
|
|
|
|
'--notriggers',
|
|
|
|
'--dbpath',
|
|
|
|
rpmDatabase,
|
|
|
|
'--relocate',
|
|
|
|
"/=${rpmExtracted}",
|
|
|
|
'-i',
|
|
|
|
"${buildDir}/distributions/elasticsearch-${project.version}.rpm"
|
|
|
|
doFirst {
|
|
|
|
rpmDatabase.deleteDir()
|
|
|
|
rpmExtracted.deleteDir()
|
|
|
|
}
|
2015-11-25 19:21:38 -05:00
|
|
|
}
|
2017-12-11 15:40:10 -05:00
|
|
|
|
|
|
|
checkRpm.dependsOn buildRpm
|
|
|
|
check.dependsOn checkRpm
|