summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2020-12-21 10:23:51 +0100
committerSimon Horman <horms@verge.net.au>2021-04-02 12:11:45 +0200
commit41b77edaceeabb5907eda95ff64ee8ec81551fe5 (patch)
tree92536a305058ab4c7f02e9bff2a4618db711f05b
parent1bc7bc7649fa29d95c98f6a6d8dd2f08734a865c (diff)
downloadkexec-tools-41b77edaceeabb5907eda95ff64ee8ec81551fe5.tar.gz
build: create tarball without self-referential hard links
The current method of creating the tarball, which is to the hard-link the source directory to the target directory, results in self-referential hardlinks which can be observed using tar xf. This patch resolves this by using an intermediate tarball, held in memory, which collects files to be distributed. This is then unpacked in the target directory which is finally packed into the distribution tarball, a file. Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--Makefile.in11
1 files changed, 5 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in
index fb01134d..a9c779f1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -201,14 +201,13 @@ configure: configure.ac
tarball: $(TARBALL.gz)
$(TARBALL): $(SRCS) $(GENERATED_SRCS)
- $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
- $(LN) -s $(srcdir) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(TAR) -c $(SRCS) $(GENERATED_SRCS) | \
+ $(TAR) -C $(PACKAGE_NAME)-$(PACKAGE_VERSION) -x
$(TAR) -cf $@ $(PSRCS)
- $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
- $(LN) -sf . $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TAR) -rf $@ $(PGSRCS)
- $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
- @echo $(dist)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TARBALL.gz): $(TARBALL)
gzip -c < $^ > $@