Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2015-01-10 13:52:47
Size: 901
Editor: Lunar
Comment: document issue
Revision 6 as of 2015-08-24 19:19:05
Size: 1259
Editor: Lunar
Comment: mention tar/1.28-1 supports for --clamp-mtime
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Tarballs contain mtimes. They will not be reproducible if files have been generated during build time. Tarballs contain mtimes. They will not be reproducible if files have been generated or patched during build time.
Line 7: Line 7:
[[attachment:allegro4.4_4.4.2-5.debbindiff.html|Example debbindiff output]]] [[attachment:allegro4.4_4.4.2-5.debbindiff.html|Example debbindiff output]]
Line 24: Line 24:
== Adjusting mtimes == == --clamp-mtime ==

tar/1.28-1 in Debian supports the `--clamp-mtime` option which will only adjust files with a modification time later than the time specified with `--mtime`.

{{{
SOURCE_DATE := $(shell dpkg-parsechangelog --show-field=Date)

        tar --clamp-mtime --mtime="$(SOURCE_DATE)" -cf archive.tar src
}}}

== Adjusting mtimes by modifying timestamps in disk ==
Line 29: Line 39:
BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p') BUILD_DATE := $(shell dpkg-parsechangelog --show-field=Date)
Line 31: Line 41:
       find '$(DIR)' -depth -newermt '$(BUILD_DATE)' -print0 | \        find '$(DIR)' -newermt '$(BUILD_DATE)' -print0 | \

Tarballs contain mtimes. They will not be reproducible if files have been generated or patched during build time.

Known affected packages

Detection

Example debbindiff output

Work-around

Known yet.

Solutions

--mtime

If indivdiual mtimes don't matter, then use the --mtime option:

     --mtime=DATE-OR-FILE
           set mtime for added files from DATE-OR-FILE

--clamp-mtime

tar/1.28-1 in Debian supports the --clamp-mtime option which will only adjust files with a modification time later than the time specified with --mtime.

SOURCE_DATE := $(shell dpkg-parsechangelog --show-field=Date)

        tar --clamp-mtime --mtime="$(SOURCE_DATE)" -cf archive.tar src

Adjusting mtimes by modifying timestamps in disk

Use find, xargs, and touch to adjust file mtimes before tar is run. Example:

BUILD_DATE := $(shell dpkg-parsechangelog --show-field=Date)
[…]
       find '$(DIR)' -newermt '$(BUILD_DATE)' -print0 | \
               xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
       […] tar […]