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

Unexpected exception: "Unknown license key(s): MPL-2.0+" #16

Closed
hhoffstaette opened this issue Apr 2, 2023 · 4 comments
Closed

Unexpected exception: "Unknown license key(s): MPL-2.0+" #16

hhoffstaette opened this issue Apr 2, 2023 · 4 comments

Comments

@hhoffstaette
Copy link

I wanted to create an ebuild for https://github.com/rustic-rs/rustic, so I downloaded the tarball and decided to give pycargoebuild a try. It didn't go well:

[WARNING] Crate owo-colors-3.5.0.crate uses license-file='LICENSE', please inspect the license manually and add it *separately* from crate licenses
[WARNING] Crate ring-0.16.20.crate uses license-file='LICENSE', please inspect the license manually and add it *separately* from crate licenses
[WARNING] Crate webpki-0.22.0.crate uses license-file='LICENSE', please inspect the license manually and add it *separately* from crate licenses
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/pycargoebuild", line 8, in <module>
    sys.exit(entry_point())
             ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycargoebuild/__main__.py", line 205, in entry_point
    sys.exit(main(*sys.argv))
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycargoebuild/__main__.py", line 161, in main
    ebuild = get_ebuild(pkg_meta,
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycargoebuild/ebuild.py", line 163, in get_ebuild
    crate_licenses=get_crate_LICENSE(crate_files),
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pycargoebuild/ebuild.py", line 115, in get_crate_LICENSE
    parsed_license = spdx.parse(combined_license, validate=True, strict=True)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/license_expression/__init__.py", line 560, in parse
    self.validate_license_keys(expression)
  File "/usr/lib/python3.11/site-packages/license_expression/__init__.py", line 467, in validate_license_keys
    raise ExpressionError(msg)
license_expression.ExpressionError: Unknown license key(s): MPL-2.0+

I understand the LICENSE-related warnings (e.g. owo-colors has both license: and license-file: in its Cargo.toml), but don't know what to do about them.
Neither do I understand what to do about the exception.

cargo-ebuild emits the same warnings, but at least creates a usable ebuild:

holger>cargo-ebuild ebuild
WARNING: unknown license "MIT-0" at package "dunce", please correct manually
WARNING: owo-colors uses a license-file, not handled
WARNING: ring uses a license-file, not handled
WARNING: unknown license "MPL-2.0+" at package "smartstring", please correct manually
WARNING: unknown license "Unicode-DFS-2016" at package "unicode-ident", please correct manually
WARNING: webpki uses a license-file, not handled
Wrote: rustic-rs-0.5.0.ebuild

Am I holding it wrong? In any case it would be useful to say what and where the problem is and - if possible - suggest how to fix it.
I also tried to "update" an empty ebuild skeleton with the required CRATE and LICENSE entries, but that ended in the same exception.

@mgorny
Copy link
Member

mgorny commented Apr 2, 2023

The error comes from license_expression Python package. I need to figure out whether it's a bug in that package or in the license string of smartstring. Then, figure out how to workaround it.

@mgorny
Copy link
Member

mgorny commented Apr 2, 2023

Ok, so apparently it's by design, sigh. I'm going to see if we can just disable the license validation there.

@mgorny
Copy link
Member

mgorny commented Apr 2, 2023

See: aboutcode-org/license-expression#9

@mgorny mgorny closed this as completed in ad04fe9 Apr 2, 2023
@mgorny
Copy link
Member

mgorny commented Apr 2, 2023

I've pushed 0.6.3 with the fix. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants