Build: Use dash for deb package version and underscore for rpm

This change tweaks the metadata version associated with the deb and rpm
packages. For rpm, dashes are allowed in versions, so we can use the
version as it already exists. For rpm, dashes are not allowed, so this
uses underscores instead. This only affects prerelease versions (eg
alpha/beta/rc), and usually someone doesn't specify the version, so the
inconsistency doesn't matter that much.
This commit is contained in:
Ryan Ernst 2016-05-24 12:11:13 -07:00
parent b3a8c54928
commit d505c3d5ba
3 changed files with 4 additions and 12 deletions

View File

@ -302,10 +302,6 @@ configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
'''.stripIndent().replace('\n', ' ').trim() '''.stripIndent().replace('\n', ' ').trim()
url 'https://www.elastic.co/' url 'https://www.elastic.co/'
/* The version of the package can't contain -SNAPSHOT so we rip it off if
we see it. We'll add it back on to the file name though. */
version project.version.replace('-SNAPSHOT', '')
// signing setup // signing setup
if (project.hasProperty('signing.password') && System.getProperty('build.snapshot', 'true') == 'false') { if (project.hasProperty('signing.password') && System.getProperty('build.snapshot', 'true') == 'false') {
signingKeyId = project.hasProperty('signing.keyId') ? project.property('signing.keyId') : 'D88E42B4' signingKeyId = project.hasProperty('signing.keyId') ? project.property('signing.keyId') : 'D88E42B4'

View File

@ -22,6 +22,8 @@ task buildDeb(type: Deb) {
baseName 'elasticsearch' // this is what pom generation uses for artifactId baseName 'elasticsearch' // this is what pom generation uses for artifactId
// Follow elasticsearch's deb file naming convention // Follow elasticsearch's deb file naming convention
archiveName "${packageName}-${project.version}.deb" archiveName "${packageName}-${project.version}.deb"
version = project.version
packageGroup 'web' packageGroup 'web'
requires 'libc6' requires 'libc6'
requires 'adduser' requires 'adduser'

View File

@ -25,14 +25,8 @@ task buildRpm(type: Rpm) {
packageGroup 'Application/Internet' packageGroup 'Application/Internet'
prefix '/usr' prefix '/usr'
packager 'Elasticsearch' packager 'Elasticsearch'
if (version.contains('~')) { version = project.version.replace('-', '_')
def tokenized = version.tokenize('~') release = '1'
version tokenized[0]
release tokenized[1]
} else {
version version
release '1'
}
arch 'NOARCH' arch 'NOARCH'
os 'LINUX' os 'LINUX'
license '2009' license '2009'