gnutar: Make reproducible by default #43
No reviewers
Labels
No labels
Compat
Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auxolotl/labs#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "RossSmyth/labs:wrapTar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sometimes reproducibility is a concern when tarring and untarring. This should mitigate it.
I'm putting this in labs first. If it works well I'll probably add it to foundation as well.
It builds stage3 GCC but fails to build stage4 GCC with this patch
ee06186de6tod3e5c10ab3Tested with
nom build -f tidepool packages.foundation.gcc.latest.packages.x86_64-linux.x86_64-linux.packageand it built successfully.
@ -111,0 +113,4 @@# to provide a deterministic substitute for the "current" time. Note that# 315532800 = 1980-01-01 12:00:00. We use this date because python's wheel# implementation uses zip archive and zip does not support dates going back to# 1970.Nice approach, this for sure seems like something we should do. @jakehamilton any thoughts on the choice of date?
Sorry to be picking about wording, but is this midnight or noon? It sounds like you're saying it's noon; I can imagine reasons for that choice but would like to be explicit about it.
Also I'd like to better understand the relevance of the zip format; I didn't realize gnutar did zip? Is the concern that files we extract, are then going to be compressed by zip as part of a later, non-gnutar build phase? If that's all it is, I feel like it would be better to deal with that concern in the wheel build process and use 0 as the default time for gnutar, but it's for sure up for discussion.
Hm, I copied this from SOURCE_DATE_EPOCH in Nixpkgs, but this isn't applicable to gnutar
Note on the epoch var:
https://reproducible-builds.org/specs/source-date-epoch/
https://reproducible-builds.org/docs/source-date-epoch/
This is only relevant if that var is set, and nix-shell is used with Python.
Thanks - most of my questions above no longer apply per the latest changes, but please put that "docs" link in a comment somewhere. It does an amazing job of explaining and contextualizing everything, and I think it will be very helpful for future readers to know about it. Also that's really cool that a spec for this exists.
Hydra seems happy: https://hydra.aux-cache.dev/jobset/aux-prs/labs-pr43
d3e5c10ab3tod0e1fb6709I changed it based upon feedback on Matrix so that it uses a hook rather than a wrapper. This is so that the same derivation can be used by end-users and in builds.
I do not think using
TAR_OPTIONSwould be supported by all build system since some do not inherit all environment variables, I am mainly thinking of Meson. But PATH should almost always be inherited.Hm I'm not sure if this hook is doing anything because it is wrong, but I was able to build packages with it fine.
@ -87,0 +96,4 @@cat << EOF > "$tar_wrap_dir/tar"#!${packages.foundation.bash.versions."5.2.15-bootstrap".package}/bin/bashTAR_OPTIONS="--mtime=@1 --owner=0 --group=0 --numeric-owner --sort=name" "$tar_out/bin/.tar" "\$@"There is nothing at
/bin/.tarbut I was able to build GCC and suchOk found the issue. Needed to passthru the hooks too.
d0e1fb6709tobda09169f6We should also probably add this wrapper hook to bootstrap too
@ -87,0 +92,4 @@# We want to ensure we prepend to PATH so our wrapper is picked first."aux:wrap:tar" = lib.dag.entry.before [ "unpack" ] ''tar_wrap_dir=$(mktemp -d)tar_out=${packages.foundation.gnutar.versions."1.35-stage1".package}Should probably be
config.packageto ensure we're pointing to this instance of the gnutar packageYeah I asked on matrix if packages have a fixed-point arg as I was unaware of
config.packagebefore.@ -87,0 +95,4 @@tar_out=${packages.foundation.gnutar.versions."1.35-stage1".package}cat << EOF > "$tar_wrap_dir/tar"#!${packages.foundation.bash.versions."5.2.15-bootstrap".package}/bin/bashGoing to test it out, but this should probably be added to
deps.hostand then useconfig.deps.bashhere instead to ensure we have the right platform setOk! I wasn't sure how to specify "use a bash that runs on host"
bda09169f6to58471795325847179532tof716dbd347Rebuilt on hydra, still looks OK: https://hydra.aux-cache.dev/jobset/aux-prs/labs-pr43
good, yeah, it being a hook sounds like the right way to do it, to me. thanks for incorporating the comment I asked for. I'm merging it :)