Skip to content

Commit cb8406b

Browse files
committed
Fix Linux host config
1 parent b151599 commit cb8406b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

uv/private/host/repository.bzl

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,30 @@ def _platform(rctx):
2929

3030
elif os == "linux":
3131
res = rctx.execute(["ldd", "--version"])
32+
if res.return_code != 0:
33+
fail("Unable to determine host libc!")
3234

33-
libc = "musllinux" if "musl" in res.stdout else "manylinux"
34-
if libc == "musllinux":
35+
out = res.stdout.lower()
36+
37+
# - Alpine: "musl libc\nversion <ver>\n ..."
38+
if "musl" in out:
3539
ver = res.stdout.split("\n")[1].split(" ")[-1].split(".")
36-
return libc, "{}.{}".format(ver[0], ver[1])
40+
return "musl", "{}.{}".format(ver[0], ver[1])
41+
42+
# - Amazon Linux: "ldd (gnu libc ...) <ver>\n..."
43+
# - Arch Linux: "ldd (gnu libc ...) <ver>\n..."
44+
# - Debian: "ldd (debian glibc ...) <ver>\n..."
45+
# - Fedora: "ldd (gnu libc ...) <ver>\n..."
46+
# - Oracle Linux: "ldd (gnu libc ...) <ver>\n..."
47+
# - Ubuntu: "ldd (ubuntu glibc ...) <ver>\n..."
48+
elif "glibc" in out or "gnu libc" in out:
49+
ver = res.stdout.split("\n")[0].split(")")[1].strip().split(".")
50+
major = ver[0]
51+
minor = ver[1]
52+
return "glibc", "{}.{}".format(major, minor)
3753

38-
elif libc == "manylinux":
39-
ver = res.stdout.split("\n")[0].split(" ")[-1].split(".")
40-
return libc, "{}.{}".format(ver[0], ver[1])
54+
else:
55+
fail("Unknown libc from ldd --version %r" % res.stdout)
4156

4257
# TODO: Windows
4358
# TODO: Other

0 commit comments

Comments
 (0)