Bläddra i källkod

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.
Ryan Ernst 7 år sedan
förälder
incheckning
1fb2d08b31
3 ändrade filer med 34 tillägg och 19 borttagningar
  1. 18 1
      distribution/build.gradle
  2. 12 1
      distribution/packages/build.gradle
  3. 4 17
      distribution/packages/src/deb/copyright

+ 18 - 1
distribution/build.gradle

@@ -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 ->

+ 12 - 1
distribution/packages/build.gradle

@@ -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

+ 4 - 17
distribution/packages/src/deb/copyright

@@ -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}