Skip to content

Order of license files/ids is lost #406

Description

@grv87

I would like to run attrib with custom template, so it would print all licenses along with their ids.
Something like that:

{% for i in range(about_object.license_file.value|length) %}
  <h2>{{ about_object.license_key.value[i] | e}}</h2>
  <pre>{{ about_object.license_file.value.values()[i] | e}}</pre>
{% endfor %}

The problem is that license_key field doesn't keep its order from ABOUT file.
Given ABOUT file:

...
license_expression: LGPL-3.0-or-later OR Apache-2.0
licenses:
  - key: Apache-2.0
    name: Apache License 2.0
    file: LICENSES/Apache-2.0.txt
  - key: LGPL-3.0-or-later
    name: LGPL
    file: LICENSES/LGPL-3.0.txt

I got the incorrect results, Apache text named LGPL and vice versa.

The problem seems to be here:
https://github.com/nexB/aboutcode-toolkit/blob/57dc7455874f2d878cdbc7bd6369c676e2ee8e7f/src/attributecode/model.py#L1091

License keys are just overridden, and files are not processed at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions