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.
@@ -737,7 +736,14 @@ def _get_llvm_version(rctx):
737
736
)
738
737
return llvm_version
739
738
740
- _UBUNTU_NAMES = ["arch" , "linuxmint" , "manjaro" , "nixos" , "pop" , "ubuntu" ]
739
+ _UBUNTU_NAMES = [
740
+ "arch" ,
741
+ "linuxmint" ,
742
+ "manjaro" ,
743
+ "nixos" ,
744
+ "pop" ,
745
+ "ubuntu" ,
746
+ ]
741
747
742
748
_UBUNTU_VERSIONS = [
743
749
"linux-ubuntu-20.04" ,
@@ -769,7 +775,6 @@ def _dist_to_os_names(dist, default_os_names = []):
769
775
"linux-sles11.3" ,
770
776
"linux-sles" ,
771
777
"unknown-linux-gnu-rhel86" ,
772
- "linux-gnu-ubuntu-24.04" ,
773
778
"linux-gnu-ubuntu-22.04" ,
774
779
"linux-gnu-ubuntu-20.04" ,
775
780
"linux-gnu-ubuntu-18.04" ,
@@ -791,6 +796,10 @@ def _dist_to_os_names(dist, default_os_names = []):
791
796
return ["linux-gnueabihf" , "linux-gnu" ]
792
797
if dist .name in ["rhel" , "ol" , "almalinux" ]:
793
798
return ["linux-rhel-" , "linux-gnu-rhel-" ]
799
+ if dist .name == "debian" :
800
+ return [
801
+ "linux-gnu-debian8" ,
802
+ ] + _UBUNTU_VERSIONS
794
803
if dist .name in _UBUNTU_NAMES :
795
804
return [
796
805
"linux-gnu-ubuntu-" + dist .version ,
@@ -951,57 +960,29 @@ def _find_llvm_basename_list(llvm_version, arch, os, dist):
951
960
else :
952
961
fail ("ERROR: Unknown OS: {os}" .format (os = os ))
953
962
954
- def _find_llvm_basename_maybe_fail (llvm_version , arch , os , dist , should_fail ):
963
+ def _find_llvm_basename_maybe_fail (llvm_version , arch , os , dist ):
955
964
basenames = _find_llvm_basename_list (llvm_version , arch , os , dist )
956
965
if len (basenames ) > 1 :
957
- if fail :
958
- fail ("ERROR: Multiple configurations found [{basenames}]." .format (
959
- basenames = ", " .join (basenames ),
960
- ))
961
- return None
966
+ fail ("ERROR: Multiple configurations found [{basenames}]." .format (
967
+ basenames = ", " .join (basenames ),
968
+ ))
962
969
if not basenames :
963
- if should_fail :
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
- ))
971
- return None
970
+ fail ("ERROR: No matching config could be found for version {llvm_version} on {os}/{dist_name}/{dist_version} with arch {arch}." .format (
971
+ llvm_version = llvm_version ,
972
+ os = os ,
973
+ dist_name = dist .name ,
974
+ dist_version = dist .version ,
975
+ arch = arch ,
976
+ ))
972
977
973
978
# Use the following for debugging:
974
979
# print("Found LLVM: " + basenames[0]) # buildifier: disable=print
975
980
return basenames [0 ]
976
981
977
- def _major_llvm_version (llvm_version ):
978
- """Return the major version given `<major>['.' <minor> [ '.' <mini> [.*]]]."""
979
- return int (llvm_version .split ("." )[0 ])
980
-
981
- def _host_can_be_found (major_llvm_version , host_info ):
982
- """Return whether the basename can be found or needs to be predicted."""
983
- if major_llvm_version >= 19 :
984
- return True
985
- if host_info .os in ["darwin" , "windows" ]:
986
- return True
987
- if _dist_to_os_names (host_info .dist , []):
988
- return True
989
- if host_info .arch in ["aarch64" , "armv7a" , "mips" , "mipsel" ]:
990
- return True
991
-
992
- return False
993
-
994
982
def _llvm_release_name (rctx , llvm_version ):
995
- """Try to find the distribution in the configured list. Otherwise predict version name by input.
996
-
997
- For versions 19+ or we os==darwin fail if the distribution cannot be found automatically."""
998
- major_llvm_version = _major_llvm_version (llvm_version )
983
+ """Try to find the distribution in the configured list. Otherwise predict version name by input."""
999
984
host_info = _host_info (rctx )
1000
- should_fail = _host_can_be_found (major_llvm_version , host_info )
1001
- basename = _find_llvm_basename_maybe_fail (llvm_version , host_info .arch , host_info .os , host_info .dist , should_fail )
1002
- if basename :
1003
- return basename
1004
- return _llvm_release_name_context (rctx , llvm_version )
985
+ return _find_llvm_basename_maybe_fail (llvm_version , host_info .arch , host_info .os , host_info .dist )
1005
986
1006
987
def _distribution_urls (rctx ):
1007
988
"""Return LLVM `urls`, `shha256` and `strip_prefix` for the given context."""
@@ -1079,8 +1060,6 @@ def _write_distributions_impl(ctx):
1079
1060
dist_dict_list = {
1080
1061
"linux" : [
1081
1062
# struct(name = "ibm-aix", version = "7.2"), unreachable
1082
- # struct(name = "linux-gnu-debian", version = "8"), unreachable
1083
- # struct(name = "linux-gnu-rhel", version = "8.4"), unreachable
1084
1063
# keep sorted
1085
1064
struct (name = "amzn" , version = ANY_VER ),
1086
1065
struct (name = "arch" , version = ANY_VER ),
0 commit comments