mirror of https://github.com/docker/docker-py.git
Walk file tree in order for deterministic builds
Python's `os.walk` does not order the lists of files and directories it returns, so in order to produce a consistent build context tarfile, they should be ordered.
This commit is contained in:
parent
00e3ff9574
commit
dacaa583fb
|
@ -72,7 +72,8 @@ def tar(path, exclude=None):
|
||||||
fnames = [name for name in filenames
|
fnames = [name for name in filenames
|
||||||
if not fnmatch_any(os.path.join(relpath, name),
|
if not fnmatch_any(os.path.join(relpath, name),
|
||||||
exclude)]
|
exclude)]
|
||||||
for name in fnames:
|
dirnames.sort()
|
||||||
|
for name in sorted(fnames):
|
||||||
arcname = os.path.join(relpath, name)
|
arcname = os.path.join(relpath, name)
|
||||||
t.add(os.path.join(path, arcname), arcname=arcname)
|
t.add(os.path.join(path, arcname), arcname=arcname)
|
||||||
for name in dirnames:
|
for name in dirnames:
|
||||||
|
|
Loading…
Reference in New Issue