summarylogtreecommitdiffstats
path: root/bazel-distro.patch
blob: 45d8e3943b0869596be09b6c7c4fcbbcd1ffa857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff --git a/bazel/utils.bzl b/bazel/utils.bzl
index 286a21bb..270d6146 100644
--- a/bazel/utils.bzl
+++ b/bazel/utils.bzl
@@ -106,50 +106,5 @@ def get_toolchain_subs(ctx):
     return distro, arch, substitutions
 
 def get_host_distro_major_version(repository_ctx):
-    _DISTRO_PATTERN_MAP = {
-        "Ubuntu 18*": "ubuntu18",
-        "Ubuntu 20*": "ubuntu20",
-        "Ubuntu 22*": "ubuntu22",
-        "Pop!_OS 22*": "ubuntu22",
-        "Ubuntu 24*": "ubuntu24",
-        "Amazon Linux 2": "amazon_linux_2",
-        "Amazon Linux 2023": "amazon_linux_2023",
-        "Debian GNU/Linux 10": "debian10",
-        "Debian GNU/Linux 12": "debian12",
-        "Red Hat Enterprise Linux 8*": "rhel8",
-        "Red Hat Enterprise Linux 9*": "rhel9",
-        "SLES 15*": "suse15",
-    }
-
-    if repository_ctx.os.name != "linux":
-        return None
-
-    result = repository_ctx.execute([
-        "sed",
-        "-n",
-        "/^\\(NAME\\|VERSION_ID\\)=/{s/[^=]*=//;s/\"//g;p}",
-        "/etc/os-release",
-    ])
-
-    if result.return_code != 0:
-        print("Failed to determine system distro, parsing os-release failed with the error: " + result.stderr)
-        return None
-
-    distro_seq = result.stdout.splitlines()
-    if len(distro_seq) != 2:
-        print("Failed to determine system distro, parsing os-release returned: " + result.stdout)
-        return None
-
-    distro_str = "{distro_name} {distro_version}".format(
-        distro_name = distro_seq[0],
-        distro_version = distro_seq[1],
-    )
-
-    for distro_pattern, simplified_name in _DISTRO_PATTERN_MAP.items():
-        if "*" in distro_pattern:
-            prefix_suffix = distro_pattern.split("*")
-            if distro_str.startswith(prefix_suffix[0]) and distro_str.endswith(prefix_suffix[1]):
-                return simplified_name
-        elif distro_str == distro_pattern:
-            return simplified_name
-    return None
+    # Override: Always return arch regardless
+    return "arch"