Skip to content

Commit 2d20cb2

Browse files
committed
[clang] Updates for support for Ubunutu, 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 aa406aa commit 2d20cb2

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,
@@ -120,17 +114,17 @@ class Distro {
120114
/// @{
121115

122116
bool IsRedhat() const {
123-
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
117+
return DistroVal == Fedora || (DistroVal >= RHEL7 && DistroVal <= RHEL10);
124118
}
125119

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

128122
bool IsDebian() const {
129-
return DistroVal >= DebianLenny && DistroVal <= DebianDuke;
123+
return DistroVal >= DebianJessie && DistroVal <= DebianDuke;
130124
}
131125

132126
bool IsUbuntu() const {
133-
return DistroVal >= UbuntuMaverick && DistroVal <= UbuntuQuesting;
127+
return DistroVal >= UbuntuQuantal && DistroVal <= UbuntuQuesting;
134128
}
135129

136130
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)
@@ -119,13 +115,17 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
119115
if (Data.starts_with("Fedora release"))
120116
return Distro::Fedora;
121117
if (Data.starts_with("Red Hat Enterprise Linux") ||
122-
Data.starts_with("CentOS") || Data.starts_with("Scientific Linux")) {
118+
Data.starts_with("CentOS") || Data.starts_with("AlmaLinux") ||
119+
Data.starts_with("Rocky Linux") ||
120+
Data.starts_with("Scientific Linux")) {
121+
if (Data.contains("release 10"))
122+
return Distro::RHEL10;
123+
if (Data.contains("release 9"))
124+
return Distro::RHEL9;
125+
if (Data.contains("release 8"))
126+
return Distro::RHEL8;
123127
if (Data.contains("release 7"))
124128
return Distro::RHEL7;
125-
else if (Data.contains("release 6"))
126-
return Distro::RHEL6;
127-
else if (Data.contains("release 5"))
128-
return Distro::RHEL5;
129129
}
130130
return Distro::UnknownDistro;
131131
}
@@ -138,12 +138,6 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
138138
int MajorVersion;
139139
if (!Data.split('.').first.getAsInteger(10, MajorVersion)) {
140140
switch (MajorVersion) {
141-
case 5:
142-
return Distro::DebianLenny;
143-
case 6:
144-
return Distro::DebianSqueeze;
145-
case 7:
146-
return Distro::DebianWheezy;
147141
case 8:
148142
return Distro::DebianJessie;
149143
case 9:
@@ -165,8 +159,6 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
165159
}
166160
}
167161
return llvm::StringSwitch<Distro::DistroType>(Data.split("\n").first)
168-
.Case("squeeze/sid", Distro::DebianSqueeze)
169-
.Case("wheezy/sid", Distro::DebianWheezy)
170162
.Case("jessie/sid", Distro::DebianJessie)
171163
.Case("stretch/sid", Distro::DebianStretch)
172164
.Case("buster/sid", Distro::DebianBuster)

0 commit comments

Comments
 (0)