]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use "git archive" for the "make releasetar" process
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 28 Oct 2022 16:34:55 +0000 (18:34 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 28 Oct 2022 16:34:55 +0000 (18:34 +0200)
Use the release tag if it exists or use HEAD.

Remove the "autoreconf -f" command, because it changes the configure file
locally in an uncontrolled way (runstatedir, #define LARGE_OFF_T, etc.)
depending on the autoconf version. This command is run in the release
process before a commit and we can choose the parts that will be added
in the commit.

Note:
The following target (rcX) must be updated ou removed in a next step
because it was using "autoreconf -f" (via "make releasetar") and it
changes the VERSION and configure files locally.

This change
1) Ensures that we only release files from tag/HEAD, not locally
   modified ones.
2) Avoids disclosing personal data such as the username/group of the
   local user.
3) Puts by default a umask of 0002, which turns off the world write bit
   on files in the archive.
4) Avoids problems on some OSes (no more tar, Git builtin tar.gz
   handling).

CHANGES
Makefile.in

diff --git a/CHANGES b/CHANGES
index 10334cf39c3d16ca1fd85a6a4a47692756d3f108..b30121e1292adefd2d1cb284415f6978c721ec89 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -93,6 +93,7 @@ TBD
       Handle some Autoconf/make errors better.
       Fix an error when corss-compiling.
       Fix "make releasetar" on AIX and Solaris.
+      Use "git archive" for the "make releasetar" process.
       Mend "make check" on Solaris 9 with Autoconf.
       Address assorted compiler warnings.
       Fix auto-enabling of Capsicum on FreeBSD with Autoconf.
index f579f38f632b1bca726309842b624622495873ec..ef6605aed6f2af65e82537c0484a15991b20820d 100644 (file)
@@ -389,6 +389,8 @@ EXTRA_DIST = \
 
 TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
 
+RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST)
+
 all: $(PROG)
 
 $(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT)
@@ -475,14 +477,16 @@ TAGS: $(TAGFILES)
        etags $(TAGFILES)
 
 releasetar:
-       @autoreconf -f && \
-       name=$(PROG)-`cat VERSION` && \
-          mkdir $$name && \
-          tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) >/dev/null && \
-          tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -) && \
-          tar cf - $$name >/dev/null && \
-          tar cf - $$name | gzip >$$name.tar.gz && \
-          rm -rf $$name
+       @TAG=$(PROG)-`cat VERSION` && \
+       if git show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
+           git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz "$$TAG" \
+           $(RELEASE_FILES) && \
+           echo "Archive build from tag $$TAG."; \
+       else \
+           git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \
+           $(RELEASE_FILES) && \
+           echo "No $$TAG tag. Archive build from HEAD."; \
+       fi
 
 rc1 rc2 rc3 rc4 rc5:
        @VER=`cat $(srcdir)/VERSION`; \