Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging: Add LICENSE and NOTICE files for all core dependencies #11705

Merged
merged 1 commit into from Jun 17, 2015
Merged

Packaging: Add LICENSE and NOTICE files for all core dependencies #11705

merged 1 commit into from Jun 17, 2015

Conversation

clintongormley
Copy link

Also adds dev-tools/check_license_and_sha.pl which will ensure that the
sha1 file in the licenses/ directory is the same as the sha1 of each
dependency shipped with Elasticsearch, and that each dependency has
a LICENSE file. Can also be used to update the sha1 file when upgrading
dependencies.

Closes #2794
Closes #10684

@clintongormley clintongormley added >enhancement review :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels Jun 16, 2015
@clintongormley
Copy link
Author

Not sure if we need to include these files from the groovy JAR:

  • groovy-all-ANTLR-LICENSE.txt
  • groovy-all-ASM-LICENSE.txt
  • groovy-all-CLI-LICENSE.txt
  • groovy-all-JSR223-LICENSE.txt

Also, would be good to update maven to execute this at build time:

dev-tools/check_license_and_sha.pl --check core

/cc @dadoonet

@rmuir
Copy link
Contributor

rmuir commented Jun 16, 2015

About checking at build time: maybe we don't want to do it quite yet? How long does it take the perl script to run? At least we want to start with it working via jenkins on linux... but I agree we want a way for a developer to manually check it before pushing (if that is running a perl script manually in both cases, fine for a start).

We could later see if it could be made more portable, e.g. just doing some custom logic in maven-ant-run-plugin here (groovy script or something simple). Maybe it won't be so simple if its in groovy but it means it would work without 'shasum' (windows, etc).

Also i couldnt tell if the verification logic will fail on extra license files that shouldn't be there. I see it definitely will for extra sha's: that is really good to see because it keeps everything tidy. Its just an idea for extra paranoia if its not tough to add.

@s1monw
Copy link
Contributor

s1monw commented Jun 16, 2015

mvn clean package yields this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (check-invalid-patterns) on project elasticsearch-parent: An Ant BuildException has occured: The following files contain tabs or
[ERROR] nocommits:
[ERROR] * core/licenses/lucene-LICENSE.txt
[ERROR] around Ant part ...<fail if="validate.patternsFound">The following files contain tabs or... @ 24:37 in /Users/simon/projects/elasticsearch/target/antrun/build-main.xml
[ERROR] -> [Help 1]

I think you need to fix you tabs vs. spaces in your editor :)

@clintongormley
Copy link
Author

@s1monw tabs removed from Lucene license ;)

@clintongormley
Copy link
Author

About checking at build time: maybe we don't want to do it quite yet? How long does it take the perl script to run?

about 150ms :)

We could later see if it could be made more portable, e.g. just doing some custom logic in maven-ant-run-plugin here (groovy script or something simple). Maybe it won't be so simple if its in groovy but it means it would work without 'shasum' (windows, etc).

agreed - although shasum is just a perl script installed by default on most *nixes. I could equally roll the module into the script directly so that it doesn't have the command line tool dependency.

That said, rewriting it in eg java would make it work wherever es works.

Also i couldnt tell if the verification logic will fail on extra license files that shouldn't be there. I see it definitely will for extra sha's: that is really good to see because it keeps everything tidy. Its just an idea for extra paranoia if its not tough to add.

The only reason I didn't was because of the extra licensing files for groovy.

@s1monw
Copy link
Contributor

s1monw commented Jun 16, 2015

I think you should move the script into the source folder that way it gets packaged and can be used by plugins etc.

 dev-tools/check_license_and_sha.pl -> dev-tools/src/main/resources/license-check/check_license_and_sha.pl

if you do this then you can use this diff:

diff --git a/pom.xml b/pom.xml
index 304a060..43ce99c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1148,6 +1148,26 @@ org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UT
                     <version>1.8</version>
                     <executions>
                         <execution>
+                            <id>check-license</id>
+                            <phase>verify</phase>
+                            <goals>
+                                <goal>run</goal>
+                            </goals>
+                            <configuration>
+                                <target>
+                                    <condition property="license.exists">
+                                        <available file="${basedir}/license" type="dir"/>
+                                    </condition>
+                                    <echo taskName="license check">Running license check</echo>
+                                    <exec failonerror="${license.exists}" executable="perl" dir="${elasticsearch.tools.directory}/license-check" >
+                                        <arg value="check_license_and_sha.pl"/>
+                                        <arg value="--check"/>
+                                        <arg value="${basedir}"/>
+                                    </exec>
+                                </target>
+                            </configuration>
+                        </execution>
+                        <execution>
                             <id>print-jvm</id>
                             <phase>validate</phase>
                             <goals>

and mvn verify -DskipTests will run the entire build and execute the script on every plugin that has a license folder

@clintongormley
Copy link
Author

@rmuir I've extended the file checks to complain about extra LICENSE files, and added a check to be sure that exactly one NOTICE file exists as well.

@s1monw I've added the POM changes so that this check runs automatically.

@s1monw
Copy link
Contributor

s1monw commented Jun 17, 2015

LGTM

… dependencies

Added a licenses/ directory to core which contains a sha1 file for each JAR
dependency, and one or more LICENSE files and one NOTICE file for each
project.

Also adds dev-tools/src/main/resources/license-check/check_license_and_sha.pl
which checks that the licenses/ dir is up to date during a mvn verify,
and which can be used to update the sha1 files when upgrading dependencies.

Closes #2794
Closes #10684
Closes #11705
clintongormley added a commit that referenced this pull request Jun 17, 2015
Packaging: Add LICENSE and NOTICE files for all core dependencies
@clintongormley clintongormley merged commit fdc4610 into elastic:master Jun 17, 2015
@clintongormley clintongormley deleted the licenses branch June 30, 2015 12:45
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >enhancement Team:Delivery Meta label for Delivery team v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

audit third party deps and NOTICE.TXT Downloads have incomplete notices and license texts
4 participants