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

reuse cannot parse SPDX information when part of a template #667

Closed
Luni-4 opened this issue Feb 7, 2023 · 7 comments
Closed

reuse cannot parse SPDX information when part of a template #667

Luni-4 opened this issue Feb 7, 2023 · 7 comments
Labels
question Further information is requested

Comments

@Luni-4
Copy link

Luni-4 commented Feb 7, 2023

Hello everyone and thanks for your fantastic project! :)

I'm trying to parse this file https://github.com/sifis-home/sifis-generate/blob/try/templates/meson/header but I get the following error https://github.com/sifis-home/sifis-generate/actions/runs/4114599472/jobs/7102178559#step:4:10

Thanks in advance for your help!

@nicorikken
Copy link
Member

Well, the error makes sense in that {{ license.id }} is not a valid SPDX-identifier. What was your expectation?

We have an reuse ignore tag

# REUSE-IgnoreStart
but that would probably leave residue in you template result, right?

@nicorikken nicorikken added the bug Something isn't working label Feb 7, 2023
@Luni-4
Copy link
Author

Luni-4 commented Feb 7, 2023

but that would probably leave residue in you template result, right?

Exactly, that's the main issue. I would like to completely ignore the file using the reuse-tool. Is there an option to do that?

@nicorikken
Copy link
Member

nicorikken commented Feb 8, 2023

So far no, because our goal is standards compliance, not passing the linter. Other tools reading the codebase should at least be able to reach the same conclusion, so it should not be specific to reuse-tool. So I can think of some approaches to address this case:

  • Be clever and try to detect templating syntax as SPDX header and ignore that ({{ }}, {% %}, ${ } or whatever), perhaps trigger a warning, and document in the standard.
  • Add the ability to ignore files in the upcoming reuse.yaml Define syntax and format of REUSE.yaml reuse-docs#81
  • Simply ignore SPDX tags in files if they are part of the glob in the DEP5-file or reuse.yaml

We have to discuss the options and work in a way forward.

A workaround for now is to also template part of the SPDX tag, so there is no full match. Like SPDX-{{ "License" }}-Identifier: {{ license.id }} We used to do similar workarounds in our test before having the reuse-ignore keywords.

We could state that this template workaround is our recommendations but I don't think that is user-friendly.

@carmenbianca
Copy link
Member

The correct workaround here is probably to create[filename].license, and put the licensing information in there.

@Luni-4
Copy link
Author

Luni-4 commented Feb 8, 2023

For my personal project I created a .reuse/dep5 file as workaround and it works. @carmenbianca solution would be more cumbersome to implement in my case. Though I was thinking that ignoring some files would leave them in an ambiguous state because they wouldn't have a license. Perhaps a possible solution could be that if there is a .reuse/dep5 file in the project, notify the user about the incorrect SPDX license with a warning, otherwise the tool must raise an error and abort

@nicorikken
Copy link
Member

@Luni-4 the recommendations by Carmen is to provide a license, just not in the file itself. So it is not a matter of ignoring. The filename.license method is the most specific one. If that would also leave residue in the rendered template, please consider providing a license using the dep5 file.

I think this method is better than adding an additional ignore syntax because it ensures the repo is actually properly licened.

Does that work for you?

@nicorikken nicorikken added question Further information is requested and removed bug Something isn't working labels Feb 17, 2023
@Luni-4
Copy link
Author

Luni-4 commented Feb 18, 2023

Yes, it works for me, thank you for the help @carmenbianca and @nicorikken!

@Luni-4 Luni-4 closed this as completed Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants