]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Makefile: don't use a versioned temp distribution directory
authorRamsay Jones <ramsay@ramsayjones.plus.com>
Tue, 8 Dec 2020 22:36:33 +0000 (22:36 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Dec 2020 00:56:56 +0000 (16:56 -0800)
The 'dist' target uses a versioned temp directory, $(GIT_TARNAME), into
which it copies various files added to the distribution tarball. Should
it be necessary to remove this directory in the 'clean' target, since
the name depends on $(GIT_VERSION), the current HEAD must be positioned
on the same commit as when 'make dist' was issued. Otherwise, the target
will fail to remove that directory.

Create an '.dist-tmp-dir' directory and copy the various files into this
now un-versioned directory while creating the distribution tarball. Change
the 'clean' target to remove the '.dist-tmp-dir' directory, instead of the
version dependent $(GIT_TARNAME) directory.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile

index 96e738924c816e51942c627ae87057bcf2d3c22a..2060f3787cdc7c85f84319a7b7b958c050826e98 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3061,9 +3061,9 @@ GIT_TARNAME = git-$(GIT_VERSION)
 GIT_ARCHIVE_EXTRA_FILES = \
        --prefix=$(GIT_TARNAME)/ \
        --add-file=configure \
-       --add-file=$(GIT_TARNAME)/version \
+       --add-file=.dist-tmp-dir/version \
        --prefix=$(GIT_TARNAME)/git-gui/ \
-       --add-file=$(GIT_TARNAME)/git-gui/version
+       --add-file=.dist-tmp-dir/git-gui/version
 ifdef DC_SHA1_SUBMODULE
 GIT_ARCHIVE_EXTRA_FILES += \
        --prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
@@ -3075,13 +3075,14 @@ GIT_ARCHIVE_EXTRA_FILES += \
        --add-file=sha1collisiondetection/lib/ubc_check.h
 endif
 dist: git-archive$(X) configure
-       @mkdir -p $(GIT_TARNAME)
-       @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
-       @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
+       @$(RM) -r .dist-tmp-dir
+       @mkdir .dist-tmp-dir
+       @echo $(GIT_VERSION) > .dist-tmp-dir/version
+       @$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
        ./git-archive --format=tar \
                $(GIT_ARCHIVE_EXTRA_FILES) \
                --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
-       @$(RM) -r $(GIT_TARNAME)
+       @$(RM) -r .dist-tmp-dir
        gzip -f -9 $(GIT_TARNAME).tar
 
 rpm::
@@ -3158,7 +3159,7 @@ clean: profile-clean coverage-clean cocciclean
        $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
        $(RM) -r po/build/
        $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
-       $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
+       $(RM) -r .dist-tmp-dir .doc-tmp-dir
        $(RM) $(GIT_TARNAME).tar.gz
        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
        $(MAKE) -C Documentation/ clean