Skip to content

license_key and license_file are missing in "licenses" group if no --fetch-license option is used or if license is custom #534

Description

@chinyeungli

Assuming this is the input:

about_resource name license_expression license_file
test.c test.c mit AND custom custom.txt

Current behavior

If no --fetch-license is used, following is the generated ABOUT file

about_resource: test.c
name: test.c
license_expression: mit AND custom
licenses:
  - file: custom.txt

Note that the license_key (mit, custom) are missing in the "licenses" section.
If --fetch-license is used, the generated ABOUT file will look like the following:

about_resource: test.c
name: test.c
license_expression: mit AND custom
licenses:
  - key: mit
    name: MIT License
    file: mit.LICENSE
    url: https://scancode-licensedb.aboutcode.org/mit.LICENSE
    spdx_license_key: MIT
  - key: custom

Note that the value of the license_file is not shown in both case.

The correct/ideal ABOUT files should look like

about_resource: test.c
name: test.c
license_expression: mit AND custom
licenses:
  - key: mit
    name: mit
  - key: custom
    name: custom
  - file: custom.txt
about_resource: test.c
name: test.c
license_expression: mit AND custom
licenses:
  - key: mit
    name: MIT License
    file: mit.LICENSE
    url: https://scancode-licensedb.aboutcode.org/mit.LICENSE
    spdx_license_key: MIT
  - key: custom
    name: custom
    file: custom.txt

Please note that in the first scenario, the file "custom.txt" is not associated with any specific license key because there are two license keys but only one license file. Therefore, the tool is unable to determine which license key the file corresponds to. In the second scenario, the "--fetch-license" option has already assigned the license file to the "MIT" license key. As a result, there is only one remaining "unhandled" license key and one license file, allowing the tool to associate them together.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions