[llvm-branch-commits] [llvm] 23d0827 - Add cmake/ to release tarballs via concatenation

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 1 22:13:36 PDT 2022


Author: Aaron Puchert
Date: 2022-04-01T22:12:38-07:00
New Revision: 23d08271a4b24f21a88bfe73a5ea31c1e2c6365c

URL: https://github.com/llvm/llvm-project/commit/23d08271a4b24f21a88bfe73a5ea31c1e2c6365c
DIFF: https://github.com/llvm/llvm-project/commit/23d08271a4b24f21a88bfe73a5ea31c1e2c6365c.diff

LOG: 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 3a33664e8838e8b77acd1bbb13b1cf5e580a1077)

Added: 
    

Modified: 
    llvm/utils/release/export.sh

Removed: 
    


################################################################################
diff  --git a/llvm/utils/release/export.sh b/llvm/utils/release/export.sh
index 43bb71d09bea8..55e38ab12bc7a 100755
--- a/llvm/utils/release/export.sh
+++ b/llvm/utils/release/export.sh
@@ -128,17 +128,21 @@ export_sources() {
             -cJf test-suite-$release$rc.src.tar.xz test-suite-$release$rc.src
     fi
 
+    # Package up top-level cmake directory so that we can append it to all projects.
+    tmp_dir=$(mktemp -d)
+    cmake_archive_file=$tmp_dir/cmake.tar
+    trap "rm -rv $tmp_dir" EXIT
+    pushd $llvm_src_dir
+    git archive -o $cmake_archive_file $tree_id cmake/
+    popd
+
     for proj in $projects; do
         echo "Creating tarball for $proj ..."
         pushd $llvm_src_dir/$proj
-        target_archive_file=$target_dir/$(template_file $proj)
-        trap "rm -fv $target_archive_file.tmp" EXIT
-        git archive --prefix=$proj-$release$rc.src/ -o $target_archive_file.tmp $tree_id .
-        # Get relative path to top-level cmake directory to be packaged
-        # alongside the project. Append that path to the tarball.
-        cmake_rel_path=$(realpath --relative-to=. $llvm_src_dir/cmake)
-        tar --append -f $target_archive_file.tmp $cmake_rel_path
-        cat $target_archive_file.tmp | xz > $target_archive_file
+        tmp_archive_file=$tmp_dir/$proj.tar
+        git archive --prefix=$proj-$release$rc.src/ -o $tmp_archive_file $tree_id .
+        tar -Af $tmp_archive_file $cmake_archive_file
+        xz < $tmp_archive_file > $target_dir/$(template_file $proj)
         popd
     done
 }


        


More information about the llvm-branch-commits mailing list