[PATCH] D26850: [Driver] Fix recognizing newer OpenSUSE versions
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 18 05:58:59 PST 2016
mgorny created this revision.
mgorny added reviewers: bruno, ismail.
mgorny added a subscriber: llvm-commits.
Fix recognizing newer OpenSUSE versions that combine the two version
components into 'VERSION = x.y'. The check was written against an older
version that kept those two split as VERSION and PATCHLEVEL.
https://reviews.llvm.org/D26850
Files:
lib/Driver/Distro.cpp
Index: lib/Driver/Distro.cpp
===================================================================
--- lib/Driver/Distro.cpp
+++ lib/Driver/Distro.cpp
@@ -108,11 +108,14 @@
if (!Line.trim().startswith("VERSION"))
continue;
std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+ // Old versions have split VERSION and PATCHLEVEL
+ // Newer versions use VERSION = x.y
+ std::pair<StringRef, StringRef> SplitVer = SplitLine.second.trim().split('.');
int Version;
+
// OpenSUSE/SLES 10 and older are not supported and not compatible
// with our rules, so just treat them as Distro::UnknownDistro.
- if (!SplitLine.second.trim().getAsInteger(10, Version) &&
- Version > 10)
+ if (!SplitVer.first.getAsInteger(10, Version) && Version > 10)
return Distro::OpenSUSE;
return Distro::UnknownDistro;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26850.78505.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161118/47c91a68/attachment.bin>
More information about the llvm-commits
mailing list