Skip to content

Commit 30468db

Browse files
authored
Optimize setting LLVM version for TLCPack (#191)
This change fixes issue apache/tvm#16613 Changes the script `centos_build_llvm.sh` to discover what tags are available in the LLVM project using `git ls-remote`. This is a more efficient approach, as it doesn't use the Github API and therefore isn't impacted by API rate limits, which will prevent the script from working correctly. The end result is the same and retrieves the latest semantic version for LLVM in the format XX.X.XX, e.g. 16.0.6.
1 parent 7c6365b commit 30468db

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docker/install/centos_build_llvm.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ LLVM_VERSION_MAJOR=$1
77
source /multibuild/manylinux_utils.sh
88

99
detect_llvm_version() {
10-
curl -sL "https://api.github.com/repos/llvm/llvm-project/releases?per_page=100" | \
11-
grep tag_name | \
12-
grep -o "llvmorg-${LLVM_VERSION_MAJOR}[^\"]*" | \
13-
grep -v rc | \
14-
sed -e "s/^llvmorg-//g" | \
15-
head -n 1
10+
git ls-remote --sort='v:refname' --tags --refs 'https://github.com/llvm/llvm-project' | \
11+
grep "llvmorg-${LLVM_VERSION_MAJOR}" | \
12+
grep -v 'rc' | \
13+
awk 'BEGIN { FS="-" } END {print $2}'
1614
}
1715

1816
LLVM_VERSION=$(detect_llvm_version)

0 commit comments

Comments
 (0)