Packaging: Add license specifications to packages

This commit adds license metadata to rpm and deb packages. Additionally,
it makes the copyright file for deb files follow the machine readable
specification, and sets the correct license text based on the oss vs
default deb packages.
This commit is contained in:
Ryan Ernst 2018-04-09 15:20:01 -07:00
parent 9a45662309
commit 1fb2d08b31
3 changed files with 34 additions and 19 deletions

View File

@ -362,6 +362,15 @@ subprojects {
final String packagingPathLogs = "path.logs: ${pathLogs}"
final String packagingLoggc = "${pathLogs}/gc.log"
String licenseText
if (oss) {
licenseText = rootProject.file('LICENSE.txt').getText('UTF-8')
} else {
licenseText = rootProject.file('x-pack/LICENSE.txt').getText('UTF-8')
}
// license text needs to be indented with a single space
licenseText = ' ' + licenseText.replace('\n', '\n ')
String footer = "# Built for ${project.name}-${project.version} " +
"(${distributionType})"
Map<String, Object> expansions = [
@ -429,7 +438,15 @@ subprojects {
'es.distribution.flavor': [
'def': oss ? 'oss' : 'default'
]
],
'license.name': [
'deb': oss ? 'ASL-2.0' : 'Elastic-License'
],
'license.text': [
'deb': licenseText,
],
]
Map<String, String> result = [:]
expansions = expansions.each { key, value ->

View File

@ -244,6 +244,12 @@ Closure commonDebConfig(boolean oss) {
return {
configure(commonPackageConfig('deb', oss))
if (oss) {
license 'ASL 2.0'
} else {
license 'Elastic License'
}
version = project.version
packageGroup 'web'
requires 'bash'
@ -272,6 +278,12 @@ Closure commonRpmConfig(boolean oss) {
return {
configure(commonPackageConfig('rpm', oss))
if (oss) {
license 'ASL-2.0'
} else {
license 'Elastic-License'
}
packageGroup 'Application/Internet'
requires '/bin/bash'
@ -281,7 +293,6 @@ Closure commonRpmConfig(boolean oss) {
release = '1'
arch 'NOARCH'
os 'LINUX'
license '2009'
distribution 'Elasticsearch'
vendor 'Elasticsearch'
// TODO ospackage doesn't support icon but we used to have one

View File

@ -1,17 +1,4 @@
Copyright 2013-2018 Elasticsearch <info@elastic.co>
License: Apache-2.0
Licensed 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.
.
On Debian systems, the complete text of the Apache version 2.0 license
can be found in "/usr/share/common-licenses/Apache-2.0".
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Copyright: Elasticsearch B.V. <info@elastic.co>
License: ${license.name}
${license.text}