diff options
| author | Marcus Cobden <marcus@marcuscobden.co.uk> | 2014-11-04 10:02:24 +0000 |
|---|---|---|
| committer | Marcus Cobden <marcus@marcuscobden.co.uk> | 2014-11-04 10:02:24 +0000 |
| commit | dacaa583fba562fd071cf200088df3a5384680c2 (patch) | |
| tree | 2977209bfaa703bc6d80e58bd1c9972b053e391e /docker/utils | |
| parent | 00e3ff9574b12e2321c0f3db55498a3ffa43a713 (diff) | |
| download | docker-py-dacaa583fba562fd071cf200088df3a5384680c2.tar.gz | |
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.
Diffstat (limited to 'docker/utils')
| -rw-r--r-- | docker/utils/utils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py index 0853ac4..7cd3b1a 100644 --- a/docker/utils/utils.py +++ b/docker/utils/utils.py @@ -72,7 +72,8 @@ def tar(path, exclude=None): fnames = [name for name in filenames if not fnmatch_any(os.path.join(relpath, name), exclude)] - for name in fnames: + dirnames.sort() + for name in sorted(fnames): arcname = os.path.join(relpath, name) t.add(os.path.join(path, arcname), arcname=arcname) for name in dirnames: |
