Makefile: Use an intermediate file to list files to put in the source archive

Using xargs(1) is not always possible because it has a default limit on
the number of bytes it reads on stdin which can be too low for our need.
When we reach this limit, it breaks in a non-obvious way: the created
archive contains half of the expected files.

Now, we go through an intermediate file: the list is created once with
find(1) and sort(1) and consumed from tar(1) and zip(1).
This commit is contained in:
Jean-Sébastien Pédron 2017-01-17 17:34:39 +01:00
parent 48b3133bd7
commit b9dd874671
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
1 changed files with 12 additions and 12 deletions

View File

@ -150,32 +150,32 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
done done
$(verbose) echo "PLUGINS := $(PLUGINS)" > $@/plugins.mk $(verbose) echo "PLUGINS := $(PLUGINS)" > $@/plugins.mk
$(SOURCE_DIST).manifest: $(SOURCE_DIST)
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) | LC_COLLATE=C sort > $@
# TODO: Fix file timestamps to have reproducible source archives. # TODO: Fix file timestamps to have reproducible source archives.
# $(verbose) find $@ -not -name 'git-revisions.txt' -print0 | xargs -0 touch -r $@/git-revisions.txt # $(verbose) find $@ -not -name 'git-revisions.txt' -print0 | xargs -0 touch -r $@/git-revisions.txt
$(SOURCE_DIST).tar.gz: $(SOURCE_DIST) $(SOURCE_DIST).tar.gz: $(SOURCE_DIST).manifest
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \ $(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \ $(TAR) $(TAR_V) -T $(SOURCE_DIST).manifest --no-recursion -cf - | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(GZIP) --best > $@ $(GZIP) --best > $@
$(SOURCE_DIST).tar.bz2: $(SOURCE_DIST) $(SOURCE_DIST).tar.bz2: $(SOURCE_DIST).manifest
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \ $(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \ $(TAR) $(TAR_V) -T $(SOURCE_DIST).manifest --no-recursion -cf - | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(BZIP2) > $@ $(BZIP2) > $@
$(SOURCE_DIST).tar.xz: $(SOURCE_DIST) $(SOURCE_DIST).tar.xz: $(SOURCE_DIST).manifest
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \ $(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \ $(TAR) $(TAR_V) -T $(SOURCE_DIST).manifest --no-recursion -cf - | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(XZ) > $@ $(XZ) > $@
$(SOURCE_DIST).zip: $(SOURCE_DIST) $(SOURCE_DIST).zip: $(SOURCE_DIST).manifest
$(verbose) rm -f $@ $(verbose) rm -f $@
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \ $(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \ $(ZIP) $(ZIP_V) --names-stdin $@ < $(SOURCE_DIST).manifest
xargs -0 $(ZIP) $(ZIP_V) $@
clean:: clean-source-dist clean-upgrade clean:: clean-source-dist clean-upgrade