From 834876c5fb13dfaa102000e816e9052af139048c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Jan 2021 10:24:42 +0200 Subject: Initial attempt (gzip -n and preserve post-processed manifest timestamp) Turns our this is not enough since tar saves timestamps (as well as owner information, file order, etc) including for directories and getting rid of that in a portable way is not going to be easy. Looks like the most plausible way would be to switch to embedded libarchive (provided it's possible to achieve everything we need). --- libbuild2/version/init.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'libbuild2/version/init.cxx') diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx index ced9c68..88f1080 100644 --- a/libbuild2/version/init.cxx +++ b/libbuild2/version/init.cxx @@ -374,7 +374,24 @@ namespace build2 path::temp_path ("manifest"), m.version)); - mvfile (t.path, f, verb_never); + + + // Copy the original timestamps in order produce the same archive for + // the same distribution. + // + try + { + entry_time et (file_time (f)); + + mvfile (t.path, f, verb_never); + + file_time (f, et); + } + catch (const system_error& e) + { + fail << "unable to get/set timestamp for " << f << ": " << e; + } + t.cancel (); } -- cgit v1.1