This site describes Mempo's extensions to the GNU tar file archive program.
This software is (2014-01) experimental addition to Debian, though we hope to in time move it officially to Upstream and to Debian, see Mempo#integration for general download&install instructions for Mempo software.
Newest code download should be here: https://github.com/mempo/various/commits/master/tar or try other Mempo#downloads.
This new option was added to tar: store all added files in sorted way, so that they are always added in same order, when creating (or appending) archive. Current implementation should sort them in alphabetical (qsort / strcmp) order, for each of the top directories and then descend, doing same sort for each child directory.
With above extensions it should now be trivial to produce .tar files that always are binary identical (and thus have same checksum) if input files have identical content, no matter what UID/GID, user-names, file times or order of files on disk exists each time.
Thus the command:
tar --sort-input --owner=root --group=root --numeric-owner cf foo.tar input/
should produce identical foo.tar file out of data in input/ directory, verify it with command tar tvf foo.tar.
Perhaps on strange systems where there would be user "root" with UID other then 0, it could not work properly, how ever no such system probably exists and likely it's violating standards so can't be counted as a real use case.
Get and build modified tar:
Install dependencies: aptitude install byacc bison
Get sources: git clone email@example.com:mempo/various.git
cd various/tar and ./bootstrap
Because bootstrap overvrite gnu/savedir.c (--sort-input option) we need to get good version from git: git checkout gnu/savedir.c
./configure ; make
This step is important in building SameKernel. Copy binary to local folder: cp src/tar ~/.local/usr/bin/tar