History

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.

Simon Horman committed 5 years ago

Commit 41b77ed1 parent 1bc7bc71 file · +5 −6Browse files

Unified · Split

Makefile.in+5−6
@@ -201,14 +201,13 @@ configure: configure.ac · 200 unmodified lines
201201 tarball: $(TARBALL.gz)
202202
203203 $(TARBALL): $(SRCS) $(GENERATED_SRCS)
204− $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
205− $(LN) -s $(srcdir) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
204+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
205+ $(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
206+ $(TAR) -c $(SRCS) $(GENERATED_SRCS) | \
207+ $(TAR) -C $(PACKAGE_NAME)-$(PACKAGE_VERSION) -x
206208 $(TAR) -cf $@ $(PSRCS)
207− $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
208− $(LN) -sf . $(PACKAGE_NAME)-$(PACKAGE_VERSION)
209209 $(TAR) -rf $@ $(PGSRCS)
210− $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)
211− @echo $(dist)
210+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
212211
213212 $(TARBALL.gz): $(TARBALL)
214213 gzip -c < $^ > $@

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t