Introduce measures to start building Zips deterministically.
This at least lays some groundwork for doing so, by gathering archive members by wildcard expansion rather than zip's -r parameter (which uses file system order -- essentially random), combined with LC_ALL=C so that locale sorting orders don't matter either. zip's -X option is also used so no Unix metadata (UIDs, GIDs, modes) are saved in the archive. To really complete the effect, faketime should be used to deal with file timestamps. Requiring faketime to do `make dist` seems too extreme to me, so I'm leaving it out, but the general idea is to run a command such as: faketime -f "$(TZ=UTC date -d "@$(git show -q --format=format:%ct)" \ "+%Y-%m-%d %H:%M:%S")" \ make dist This does also assume that zip's default compression algorithm never changes (eg, from DEFLATE to BZip2 or LZMA), or never releases an improved version (eg, a better DEFLATE). It's not perfect, but this should be good enough.master
parent
7f2eb016ab
commit
c67e8a566a
4
Makefile
4
Makefile
|
@ -89,8 +89,8 @@ DISTDOCS=COPYING.txt CREDITS.txt README.html
|
|||
|
||||
# Due to convoluted reasons, the WADs must directly proceed the game name.
|
||||
dist: $(OBJS) COPYING.txt CREDITS.txt README.html
|
||||
VERSION=$(VERSION) scripts/makepkgs freedm $(FREEDM) $(DISTDOCS)
|
||||
VERSION=$(VERSION) scripts/makepkgs freedoom $(FREEDOOM1) $(FREEDOOM2) $(DISTDOCS)
|
||||
LC_ALL=C VERSION=$(VERSION) scripts/makepkgs freedm $(FREEDM) $(DISTDOCS)
|
||||
LC_ALL=C VERSION=$(VERSION) scripts/makepkgs freedoom $(FREEDOOM1) $(FREEDOOM2) $(DISTDOCS)
|
||||
|
||||
json: $(OBJS)
|
||||
ifndef JSON
|
||||
|
|
|
@ -34,14 +34,14 @@ full_path = path + "/" + base_dir
|
|||
|
||||
# Create directory and add files
|
||||
|
||||
run_command("mkdir %s" % full_path)
|
||||
run_command("mkdir {}".format(full_path))
|
||||
for file in FILES:
|
||||
run_command("cp %s %s" % (file, full_path))
|
||||
run_command("cp {} {}".format(file, full_path))
|
||||
|
||||
orig_dir = os.getcwd()
|
||||
|
||||
os.chdir(path)
|
||||
run_command("rm -f %s.zip" % base_dir)
|
||||
run_command("zip -r %s.zip %s" % (base_dir, base_dir))
|
||||
run_command("rm -rf %s" % base_dir)
|
||||
run_command("rm -f {}.zip".format(base_dir))
|
||||
run_command("zip -X {0}.zip {0} {0}/*".format(base_dir))
|
||||
run_command("rm -rf {}".format(base_dir))
|
||||
os.chdir(orig_dir)
|
||||
|
|
Loading…
Reference in New Issue