Skip to content

Commit 23d0827

Browse files
aaronpucherttstellar
authored andcommitted
Add cmake/ to release tarballs via concatenation
The solution using append was reported not to work, but additionally it would use the contents of the checked-out source tree instead of the git tag or commit. This uses `git archive`, so it will use the right commit, and at least for me (with GNU tar) it seems to work as intended. Should fix #53281. Reviewed By: kwk Differential Revision: https://reviews.llvm.org/D121972 (cherry picked from commit 3a33664)
1 parent b69247d commit 23d0827

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

llvm/utils/release/export.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,21 @@ export_sources() {
128128
-cJf test-suite-$release$rc.src.tar.xz test-suite-$release$rc.src
129129
fi
130130

131+
# Package up top-level cmake directory so that we can append it to all projects.
132+
tmp_dir=$(mktemp -d)
133+
cmake_archive_file=$tmp_dir/cmake.tar
134+
trap "rm -rv $tmp_dir" EXIT
135+
pushd $llvm_src_dir
136+
git archive -o $cmake_archive_file $tree_id cmake/
137+
popd
138+
131139
for proj in $projects; do
132140
echo "Creating tarball for $proj ..."
133141
pushd $llvm_src_dir/$proj
134-
target_archive_file=$target_dir/$(template_file $proj)
135-
trap "rm -fv $target_archive_file.tmp" EXIT
136-
git archive --prefix=$proj-$release$rc.src/ -o $target_archive_file.tmp $tree_id .
137-
# Get relative path to top-level cmake directory to be packaged
138-
# alongside the project. Append that path to the tarball.
139-
cmake_rel_path=$(realpath --relative-to=. $llvm_src_dir/cmake)
140-
tar --append -f $target_archive_file.tmp $cmake_rel_path
141-
cat $target_archive_file.tmp | xz > $target_archive_file
142+
tmp_archive_file=$tmp_dir/$proj.tar
143+
git archive --prefix=$proj-$release$rc.src/ -o $tmp_archive_file $tree_id .
144+
tar -Af $tmp_archive_file $cmake_archive_file
145+
xz < $tmp_archive_file > $target_dir/$(template_file $proj)
142146
popd
143147
done
144148
}

0 commit comments

Comments
 (0)