diff mbox

[01/16] download/git: create GNU format tar files

Message ID 20170321000712.26500-2-arnout@mind.be
State Accepted
Headers show

Commit Message

Arnout Vandecappelle March 21, 2017, 12:06 a.m. UTC
On most distros, the tar format defaults to GNU. However, at build time
the default format may be changed to posix. Also, future versions of
tar will default to posix.

Since we want the tarballs created by the git download method to be
reproducible (so their hash can be checked), we should explicitly
specify the format. Since existing tarballs on sources.buildroot.org
use the GNU format, and also the existing hashes in the *.hash files
are based on GNU format tarballs, we use the GNU format.

In addition, the Posix format encodes atime and ctime as well as mtime,
but tar offers no option like --mtime to override them. In the GNU
format, atime and ctime are only encoded if the --incremental option is
given.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Peter Seiderer <ps.report@gmx.net>
---
Peter, can you test if this solves the issue for you?
---
 support/download/git | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni March 21, 2017, 10:16 p.m. UTC | #1
Hello,

On Tue, 21 Mar 2017 01:06:57 +0100, Arnout Vandecappelle
(Essensium/Mind) wrote:
> On most distros, the tar format defaults to GNU. However, at build time
> the default format may be changed to posix. Also, future versions of
> tar will default to posix.
> 
> Since we want the tarballs created by the git download method to be
> reproducible (so their hash can be checked), we should explicitly
> specify the format. Since existing tarballs on sources.buildroot.org
> use the GNU format, and also the existing hashes in the *.hash files
> are based on GNU format tarballs, we use the GNU format.
> 
> In addition, the Posix format encodes atime and ctime as well as mtime,
> but tar offers no option like --mtime to override them. In the GNU
> format, atime and ctime are only encoded if the --incremental option is
> given.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Peter Seiderer <ps.report@gmx.net>
> ---
> Peter, can you test if this solves the issue for you?
> ---
>  support/download/git | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to master, thanks. We require tar 1.17 at least, and I checked
that tar 1.17 supports --format=gnu.

Thomas
Peter Korsgaard March 31, 2017, 6:44 a.m. UTC | #2
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:

 > On most distros, the tar format defaults to GNU. However, at build time
 > the default format may be changed to posix. Also, future versions of
 > tar will default to posix.

 > Since we want the tarballs created by the git download method to be
 > reproducible (so their hash can be checked), we should explicitly
 > specify the format. Since existing tarballs on sources.buildroot.org
 > use the GNU format, and also the existing hashes in the *.hash files
 > are based on GNU format tarballs, we use the GNU format.

 > In addition, the Posix format encodes atime and ctime as well as mtime,
 > but tar offers no option like --mtime to override them. In the GNU
 > format, atime and ctime are only encoded if the --incremental option is
 > given.

 > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 > Cc: Peter Seiderer <ps.report@gmx.net>
 > ---
 > Peter, can you test if this solves the issue for you?

Committed to 2017.02.x, thanks.
diff mbox

Patch

diff --git a/support/download/git b/support/download/git
index 7921411835..056057c700 100755
--- a/support/download/git
+++ b/support/download/git
@@ -94,6 +94,8 @@  popd >/dev/null
 # Generate the archive, sort with the C locale so that it is reproducible
 find "${basename}" -not -type d >"${basename}.list"
 LC_ALL=C sort <"${basename}.list" >"${basename}.list.sorted"
-tar cf - --numeric-owner --owner=0 --group=0 --mtime="${date}" \
+# Create GNU-format tarballs, since that's the format of the tarballs on
+# sources.buildroot.org and used in the *.hash files
+tar cf - --numeric-owner --owner=0 --group=0 --mtime="${date}" --format=gnu \
          -T "${basename}.list.sorted" >"${output}.tar"
 gzip -n <"${output}.tar" >"${output}"