Skip to content

Commit 1fb2d08

Browse files
committed
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.
1 parent 9a45662 commit 1fb2d08

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

distribution/build.gradle

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,15 @@ subprojects {
362362
final String packagingPathLogs = "path.logs: ${pathLogs}"
363363
final String packagingLoggc = "${pathLogs}/gc.log"
364364

365+
String licenseText
366+
if (oss) {
367+
licenseText = rootProject.file('LICENSE.txt').getText('UTF-8')
368+
} else {
369+
licenseText = rootProject.file('x-pack/LICENSE.txt').getText('UTF-8')
370+
}
371+
// license text needs to be indented with a single space
372+
licenseText = ' ' + licenseText.replace('\n', '\n ')
373+
365374
String footer = "# Built for ${project.name}-${project.version} " +
366375
"(${distributionType})"
367376
Map<String, Object> expansions = [
@@ -429,7 +438,15 @@ subprojects {
429438

430439
'es.distribution.flavor': [
431440
'def': oss ? 'oss' : 'default'
432-
]
441+
],
442+
443+
'license.name': [
444+
'deb': oss ? 'ASL-2.0' : 'Elastic-License'
445+
],
446+
447+
'license.text': [
448+
'deb': licenseText,
449+
],
433450
]
434451
Map<String, String> result = [:]
435452
expansions = expansions.each { key, value ->

distribution/packages/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ Closure commonDebConfig(boolean oss) {
244244
return {
245245
configure(commonPackageConfig('deb', oss))
246246

247+
if (oss) {
248+
license 'ASL 2.0'
249+
} else {
250+
license 'Elastic License'
251+
}
252+
247253
version = project.version
248254
packageGroup 'web'
249255
requires 'bash'
@@ -272,6 +278,12 @@ Closure commonRpmConfig(boolean oss) {
272278
return {
273279
configure(commonPackageConfig('rpm', oss))
274280

281+
if (oss) {
282+
license 'ASL-2.0'
283+
} else {
284+
license 'Elastic-License'
285+
}
286+
275287
packageGroup 'Application/Internet'
276288
requires '/bin/bash'
277289

@@ -281,7 +293,6 @@ Closure commonRpmConfig(boolean oss) {
281293
release = '1'
282294
arch 'NOARCH'
283295
os 'LINUX'
284-
license '2009'
285296
distribution 'Elasticsearch'
286297
vendor 'Elasticsearch'
287298
// TODO ospackage doesn't support icon but we used to have one
Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
Copyright 2013-2018 Elasticsearch <[email protected]>
2-
3-
License: Apache-2.0
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
.
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
.
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
.
16-
On Debian systems, the complete text of the Apache version 2.0 license
17-
can be found in "/usr/share/common-licenses/Apache-2.0".
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Copyright: Elasticsearch B.V. <[email protected]>
3+
License: ${license.name}
4+
${license.text}

0 commit comments

Comments
 (0)