Pass an optional mtime param to HeaderMode::Deterministic#424
Conversation
This `mtime` value will be used instead of `DETERMINISTIC_TIMESTAMP` when provided. This is useful e.g. to pass in `$SOURCE_DATE_EPOCH` to support reproducible builds.
6fa6cf8 to
ea42424
Compare
xzfc
left a comment
There was a problem hiding this comment.
This is a breaking change. Given that
HeaderModeis marked asnon_exhaustive, it is possible to make this a non-breaking change by adding a new mode variant that uses the mtime override instead.
Breaking is not desirable. A new variant would be fine.
This
mtimevalue will be used instead ofDETERMINISTIC_TIMESTAMPwhen provided. This is useful e.g. to pass in$SOURCE_DATE_EPOCHto support reproducible builds.
The overall idea is LGTM.
|
There are multiple feature requests to extend
Maybe these and similar cases could be covered by a new enum variant with a single |
4f8a3af to
8b69171
Compare
|
I added a new It feels a touch verbose but one of the upsides is that both |
Based on changes in composefs#409, composefs#424. Co-authored-by: Eashwar Ranganathan <eashwar@eashwar.com> Co-authored-by: Tom Fay <tom@teamfay.co.uk>
|
I've cleaned these changes up and published here: https://github.com/xzfc/tar-rs/commits/header-mode-config/ Tho I'm baffled that adding this enum variant can be considered a breaking change (as #[non_exhaustive]
pub enum HeaderMode {
Complete,
Deterministic,
+ Config(HeaderModeConfig), // breaking change!
}the following code no longer compiles: // error[E0605]: non-primitive cast: `Enum` as `i32`
let x = HeaderMode::Complete as i32;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ an `as` expression can be used to convert
// enum types to numeric types only if the
// enum type is unit-only or field-less |
This
mtimevalue will be used instead ofDETERMINISTIC_TIMESTAMPwhen provided. This is useful e.g. to pass in$SOURCE_DATE_EPOCHto support reproducible builds.This is a breaking change. Given that
HeaderModeis marked asnon_exhaustive, it is possible to make this a non-breaking change by adding a new mode variant that uses the mtime override instead.