hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject hbase git commit: HBASE-16351 Improve error reporting for license failures
Date Wed, 21 Jun 2017 21:45:29 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 3f9ba2f24 -> 64f41f1b5


HBASE-16351 Improve error reporting for license failures

Signed-off-by: Sean Busbey <busbey@apache.org>

 Conflicts:
	hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
	hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
	pom.xml


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/64f41f1b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/64f41f1b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/64f41f1b

Branch: refs/heads/branch-1.2
Commit: 64f41f1b50be9e75c25dd6078cc9a33850878aa9
Parents: 3f9ba2f
Author: Mike Drob <mdrob@apache.org>
Authored: Fri Jun 16 21:53:13 2017 -0500
Committer: Sean Busbey <busbey@apache.org>
Committed: Wed Jun 21 16:26:37 2017 -0500

----------------------------------------------------------------------
 .../src/main/resources/META-INF/LICENSE.vm      | 30 ++++++++---
 .../src/main/resources/META-INF/NOTICE.vm       | 17 ++++++
 pom.xml                                         | 57 ++++++++++++++++++++
 3 files changed, 96 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/64f41f1b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
----------------------------------------------------------------------
diff --git a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
index 2fa1b38..0da58a5 100644
--- a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
+++ b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
@@ -1624,7 +1624,27 @@ ${dep.scm.url}
 #thrift_license()
 #end
 ## Note that this will fail the build if we don't have a license. update supplemental-models.
-#if( !(${dep.licenses[0].name.contains("Apache License, Version 2.0")}) )
+#if( ${dep.licenses.isEmpty()} )
+--
+ERROR: ${dep.name} dependency found without license information!
+
+Please find the appropriate license and update supplemental-models.xml or
+revert the change that added this dependency.
+
+More info on the dependency:
+
+<groupId>${dep.groupId}</groupId>
+<artifactId>${dep.artifactId}</artifactId>
+<version>${dep.version}</version>
+
+maven central search
+g:${dep.groupId} AND a:${dep.artifactId} AND v:${dep.version}
+
+project website
+${dep.url}
+project source
+${dep.scm.url}
+#elseif( !(${dep.licenses[0].name.contains("Apache License, Version 2.0")} || ${dep.licenses[0].name.contains("The
Apache Software License, Version 2.0")}) )
 #if( ${dep.licenses[0].name.contains("CDDL")} )
 #if( ${dep.licenses[0].name.contains("1.0")} )
 #set($aggregated = $cddl_1_0.add($dep))
@@ -1650,7 +1670,7 @@ This product includes ${dep.name} licensed under the ${dep.licenses[0].name}.
 
 ${dep.licenses[0].comments}
 #if(!(${non_aggregate_fine.contains($dep.licenses[0].name)}))
-Please check ^^^^^^^^^^^^ this License for acceptability here:
+ERROR: Please check ^^^^^^^^^^^^ this License for acceptability here:
 
 https://www.apache.org/legal/resolved
 
@@ -1670,12 +1690,6 @@ project website
 ${dep.url}
 project source
 ${dep.scm.url}
-
-## fail the template. If you're looking at the source LICENSE.vm
-## file based on a stacktrace or exception message, you need to find
-## the generated LICENSE file that has the actual dependency info printed.
-#set($empty = [])
-${empty[0]}
 #end
 #end
 #end

http://git-wip-us.apache.org/repos/asf/hbase/blob/64f41f1b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
----------------------------------------------------------------------
diff --git a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
index 368e847..56f84500 100644
--- a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
+++ b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
@@ -272,6 +272,22 @@ JRuby's licence.
 #if(${dep.artifactId.equals("jruby-complete")})
 #set($jruby=true)
 #end
+#if( ${dep.licenses.isEmpty()} )
+ERROR: This product includes ${dep.name} which has no licenses!
+Revert the change if invalid or if intentional add license info to supplemental-models.xml
+
+<groupId>${dep.groupId}</groupId>
+<artifactId>${dep.artifactId}</artifactId>
+<version>${dep.version}</version>
+
+maven central search
+g:${dep.groupId} AND a:${dep.artifactId} AND v:${dep.version}
+
+project website
+${dep.url}
+project source
+${dep.scm.url}
+#else
 #if( !(${dep.licenses[0].name.contains("BSD")} || ${dep.licenses[0].name.contains("MIT")})
)
 #if( !(${dep.licenses[0].name.equals("Public Domain")}) )
 #if( !(${dep.licenses[0].name.contains("Apache Software License, Version 2.0")}) )
@@ -303,6 +319,7 @@ For source see '${dep.url}'.
 #end
 #end
 #end
+#end
 ## Print out jetty
 #if(${jetty})
 #jetty_notice(${jetty-with-crypt})

http://git-wip-us.apache.org/repos/asf/hbase/blob/64f41f1b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0da526a..4d946db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -819,6 +819,24 @@
     </pluginManagement>
     <plugins>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>negate-license-bundles-property</id>
+            <goals>
+              <goal>bsh-property</goal>
+            </goals>
+            <configuration>
+              <source>skip.license.check = !${license.bundles.dependencies};</source>
+              <properties>
+                <property>skip.license.check</property>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
         <dependencies>
@@ -882,6 +900,41 @@
               </rules>
             </configuration>
           </execution>
+          <execution>
+            <id>check-aggregate-license</id>
+            <!-- must check after LICENSE is built at 'generate-resources' -->
+            <phase>process-resources</phase>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <evaluateBeanshell>
+                  <condition>
+                    File license = new File("${license.aggregate.path}");
+
+                    // Beanshell does not support try-with-resources,
+                    // so we must close this scanner manually
+                    Scanner scanner = new Scanner(license);
+
+                    while (scanner.hasNextLine()) {
+                      if (scanner.nextLine().startsWith("ERROR:")) {
+                        scanner.close();
+                        return false;
+                      }
+                    }
+                    scanner.close();
+                    return true;
+                  </condition>
+                  <message>
+                    License errors detected, for more detail find ERROR in
+                    ${license.aggregate.path}
+                  </message>
+                </evaluateBeanshell>
+              </rules>
+              <skip>${skip.license.check}</skip>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
       <!-- parent-module only plugins -->
@@ -1166,6 +1219,10 @@
     <license.bundles.bootstrap>false</license.bundles.bootstrap>
     <!-- modules that include jquery in their source tree should set true -->
     <license.bundles.jquery>false</license.bundles.jquery>
+    <!-- where to find the generated LICENSE files -->
+    <license.aggregate.path>
+      ${project.build.directory}/maven-shared-archive-resources/META-INF/LICENSE
+    </license.aggregate.path>
     <tar.name>${project.build.finalName}.tar.gz</tar.name>
     <maven.build.timestamp.format>
       yyyy-MM-dd'T'HH:mm


Mime
View raw message