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

Edited amalgamated file generator, to block REUSE from getting confused #2730

Merged
merged 1 commit into from
Aug 19, 2023

Conversation

rpavlik
Copy link
Contributor

@rpavlik rpavlik commented Aug 11, 2023

Description

I use the REUSE tool to generate a software bill-of-materials
for projects I work on. Some of them include a copy of Catch2. However, the REUSE
tool gets confused by code or docs that include things that look like copyright/license statements.

(Without this patch, the following error happens:

reuse._util - ERROR - Could not parse 'BSL-1.0\n','
reuse.project - ERROR - 'src/external/catch2/tools/scripts/generateAmalgamatedFiles.py' holds an SPDX expression that cannot be parsed, skipping the file

)

They do support comments to disable recognition, so I have added those in the script in question

(It would be really cool if all of Catch2 passed REUSE, but at least not breaking the tool is a start.)

It struggled with the copyright lines included as string literals.
@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Merging #2730 (932508f) into devel (9538d16) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##            devel    #2730   +/-   ##
=======================================
  Coverage   91.30%   91.30%           
=======================================
  Files         192      192           
  Lines        7848     7848           
=======================================
  Hits         7165     7165           
  Misses        683      683           

@horenmar
Copy link
Member

It would be really cool if all of Catch2 passed REUSE

What doesn't?

@rpavlik
Copy link
Contributor Author

rpavlik commented Aug 11, 2023

Here's the result of "reuse lint":
reuse.txt

Mostly missing the license by name in the LICENSES folder (easy fix: reuse download --all), then a handful of accessory (non-core) files are missing copyright notices and SPDX-License-Identifier lines, it looks like.

All the "code" files and markdown docs should be pretty easy, just add the copyright and SPDX-License-Identifier: line. The input and output test data, plus images and json files, presumably would need the license and copyright data in an adjacent .license file - see https://reuse.software/tutorial/#binary-and-uncommentable-files

Ideally you'd be able to get all the stuff marked up without having to put data in a .reuse/dep5 file, since those don't "nest" well when vendoring projects.

@horenmar horenmar added the Building and Packaging Issues affecting build/packaging scripts and utilities label Aug 19, 2023
@horenmar
Copy link
Member

Thanks, I'll merge the change to the generator.

I also looked at the report, and have some thoughts:

  • A tool should understand well defined spdx identifiers without me having to provide it the license manually.
  • Files in examples/, extras/, and fuzzing/ should have BSL license info as well, in case the users want to reuse them.
  • I do not understand why various other files that are not part of the install tree need copyright info. As an user you should not need to care what the license of say tools/scripts/releaseCommon.py is.

@horenmar horenmar merged commit 5bba3e4 into catchorg:devel Aug 19, 2023
73 checks passed
@rpavlik rpavlik deleted the fix-reuse-parsing branch August 22, 2023 16:55
@rpavlik
Copy link
Contributor Author

rpavlik commented Aug 22, 2023

Thanks for the merge!

The REUSE tool is not a general purpose license extractor, it's explicitly for folks who are trying to follow the REUSE specification that describes specific formats of easy to parse machine readable copyright and license data in every file. It's definitely "overkill" by some standards but it is easy to check and enforce so it can be a nice habit.

I think I will just end up subsetting this repo in our own to exclude files we don't need, which should include all the ones that REUSE is complaining about, which will further solve our project's problem, so no worries there.

horenmar added a commit that referenced this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Building and Packaging Issues affecting build/packaging scripts and utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants