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
Merged

Add NOTICE file for Beats #3334

merged 2 commits into from
Jan 16, 2017

Conversation

monicasarbu
Copy link
Contributor

@monicasarbu monicasarbu 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 add_notice_file branch 3 times, most recently from d819c70 to 432609c Compare January 10, 2017 22:32
@monicasarbu monicasarbu added the in progress Pull request is currently in progress. label Jan 10, 2017
@@ -0,0 +1,1692 @@
License /Users/monica/src/github.com/elastic/beats/metricbeat/vendor/github.com/mitchellh/hashstructure/LICENSE
Copy link
Member

@ruflin ruflin Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

vendors = [beat_dir, libbeat_dir]
licenses = []

for vendor in vendors:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this also include vendor directories inside metricbeat modules?

@ruflin
Copy link
Member

ruflin 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 add_notice_file branch 2 times, most recently from 47b59f7 to 274fac6 Compare January 11, 2017 12:00
@monicasarbu monicasarbu added review and removed in progress Pull request is currently in progress. labels Jan 11, 2017
@cyrilleverrier
Copy link
Contributor

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 add_notice_file branch 2 times, most recently from 505934b to b7c0a6b Compare January 11, 2017 13:17
@monicasarbu monicasarbu added the in progress Pull request is currently in progress. label Jan 11, 2017
@monicasarbu
Copy link
Contributor Author

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

@monicasarbu monicasarbu removed the in progress Pull request is currently in progress. label Jan 11, 2017

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also work for dependencies not on Github?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

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)
Copy link
Contributor

@tsg tsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tsg tsg merged commit e2aaa38 into elastic:master Jan 16, 2017
@monicasarbu monicasarbu deleted the add_notice_file branch January 16, 2017 11:02
@tsg tsg added the needs_backport PR is waiting to be backported to other branches. label Jan 16, 2017
tsg pushed a commit to tsg/beats that referenced this pull request Jan 16, 2017
* 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 PR is waiting to be backported to other branches. label Jan 16, 2017
monicasarbu pushed a commit that referenced this pull request Jan 16, 2017
* 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)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
* 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 da690f7)

* Add NOTICE file to the packages (elastic#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 3e63f7b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants