fsfe / reuse-docs

REUSE recommendations, tutorials, FAQ and specification
https://reuse.software
19 stars 20 forks source link

Document current precedence of information #111

Closed pietroalbini closed 1 year ago

pietroalbini commented 2 years ago

REUSE currently looks at multiple sources when deciding what the license of a file should be, but the precedence of those sources is not documented in the specification. This results in people having to experiment on their own to determine what the current precedence is, which is not great. It would be nice if the current precedence would be written in the specification.

I know that in https://github.com/fsfe/reuse-docs/issues/70 there is an insightful discussion on what the precedence of information should be, keeping in mind the future REUSE.yaml file, but that is orthogonal to documenting the current behavior of the tool.

pietroalbini commented 2 years ago

Writing down in this comment the understanding I gathered from the experiments I did this morning.

There are two separate "sources" of information: the dep5 file, and the filesystem (both $path.license and code comments). If a file is annotated with both "sources", both annotations will be emitted by reuse spdx, resulting in an AND.

Within a dep5 file, latter rules override former rules: if there is a * rule followed by a foo.txt rule, foo.txt will have the license defined by the foo.txt rule. If there is a bar.txt rule followed by a * rule, bar.txt will have the license defined by the * rule.

Within the filesystem, if both a $path.license file and code comments are present, the code comments will be ignored.

mxmehl commented 2 years ago

Thanks. I agree that we should implement this rather sooner than later, since REUSE.yaml might still be a longer road.