Skip to content

Commit 11032a3

Browse files
committed
[clang] Updates for support for Ubuntu, Debian and RHEL
Remove support for long unsupported Ubuntu, Debian and RHEL. Add support for RHEL 8, 9 and 10 and recognize Rocky and AlmaLinux as RHEL.
1 parent e5827e7 commit 11032a3

File tree

2 files changed

+15
-29
lines changed

2 files changed

+15
-29
lines changed

clang/include/clang/Driver/Distro.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ class Distro {
3030
// the first and last known member in the family, e.g. IsRedHat().
3131
AlpineLinux,
3232
ArchLinux,
33-
DebianLenny,
34-
DebianSqueeze,
35-
DebianWheezy,
3633
DebianJessie,
3734
DebianStretch,
3835
DebianBuster,
@@ -42,16 +39,13 @@ class Distro {
4239
DebianForky,
4340
DebianDuke,
4441
Exherbo,
45-
RHEL5,
46-
RHEL6,
4742
RHEL7,
43+
RHEL8,
44+
RHEL9,
45+
RHEL10,
4846
Fedora,
4947
Gentoo,
5048
OpenSUSE,
51-
UbuntuMaverick,
52-
UbuntuNatty,
53-
UbuntuOneiric,
54-
UbuntuPrecise,
5549
UbuntuQuantal,
5650
UbuntuRaring,
5751
UbuntuSaucy,
@@ -121,17 +115,17 @@ class Distro {
121115
/// @{
122116

123117
bool IsRedhat() const {
124-
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
118+
return DistroVal == Fedora || (DistroVal >= RHEL7 && DistroVal <= RHEL10);
125119
}
126120

127121
bool IsOpenSUSE() const { return DistroVal == OpenSUSE; }
128122

129123
bool IsDebian() const {
130-
return DistroVal >= DebianLenny && DistroVal <= DebianDuke;
124+
return DistroVal >= DebianJessie && DistroVal <= DebianDuke;
131125
}
132126

133127
bool IsUbuntu() const {
134-
return DistroVal >= UbuntuMaverick && DistroVal <= UbuntuResolute;
128+
return DistroVal >= UbuntuQuantal && DistroVal <= UbuntuResolute;
135129
}
136130

137131
bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }

clang/lib/Driver/Distro.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
6161
if (Version == Distro::UnknownDistro &&
6262
Line.starts_with("DISTRIB_CODENAME="))
6363
Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(17))
64-
.Case("maverick", Distro::UbuntuMaverick)
65-
.Case("natty", Distro::UbuntuNatty)
66-
.Case("oneiric", Distro::UbuntuOneiric)
67-
.Case("precise", Distro::UbuntuPrecise)
6864
.Case("quantal", Distro::UbuntuQuantal)
6965
.Case("raring", Distro::UbuntuRaring)
7066
.Case("saucy", Distro::UbuntuSaucy)
@@ -120,13 +116,17 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
120116
if (Data.starts_with("Fedora release"))
121117
return Distro::Fedora;
122118
if (Data.starts_with("Red Hat Enterprise Linux") ||
123-
Data.starts_with("CentOS") || Data.starts_with("Scientific Linux")) {
119+
Data.starts_with("CentOS") || Data.starts_with("AlmaLinux") ||
120+
Data.starts_with("Rocky Linux") ||
121+
Data.starts_with("Scientific Linux")) {
122+
if (Data.contains("release 10"))
123+
return Distro::RHEL10;
124+
if (Data.contains("release 9"))
125+
return Distro::RHEL9;
126+
if (Data.contains("release 8"))
127+
return Distro::RHEL8;
124128
if (Data.contains("release 7"))
125129
return Distro::RHEL7;
126-
else if (Data.contains("release 6"))
127-
return Distro::RHEL6;
128-
else if (Data.contains("release 5"))
129-
return Distro::RHEL5;
130130
}
131131
return Distro::UnknownDistro;
132132
}
@@ -139,12 +139,6 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
139139
int MajorVersion;
140140
if (!Data.split('.').first.getAsInteger(10, MajorVersion)) {
141141
switch (MajorVersion) {
142-
case 5:
143-
return Distro::DebianLenny;
144-
case 6:
145-
return Distro::DebianSqueeze;
146-
case 7:
147-
return Distro::DebianWheezy;
148142
case 8:
149143
return Distro::DebianJessie;
150144
case 9:
@@ -166,8 +160,6 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
166160
}
167161
}
168162
return llvm::StringSwitch<Distro::DistroType>(Data.split("\n").first)
169-
.Case("squeeze/sid", Distro::DebianSqueeze)
170-
.Case("wheezy/sid", Distro::DebianWheezy)
171163
.Case("jessie/sid", Distro::DebianJessie)
172164
.Case("stretch/sid", Distro::DebianStretch)
173165
.Case("buster/sid", Distro::DebianBuster)

0 commit comments

Comments
 (0)