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

Allow setting timestamp when writing archives #171

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

wolfv
Copy link
Contributor

@wolfv wolfv commented Apr 16, 2023

I cobbled something together to help build "reproducible" archives.

This deterministically sets the timestamp of all files in an archive. That worked for a quick test of building a reproducible package :)

However, we could come up with more interesting schemes of modifying the timestamps (e.g. only forcing the timestamp on files that have been written in the past 24 hours or so, and leave those files that were just copied from the source archive as they are).

Some references: https://reproducible-builds.org/docs/timestamps/

Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add some docs to the function to indicate what the timestamp argument means?

@@ -120,6 +120,7 @@ pub fn write_tar_bz2_package<W: Write>(
base_path: &Path,
paths: &[PathBuf],
compression_level: CompressionLevel,
timestamp: &Option<chrono::DateTime<chrono::Utc>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Option<&T> instead of &Option<T>.

See: https://stackoverflow.com/a/71027236

@wolfv
Copy link
Contributor Author

wolfv commented Apr 17, 2023

thx for the suggestion, done that. I was considering to add a "options" struct, but not convinced it's needed just yet.

@baszalmstra
Copy link
Collaborator

Yeah if we add more we should do that. But lets merge as is!

@baszalmstra baszalmstra merged commit 301dd72 into conda:main Apr 18, 2023
@wolfv wolfv deleted the timestamp branch April 18, 2023 11:46
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

Successfully merging this pull request may close these issues.

2 participants