Skip to content

Published crates should include LICENSE file #3537

@raphlinus

Description

@raphlinus

I'd like for published crates to include the text of the LICENSE along with the code. For our use case (making a repo of vendored crates), the cargo-vendor tool is populating the vendor directory with lots of packages that are missing LICENSE. There are basically two reasons for this:

  1. The LICENSE file is present in the source repository, in the same directory as the Cargo.toml config file, but the config file doesn't include the LICENSE in the list of files to be uploaded (because of an explicit "include" keyword). Examples include dtoa and serde.

  2. The LICENSE file is present in the source repo (typically in the repo root), but the crate is published from a subdirectory. Examples include num-traits and xi-core-lib.

There are (at least) two things "cargo publish" could do to mitigate this problem:

  1. The publish tool could do a lint check that an appropriate license file is present. There's a small amount of client-side sanity-checking now (checking that a license file exists if specified), and I believe the crates.io server also checks the spdx string.

  2. Automatically including LICENSE files from the repo root if publishing from a subdirectory.

I'll get around this for the time being by making my vendoring script do the latter at vendoring time, but I think it would be better if every stage in the chain precisely matched the exact contents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-publish

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions