@@ -706,12 +706,14 @@ _llvm_distributions = {
706706 "clang+llvm-21.1.4-x86_64-pc-windows-msvc.tar.xz" : "511e4e7e0a43156cb1410578285f1db246ebb400db0018cd304c84a369562b6d" ,
707707
708708 # 21.1.5
709- "LLVM-21.1.5-Linux-ARM64.tar.xz" : "c9a1ee5d1a1698a8eb0abda1c1e44c812378aec32f89cc4fbbb41865237359a9" ,
710- "LLVM-21.1.5-Linux-X64.tar.xz" : "6279d78feeeb8e839a397f0bca7b1c0594972224d59525496416653d9b9c077f" ,
711- "clang+llvm-21.1.5-x86_64-pc-windows-msvc.tar.xz" : "eba824f1379fdb1a385f6dff8d19275a57348f621c752ce93b6d11256741e349" ,
709+ "clang+llvm-21.1.5-aarch64-pc-windows-msvc.tar.xz" : "sha256:dcc7a6f9e3ff02f5b49b23e6f91abe2f9431972d72ab59f7b7d9f8b436ea1ca3" ,
710+ "clang+llvm-21.1.5-armv7a-linux-gnueabihf.tar.gz" : "sha256:42a964c0ea68764ef8e222f5f979a400a803a912e5df273358652d4017ca3411" ,
711+ "clang+llvm-21.1.5-x86_64-pc-windows-msvc.tar.xz" : "sha256:eba824f1379fdb1a385f6dff8d19275a57348f621c752ce93b6d11256741e349" ,
712+ "LLVM-21.1.5-Linux-ARM64.tar.xz" : "sha256:c9a1ee5d1a1698a8eb0abda1c1e44c812378aec32f89cc4fbbb41865237359a9" ,
713+ "LLVM-21.1.5-Linux-X64.tar.xz" : "sha256:6279d78feeeb8e839a397f0bca7b1c0594972224d59525496416653d9b9c077f" ,
712714
713715 # Refer to variable declaration on how to update!
714- # Example update (without deleting ): utils/llvm_checksums.sh -g -t /tmp/llvm -v 21.1.5
716+ # Example update (without download ): utils/llvm_checksums.sh -D -g -t /tmp/llvm -v 21.1.5
715717}
716718
717719# Note: Unlike the user-specified llvm_mirror attribute, the URL prefixes in
@@ -779,6 +781,13 @@ def _full_url(url):
779781 return "file://" + url
780782 return url
781783
784+ def _normalize_and_check_sha256 (sha256 ):
785+ if sha256 :
786+ sha256 = sha256 .removeprefix ("sha256:" )
787+ if len (sha256 ) != 64 :
788+ return None , "Attribute sha256 needs exactly 64 hex characters."
789+ return sha256 , None
790+
782791def download_llvm (rctx ):
783792 """Download the LLVM distribution for the given context."""
784793 urls = []
@@ -793,9 +802,13 @@ def download_llvm(rctx):
793802 if not urls :
794803 urls , sha256 , strip_prefix = _distribution_urls (rctx )
795804
805+ sha256 , shaerr = _normalize_and_check_sha256 (sha256 )
806+ if shaerr :
807+ fail ("ERROR: " + shaerr )
808+
796809 res = rctx .download_and_extract (
797810 [_full_url (url ) for url in urls ],
798- sha256 = sha256 ,
811+ sha256 ,
799812 stripPrefix = strip_prefix ,
800813 auth = _get_auth (rctx , urls ),
801814 )
@@ -1443,6 +1456,13 @@ def _distributions_test_writer_impl(ctx):
14431456 extra_llvm_distributions = extra_llvm_distributions ,
14441457 parsed_llvm_version = version ,
14451458 )
1459+ for basename , distribution in all_llvm_distributions .items ():
1460+ sha256 , shaerr = _normalize_and_check_sha256 (distribution .sha256 )
1461+ if shaerr :
1462+ output .append ("err: {basename}: bad sha256: {shaerr}" .format (
1463+ basename = basename ,
1464+ shaerr = shaerr ,
1465+ ))
14461466 for arch in arch_list :
14471467 for os in os_list :
14481468 if version < MIN_VERSION :
0 commit comments