]> git.gag.com Git - debian/tar/commit
New option --clamp-mtime
authorJeremy Bobbio <lunar@debian.org>
Thu, 24 Mar 2016 05:11:28 +0000 (07:11 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 24 Mar 2016 05:26:27 +0000 (07:26 +0200)
commit13d04fe6ae5a343415299359944382f7a6d37816
tree2c7385f11ab024463bcc93dd61fa3c98cc4d6169
parent8d31493c999d3da1684dd72450abafa2c11fff1d
New option --clamp-mtime

The new `--clamp-mtime` option will change the behavior of `--mtime` to only
use the time specified if the file mtime is newer than the given time.
The `--clamp-mtime` option can only be used together with `--mtime`.

Typical use case is to make builds reproducible: to loose less
information, it's better to keep the original date of an archive, except for
files modified during the build process. In that case, using a reference
(and thus reproducible) timestamps for the latter is good enough. See
<https://wiki.debian.org/ReproducibleBuilds> for more information.

Patch submitted by Jeremy Bobbio and
Daniel Kahn Gillmor <dkg@fifthhorseman.net>

* doc/tar.1: Document --clamp-mtime
* doc/tar.texi: Likewise.

* src/common.h (set_mtime_option_mode): New enum
(set_mtime_option): Change type to enum set_mtime_option_mode.
(NEWER_OPTION_INITIALIZED): Rename to NEWER_OPTION_INITIALIZED.
* src/create.c (start_header): Set mtime depending on set_mtime_option.
* src/tar.c (options,parse_opt): New option --clamp-mtime
(decode_options): Initialize mtime_option

* tests/time02.at: New testcase.
* tests/Makefile.am: Add new testcase
* tests/testsuite.at: Likewise.
doc/tar.1
doc/tar.texi
src/common.h
src/create.c
src/list.c
src/tar.c
tests/Makefile.am
tests/testsuite.at
tests/time02.at [new file with mode: 0644]