#306 RFE: tool for simplifying License expressions
Opened 6 months ago by decathorpe. Modified 6 months ago

It's not trivial to collect and simplify¹ the output of the %cargo_license_summary macro, especially for projects with a larger number of dependencies.

It would be great to have some tooling support for this, maybe by improving the output of the RPM macro so it can automatically be extracted from the build.log, simplified, and printed as a copy-paste-able %shrink macro expression.

I suggest adapting the %cargo_license_summary macro to allow automatically parsing the build.log, and adding this a subcommand to rust2rpm-helper to print the simplified License expression.


¹: The following "simplifications" are valid to my knowledge:

  1. Order does not matter in AND and OR clauses, i.e. A AND B and B AND A are equivalent. This means that AND clauses within the License expression can be sorted for consistency, and that one of A OR B and B OR A can be dropped if both are present.

  2. The SPDX AND and OR operators are associative, so A AND (B AND C) and (A AND B) AND C are equivalent, i.e. the parentheses can be dropped (A AND B AND C).

For consistency, I have always consistently sorted parenthesized OR clauses like (A OR B) after "naked" license expressions. This emphasizes licenses that apply "unconditionally" (i.e. without OR choices), so I think it makes sense to move them to the front of the License tag.

I have not yet made up my mind whether sorting the licenses in parenthesized OR clauses themselves would make sense too.


Log in to comment on this ticket.

Metadata