Skip to content

Commit 60a7f35

Browse files
committed
Take 2: use symlinks
Instead of transforming the file names, just create a temporary symlink in the source directory that points back to the root of the source directory. As long as symlinks work properly, this should be a portable solution.
1 parent ab8a86f commit 60a7f35

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,14 @@ endif
515515

516516
# Make tarball with only Julia code
517517
light-source-dist: light-source-dist.tmp
518-
# The --transform option prepends julia-$(commit-sha)/ or julia-$(version)/ to filenames
519-
# (but requires a tar implementation supporting it).
520-
tar -cz --no-recursion --transform "s/^/julia-$(JULIA_COMMIT)\//" -T light-source-dist.tmp -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT).tar.gz
518+
# Prefix everything with "julia-$(commit-sha)/" or "julia-$(version)/" and then create tarball
519+
# To achieve prefixing, we temporarily create a symlink in the source directory that points back
520+
# to the source directory.
521+
DIRNAME=julia-$(JULIA_COMMIT); \
522+
sed -e "s_.*_$$DIRNAME/&_" light-source-dist.tmp > light-source-dist.tmp1; \
523+
ln -s . $$DIRNAME || exit 1; \
524+
tar -cz --no-recursion -T light-source-dist.tmp1 -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT).tar.gz; \
525+
rm -v $$DIRNAME
521526

522527
source-dist:
523528
@echo \'source-dist\' target is deprecated: use \'full-source-dist\' instead.
@@ -531,9 +536,14 @@ full-source-dist: light-source-dist.tmp
531536
cp light-source-dist.tmp full-source-dist.tmp
532537
-ls deps/srccache/*.tar.gz deps/srccache/*.tar.bz2 deps/srccache/*.tar.xz deps/srccache/*.tgz deps/srccache/*.zip deps/srccache/*.pem >> full-source-dist.tmp
533538

534-
# Create the tarball. The --transform option prepends julia-$(commit-sha)/ or
535-
# julia-$(version)/ to filenames (but requires a tar implementation supporting it).
536-
tar -cz --no-recursion --transform "s/^/julia-$(JULIA_COMMIT)\//" -T full-source-dist.tmp -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT)-full.tar.gz
539+
# Prefix everything with "julia-$(commit-sha)/" or "julia-$(version)/" and then create tarball
540+
# To achieve prefixing, we temporarily create a symlink in the source directory that points back
541+
# to the source directory.
542+
DIRNAME=julia-$(JULIA_COMMIT); \
543+
sed -e "s_.*_$$DIRNAME/&_" full-source-dist.tmp > full-source-dist.tmp1; \
544+
ln -s . $$DIRNAME || exit 1; \
545+
tar -cz --no-recursion -T full-source-dist.tmp1 -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT)-full.tar.gz; \
546+
rm -v $$DIRNAME
537547

538548
clean: | $(CLEAN_TARGETS)
539549
@-$(MAKE) -C $(BUILDROOT)/base clean

0 commit comments

Comments
 (0)