Skip to content

Commit 2502787

Browse files
author
Patrick Schleizer
committed
support symlinks to be able to package corridor
rustybird/corridor#18 rustybird/corridor#10
1 parent 5ac6bf8 commit 2502787

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

usr/share/genmkfile/make-helper.bsh

+25-14
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,15 @@ make_get_variables() {
401401
make_debian_tarball="${make_debian_tarball,,}"
402402
fi
403403

404-
make_upstream_tarball_file_name="${make_source_package_name}_${make_pkg_version}.orig.tar.gz"
405-
make_upstream_tarball="$DISTDIR/$make_upstream_tarball_file_name"
406-
if [ "$make_upstream_tarball_tolower" = "false" ]; then
404+
make_upstream_tarball_relative_path_file_name="${make_source_package_name}_${make_pkg_version}.orig.tar.gz"
405+
make_upstream_tarball_relative_path="$DISTDIR/$make_upstream_tarball_relative_path_file_name"
406+
if [ "$make_upstream_tarball_relative_path_tolower" = "false" ]; then
407407
true
408408
else
409-
make_upstream_tarball_file_name="${make_upstream_tarball_file_name,,}"
410-
make_upstream_tarball="${make_upstream_tarball,,}"
409+
make_upstream_tarball_relative_path_file_name="${make_upstream_tarball_relative_path_file_name,,}"
410+
make_upstream_tarball_relative_path="${make_upstream_tarball_relative_path,,}"
411411
fi
412+
make_upstream_tarball_real_path="$(realpath "$make_upstream_tarball_relative_path")"
412413

413414
make_upstream_tarball_source_folder_name="${make_source_package_name}-${make_pkg_version}"
414415
}
@@ -514,6 +515,13 @@ make reprepro-add
514515
make_dist() {
515516
make_function_run make_undist
516517

518+
local temp_folder
519+
temp_folder="$(mktemp --directory)"
520+
521+
cp --recursive ../corridor "$temp_folder/$make_upstream_tarball_source_folder_name"
522+
523+
pushd "$temp_folder/$make_upstream_tarball_source_folder_name"
524+
517525
shopt -s globstar dotglob nullglob
518526

519527
## Required to make deterministic.
@@ -522,16 +530,14 @@ make_dist() {
522530

523531
shopt -u globstar dotglob nullglob
524532

525-
## Thanks to Andy Balaam who inspired on
526-
## http://superuser.com/a/599420/255849
527-
## how to prepend a folder name by using tar with --transform.
533+
## No longer using --transform because that does not work with symlinks.
534+
## (Important for 'corridor' package.)
528535

529536
find \
530537
"." \
531538
-not -iwholename '*.git*' \
532539
-print0 \
533540
| tar \
534-
--transform "s,^\\.,$make_upstream_tarball_source_folder_name," \
535541
--null \
536542
--no-recursion \
537543
--create \
@@ -540,9 +546,14 @@ make_dist() {
540546
--numeric-owner \
541547
-T \
542548
- \
543-
| gzip -9 -n > "$make_upstream_tarball"
549+
| gzip -9 -n > "$make_upstream_tarball_real_path"
550+
551+
popd
552+
553+
rm --recursive --force "$temp_folder"
544554

545-
ls -la "$make_upstream_tarball"
555+
ls -la "$make_upstream_tarball_real_path"
556+
ls -la "$make_upstream_tarball_relative_path"
546557
}
547558

548559
make_debdist() {
@@ -578,7 +589,7 @@ make_undist() {
578589
make_function_run make_get_distdir
579590
make_function_run make_get_variables
580591

581-
rm --force "$make_upstream_tarball"
592+
rm --force "$make_upstream_tarball_relative_path"
582593
}
583594

584595
make_undebdist() {
@@ -842,8 +853,8 @@ make_deb-cleanup() {
842853
fi
843854
done
844855
done
845-
if [ -f "$make_upstream_tarball" ]; then
846-
rm "$make_upstream_tarball"
856+
if [ -f "$make_upstream_tarball_relative_path" ]; then
857+
rm "$make_upstream_tarball_relative_path"
847858
fi
848859
}
849860

0 commit comments

Comments
 (0)