Skip to content

Reproducible crate builds #8612

@bk2204

Description

@bk2204

Describe the problem you are trying to solve
I'd like to provide a way for folks who receive my crate from crates.io to have confidence that it is exactly identical to the one built from the source.

Describe the solution you'd like
I'd like to have a reproducible crate build so that running crate package on two different systems (with the same version of cargo) produces bit-for-bit identical archives. I imagine that would look like this:

  • Taking the date for every file in the archive from the SOURCE_DATE_EPOCH environment variable or the latest commit, if the working tree is unmodified and version controlled.
  • Setting the user and group IDs to 0.
  • Picking fixed values for device and inode numbers in the tar archive.

Possibly this could be controlled with a flag if having it as the default behavior isn't wanted.

Notes
More information about reproducible builds and why they're valuable can be found at https://reproducible-builds.org/. I'm happy to implement this if folks think it's a good idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reproducibilityArea: reproducible / deterministic buildsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-package

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions