Skip to content

Commit bbfc6d2

Browse files
authored
Update licenses and attributions for GeoIP module (#75178)
Update licenses and attributions for GeoIP module
1 parent b3ddec7 commit bbfc6d2

13 files changed

+473
-209
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.HashMap;
3535
import java.util.HashSet;
3636
import java.util.LinkedHashMap;
37+
import java.util.LinkedHashSet;
3738
import java.util.List;
3839
import java.util.Locale;
3940
import java.util.Map;
@@ -114,6 +115,11 @@ public class DependencyLicensesTask extends DefaultTask {
114115
*/
115116
private Set<String> ignoreShas = new HashSet<>();
116117

118+
/**
119+
* Names of files that should be ignored by the check
120+
*/
121+
private LinkedHashSet<String> ignoreFiles = new LinkedHashSet<>();
122+
117123
/**
118124
* Add a mapping from a regex pattern for the jar name, to a prefix to find
119125
* the LICENSE and NOTICE file for that jar.
@@ -164,6 +170,13 @@ public void ignoreSha(String dep) {
164170
ignoreShas.add(dep);
165171
}
166172

173+
/**
174+
* Add a file that should be ignored by the check. This should be used for additional license files not tied to jar dependency
175+
*/
176+
public void ignoreFile(String file) {
177+
ignoreFiles.add(file);
178+
}
179+
167180
@TaskAction
168181
public void checkDependencies() throws IOException, NoSuchAlgorithmException {
169182
if (dependencies == null) {
@@ -202,6 +215,10 @@ public void checkDependencies() throws IOException, NoSuchAlgorithmException {
202215
}
203216
}
204217

218+
licenses.keySet().removeAll(ignoreFiles);
219+
notices.keySet().removeAll(ignoreFiles);
220+
sources.keySet().removeAll(ignoreFiles);
221+
205222
checkDependencies(licenses, notices, sources, shaFiles);
206223

207224
licenses.forEach((item, exists) -> failIfAnyMissing(item, exists, "license"));
@@ -338,6 +355,12 @@ private String getFileName(String name, Map<String, ?> counters, String type) {
338355
return fileName;
339356
}
340357

358+
@Input
359+
@Optional
360+
public LinkedHashSet<String> getIgnoreFiles() {
361+
return new LinkedHashSet<>(ignoreFiles);
362+
}
363+
341364
@Input
342365
public LinkedHashMap<String, String> getMappings() {
343366
return new LinkedHashMap<>(mappings);

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/LicenseAnalyzer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,15 @@ public class LicenseAnalyzer {
151151
new LicenseMatcher("EPL-2.0", true, false, Pattern.compile("Eclipse Public License - v 2.0", Pattern.DOTALL)),
152152
new LicenseMatcher("EDL-1.0", true, false, Pattern.compile("Eclipse Distribution License - v 1.0", Pattern.DOTALL)),
153153
new LicenseMatcher("LGPL-2.1", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 2.1", Pattern.DOTALL)),
154-
new LicenseMatcher("LGPL-3.0", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 3", Pattern.DOTALL)) };
154+
new LicenseMatcher("LGPL-3.0", true, true, Pattern.compile("GNU LESSER GENERAL PUBLIC LICENSE.*Version 3", Pattern.DOTALL)),
155+
new LicenseMatcher("GeoLite", false, false,
156+
Pattern.compile("The Elastic GeoIP Database Service uses the GeoLite2 Data created " +
157+
"and licensed by MaxMind,\nwhich is governed by MaxMind’s GeoLite2 End User License Agreement, " +
158+
"available at https://www.maxmind.com/en/geolite2/eula.\n", Pattern.DOTALL)),
159+
new LicenseMatcher("GeoIp-Database-Service", false, false,
160+
Pattern.compile("By using the GeoIP Database Service, you agree to the Elastic GeoIP Database Service Agreement,\n" +
161+
"available at www.elastic.co/elastic-geoip-database-service-terms.", Pattern.DOTALL))};
162+
155163

156164
public static LicenseInfo licenseType(File licenseFile) {
157165
for (LicenseMatcher matcher : matchers) {

modules/ingest-geoip/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,9 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
101101
tasks.named("forbiddenPatterns").configure {
102102
exclude '**/*.mmdb'
103103
}
104+
105+
tasks.named("dependencyLicenses").configure {
106+
mapping from: /geoip.*/, to: 'maxmind-geolite2-eula'
107+
mapping from: /maxmind-db.*/, to: 'maxmind-db-reader'
108+
ignoreFile 'elastic-geoip-database-service-agreement-LICENSE.txt'
109+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
By using the GeoIP Database Service, you agree to the Elastic GeoIP Database Service Agreement,
2+
available at www.elastic.co/elastic-geoip-database-service-terms.

modules/ingest-geoip/licenses/geoip2-LICENSE.txt

Lines changed: 0 additions & 202 deletions
This file was deleted.

modules/ingest-geoip/licenses/geoip2-NOTICE.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

modules/ingest-geoip/licenses/maxmind-db-NOTICE.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This software is Copyright (c) 2014-2020 by MaxMind, Inc. This is free software, licensed under the Apache License, Version 2.0.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The Elastic GeoIP Database Service uses the GeoLite2 Data created and licensed by MaxMind,
2+
which is governed by MaxMind’s GeoLite2 End User License Agreement, available at https://www.maxmind.com/en/geolite2/eula.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This product includes the GeoLite2 Data created by MaxMind, available at https://www.maxmind.com.

0 commit comments

Comments
 (0)