gollvm: fix linux distro detection for Arch
The existing detection will wrongly detect Arch Linux as Ubuntu since there is lsb-release as well as arch-release under /etc/. This patch tries to fix it by changing the order of detection.
Updates golang/go#36512.
Change-Id: I3af1a9ce6843e25b47e1db4755e77303d06b33da
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/399317
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/driver/Distro.cpp b/driver/Distro.cpp
index 028dbea..2eace0d 100644
--- a/driver/Distro.cpp
+++ b/driver/Distro.cpp
@@ -34,9 +34,6 @@
if (ifs.exists("/etc/debian_version"))
return DistroDebian;
- if (ifs.exists("/etc/lsb-release"))
- return DistroUbuntu;
-
if (ifs.exists("/etc/redhat-release"))
return DistroRedhat;
@@ -52,6 +49,9 @@
if (ifs.exists("/etc/gentoo-release"))
return DistroGentoo;
+ if (ifs.exists("/etc/lsb-release"))
+ return DistroUbuntu;
+
return DistroUnknown;
}