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

Add NOTICE file for Beats #3334

Merged
merged 2 commits into from Jan 16, 2017

Conversation

Projects
None yet
4 participants
@monicasarbu
Copy link
Contributor

commented Jan 10, 2017

This PR contains a python script that generates the NOTICE file. There is a single NOTICE file for all the official Beats, and it's placed in the beats repository.

The NOTICE file includes the copyright information for all the 3rd party libraries used in the Beats project. It follows the rules:

  • if the library has apache license, and if NOTICE file is present, include that text in the NOTICE file.
  • if the library has MIT, ISC or BSD license, include the whole copyright block in NOTICE file (meaning copyright + license)

You can pass a list of vendor directories where the NOTICE* and LICENSE* files of all 3rd party libraries are available:

python dev-tools/generate_notice.py vendor metricbeat/vendor

For the official Beats, you can run the following in the beats repository.

make notice

The NOTICE file can be generated by the community Beats by using the script. The NOTICE file is not added by the Beat generator.

UPDATE: The script accepts also the name of the Beat and the copyright owner, to customize the NOTICE file for the community Beats.

$ python dev-tools/generate_notice.py -h
usage: generate_notice.py [-h] [-b BEAT] [-c COPYRIGHT] vendors [vendors ...]

Generate the NOTICE file from a list of vendor directories

positional arguments:
  vendors               List of vendor directories

optional arguments:
  -h, --help            show this help message and exit
  -b BEAT, --beat BEAT  Beat name
  -c COPYRIGHT, --copyright COPYRIGHT
                        Copyright owner

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch 3 times, most recently from d819c70 to 432609c Jan 10, 2017

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch from 7061edd to f2b9c32 Jan 10, 2017

@@ -0,0 +1,1692 @@
License /Users/monica/src/github.com/elastic/beats/metricbeat/vendor/github.com/mitchellh/hashstructure/LICENSE

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 11, 2017

Collaborator

We should not include here the full path as it contains your private username. Perhaps we can replace it by $GOPATH or just make it relative to the repo.

This comment has been minimized.

Copy link
@monicasarbu

monicasarbu Jan 11, 2017

Author Contributor

Yes, sure. The plan is to include only github.com/mitchellh/hashstructure.

vendors = [beat_dir, libbeat_dir]
licenses = []

for vendor in vendors:

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 11, 2017

Collaborator

Will this also include vendor directories inside metricbeat modules?

@ruflin

This comment has been minimized.

Copy link
Collaborator

commented Jan 11, 2017

This could also be interesting to see which repos do not contain a license file: https://github.com/pmezard/licenses

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch 2 times, most recently from 47b59f7 to 274fac6 Jan 11, 2017

@monicasarbu monicasarbu added review and removed in progress labels Jan 11, 2017

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch from 965a018 to 441e5e2 Jan 11, 2017

@cyrilleverrier

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2017

This PR is going to be useful for community beats as well :)

Could you please make sure that we (developers) can configure the output by using variables instead of Elastic Beat and Copyright 2014-{} Elasticsearch BV ?

@monicasarbu monicasarbu changed the title Add NOTICE file for Metricbeat Add NOTICE file for Beats Jan 11, 2017

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch 2 times, most recently from 505934b to b7c0a6b Jan 11, 2017

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch from 1fe45e8 to 8f7f2f8 Jan 11, 2017

@monicasarbu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 11, 2017

@cyrilleverrier Thank you for such a quick feedback. I added two options (-b and -c) to configure the Beat name and the copyright owner. I have updated the description of the PR with the script usage.

Makefile Outdated

.PHONY: notice
notice:
python dev-tools/generate_notice.py metricbeat/vendor vendor

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 12, 2017

Collaborator

This does not include the vendor directories in the metricbeat modules? How about somthing like find . -name vendor?

This comment has been minimized.

Copy link
@monicasarbu

monicasarbu Jan 12, 2017

Author Contributor

Ah, good point. Then I will search in a given director for all the vendor directories.

lib = ""
path = os.path.dirname(license)
# get the last three directories
for i in range(0, 3):

This comment has been minimized.

Copy link
@ruflin

ruflin Jan 12, 2017

Collaborator

Does this also work for dependencies not on Github?

This comment has been minimized.

Copy link
@monicasarbu

monicasarbu Jan 12, 2017

Author Contributor

It gets only the last 3rd directories from the path, but the function should be able to get less than 3 directories as well. I adjusted the code a bit to accept also less than 3 directories (example windows/project)

Python script to generate the NOTICE file
The script receives a directory and searches for all the all vendor subdirectories in order to extract copyright
information about the 3rd party libraries that are used. The NOTICE file is
generated in the current directory.

For each 3rd party library, the following rules are used:
- If the library has apache license, and if NOTICE file is present, include that text in  the NOTICE file.
- If the library has MIT, ISC or BSD license, include the whole copyright block in NOTICE file (meaning copyright + license)

@monicasarbu monicasarbu force-pushed the monicasarbu:add_notice_file branch from 48fc892 to 529e477 Jan 12, 2017

@tsg
Copy link
Collaborator

left a comment

LGTM

@tsg tsg merged commit e2aaa38 into elastic:master Jan 16, 2017

3 of 4 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
CLA Commit author is a member of Elasticsearch
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
default Build finished.
Details

@monicasarbu monicasarbu deleted the monicasarbu:add_notice_file branch Jan 16, 2017

@tsg tsg added the needs_backport label Jan 16, 2017

tsg added a commit to tsg/beats that referenced this pull request Jan 16, 2017

Add NOTICE file for Beats (elastic#3334)
* Python script to generate the NOTICE file

The script receives a directory and searches for all the all vendor subdirectories in order to extract copyright
information about the 3rd party libraries that are used. The NOTICE file is
generated in the current directory.

For each 3rd party library, the following rules are used:
- If the library has apache license, and if NOTICE file is present, include that text in  the NOTICE file.
- If the library has MIT, ISC or BSD license, include the whole copyright block in NOTICE file (meaning copyright + license)

* Accept also 3rd party libraries with less than 3 directories

(cherry picked from commit e2aaa38)

@tsg tsg removed the needs_backport label Jan 16, 2017

monicasarbu added a commit that referenced this pull request Jan 16, 2017

Backport 3334 & 3379 to 5.2: Notice file (#3380)
* Add NOTICE file for Beats (#3334)

* Python script to generate the NOTICE file

The script receives a directory and searches for all the all vendor subdirectories in order to extract copyright
information about the 3rd party libraries that are used. The NOTICE file is
generated in the current directory.

For each 3rd party library, the following rules are used:
- If the library has apache license, and if NOTICE file is present, include that text in  the NOTICE file.
- If the library has MIT, ISC or BSD license, include the whole copyright block in NOTICE file (meaning copyright + license)

* Accept also 3rd party libraries with less than 3 directories

(cherry picked from commit e2aaa38)

* Add NOTICE file to the packages (#3379)

Added to the home path. Also modifies the generators to include a simple
NOTICE file, which is anyway good practice for Apache licensed projects.

Tested the beat and the metricbeat generators by hand.
(cherry picked from commit f3352eb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.