19
19
_exec_os_arch_dict_value = "exec_os_arch_dict_value" ,
20
20
_host_info = "host_info" ,
21
21
)
22
- load ("//toolchain/internal:release_name.bzl" , _llvm_release_name_context = "llvm_release_name_context" )
23
22
24
23
# If a new LLVM version is missing from this list, please add the shasums here
25
24
# and the new version in toolchain/internal/llvm_distributions.golden.txt.
@@ -731,7 +730,14 @@ def _get_llvm_version(rctx):
731
730
)
732
731
return llvm_version
733
732
734
- _UBUNTU_NAMES = ["arch" , "linuxmint" , "manjaro" , "nixos" , "pop" , "ubuntu" ]
733
+ _UBUNTU_NAMES = [
734
+ "arch" ,
735
+ "linuxmint" ,
736
+ "manjaro" ,
737
+ "nixos" ,
738
+ "pop" ,
739
+ "ubuntu" ,
740
+ ]
735
741
736
742
_UBUNTU_VERSIONS = [
737
743
"linux-ubuntu-20.04" ,
@@ -763,7 +769,6 @@ def _dist_to_os_names(dist, default_os_names = []):
763
769
"linux-sles11.3" ,
764
770
"linux-sles" ,
765
771
"unknown-linux-gnu-rhel86" ,
766
- "linux-gnu-ubuntu-24.04" ,
767
772
"linux-gnu-ubuntu-22.04" ,
768
773
"linux-gnu-ubuntu-20.04" ,
769
774
"linux-gnu-ubuntu-18.04" ,
@@ -785,6 +790,10 @@ def _dist_to_os_names(dist, default_os_names = []):
785
790
return ["linux-gnueabihf" , "linux-gnu" ]
786
791
if dist .name in ["rhel" , "ol" , "almalinux" ]:
787
792
return ["linux-rhel-" , "linux-gnu-rhel-" ]
793
+ if dist .name == "debian" :
794
+ return [
795
+ "linux-gnu-debian8" ,
796
+ ] + _UBUNTU_VERSIONS
788
797
if dist .name in _UBUNTU_NAMES :
789
798
return [
790
799
"linux-gnu-ubuntu-" + dist .version ,
@@ -945,57 +954,29 @@ def _find_llvm_basename_list(llvm_version, arch, os, dist):
945
954
else :
946
955
fail ("ERROR: Unknown OS: {os}" .format (os = os ))
947
956
948
- def _find_llvm_basename_maybe_fail (llvm_version , arch , os , dist , should_fail ):
957
+ def _find_llvm_basename_maybe_fail (llvm_version , arch , os , dist ):
949
958
basenames = _find_llvm_basename_list (llvm_version , arch , os , dist )
950
959
if len (basenames ) > 1 :
951
- if fail :
952
- fail ("ERROR: Multiple configurations found [{basenames}]." .format (
953
- basenames = ", " .join (basenames ),
954
- ))
955
- return None
960
+ fail ("ERROR: Multiple configurations found [{basenames}]." .format (
961
+ basenames = ", " .join (basenames ),
962
+ ))
956
963
if not basenames :
957
- if should_fail :
958
- fail ("ERROR: No matching config could be found for version {llvm_version} on {os}/{dist_name}/{dist_version} with arch {arch}." .format (
959
- llvm_version = llvm_version ,
960
- os = os ,
961
- dist_name = dist .name ,
962
- dist_version = dist .version ,
963
- arch = arch ,
964
- ))
965
- return None
964
+ fail ("ERROR: No matching config could be found for version {llvm_version} on {os}/{dist_name}/{dist_version} with arch {arch}." .format (
965
+ llvm_version = llvm_version ,
966
+ os = os ,
967
+ dist_name = dist .name ,
968
+ dist_version = dist .version ,
969
+ arch = arch ,
970
+ ))
966
971
967
972
# Use the following for debugging:
968
973
# print("Found LLVM: " + basenames[0]) # buildifier: disable=print
969
974
return basenames [0 ]
970
975
971
- def _major_llvm_version (llvm_version ):
972
- """Return the major version given `<major>['.' <minor> [ '.' <mini> [.*]]]."""
973
- return int (llvm_version .split ("." )[0 ])
974
-
975
- def _host_can_be_found (major_llvm_version , host_info ):
976
- """Return whether the basename can be found or needs to be predicted."""
977
- if major_llvm_version >= 19 :
978
- return True
979
- if host_info .os in ["darwin" , "windows" ]:
980
- return True
981
- if _dist_to_os_names (host_info .dist , []):
982
- return True
983
- if host_info .arch in ["aarch64" , "armv7a" , "mips" , "mipsel" ]:
984
- return True
985
-
986
- return False
987
-
988
976
def _llvm_release_name (rctx , llvm_version ):
989
- """Try to find the distribution in the configured list. Otherwise predict version name by input.
990
-
991
- For versions 19+ or we os==darwin fail if the distribution cannot be found automatically."""
992
- major_llvm_version = _major_llvm_version (llvm_version )
977
+ """Try to find the distribution in the configured list. Otherwise predict version name by input."""
993
978
host_info = _host_info (rctx )
994
- should_fail = _host_can_be_found (major_llvm_version , host_info )
995
- basename = _find_llvm_basename_maybe_fail (llvm_version , host_info .arch , host_info .os , host_info .dist , should_fail )
996
- if basename :
997
- return basename
998
- return _llvm_release_name_context (rctx , llvm_version )
979
+ return _find_llvm_basename_maybe_fail (llvm_version , host_info .arch , host_info .os , host_info .dist )
999
980
1000
981
def _distribution_urls (rctx ):
1001
982
"""Return LLVM `urls`, `shha256` and `strip_prefix` for the given context."""
@@ -1073,8 +1054,6 @@ def _write_distributions_impl(ctx):
1073
1054
dist_dict_list = {
1074
1055
"linux" : [
1075
1056
# struct(name = "ibm-aix", version = "7.2"), unreachable
1076
- # struct(name = "linux-gnu-debian", version = "8"), unreachable
1077
- # struct(name = "linux-gnu-rhel", version = "8.4"), unreachable
1078
1057
# keep sorted
1079
1058
struct (name = "amzn" , version = ANY_VER ),
1080
1059
struct (name = "arch" , version = ANY_VER ),
0 commit comments