You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/09/19 00:12:48 UTC
[1/2] git commit: Replace os::Release with Version.
Repository: mesos
Updated Branches:
refs/heads/master 44f599afd -> 81840c50a
Replace os::Release with Version.
Review: https://reviews.apache.org/r/25755
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/411625c8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/411625c8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/411625c8
Branch: refs/heads/master
Commit: 411625c881e52314249d93ee008f2e5c4ac14cd1
Parents: 44f599a
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Thu Sep 18 14:36:48 2014 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Thu Sep 18 14:42:58 2014 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/os.hpp | 49 ++++----------------
.../3rdparty/stout/include/stout/version.hpp | 2 +
.../3rdparty/stout/tests/os_tests.cpp | 2 +-
3 files changed, 12 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/411625c8/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
index 02a1e58..23628a4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -65,6 +65,7 @@
#include <stout/strings.hpp>
#include <stout/try.hpp>
#include <stout/unreachable.hpp>
+#include <stout/version.hpp>
#include <stout/os/exists.hpp>
#include <stout/os/fork.hpp>
@@ -1180,59 +1181,27 @@ inline Try<std::string> sysname()
}
-// The OS release level.
-// TODO(karya): Replace struct Release with Version from version.hpp.
-struct Release
-{
- bool operator == (const Release& other)
- {
- return version == other.version &&
- major == other.major &&
- minor == other.minor;
- }
-
- bool operator < (const Release& other)
- {
- // Lexicographic ordering.
- if (version != other.version) {
- return version < other.version;
- } else if (major != other.major) {
- return major < other.major;
- } else {
- return minor < other.minor;
- }
- }
-
- bool operator <= (const Release& other)
- {
- return *this < other || *this == other;
- }
-
- int version;
- int major;
- int minor;
-};
-
-
// Return the OS release numbers.
-inline Try<Release> release()
+inline Try<Version> release()
{
Try<UTSInfo> info = uname();
if (info.isError()) {
return Error(info.error());
}
- Release r;
+ // TODO(karya): Replace sscanf with Version::parse() once Version
+ // starts supporting labels and build metadata.
+ int major, minor, patch;
if (::sscanf(
info.get().release.c_str(),
"%d.%d.%d",
- &r.version,
- &r.major,
- &r.minor) != 3) {
+ &major,
+ &minor,
+ &patch) != 3) {
return Error("Failed to parse: " + info.get().release);
}
- return r;
+ return Version(major, minor, patch);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/411625c8/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
index 2a2fead..21f3169 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/version.hpp
@@ -25,6 +25,8 @@
// This class provides convenience routines for version checks.
// TODO(karya): Consider adding support for more than 3 components,
// and compatibility operators.
+// TODO(karya): Add support for labels and build metadata. Consider
+// semantic versioning (http://semvar.org/) for specs.
class Version
{
public:
http://git-wip-us.apache.org/repos/asf/mesos/blob/411625c8/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
index 84ef49c..9207c55 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
@@ -265,7 +265,7 @@ TEST_F(OsTest, sysname)
TEST_F(OsTest, release)
{
- const Try<os::Release>& info = os::release();
+ const Try<Version>& info = os::release();
ASSERT_SOME(info);
}
[2/2] git commit: Updated callers to os::release in mesos.
Posted by bm...@apache.org.
Updated callers to os::release in mesos.
Review: https://reviews.apache.org/r/25780
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/81840c50
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/81840c50
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/81840c50
Branch: refs/heads/master
Commit: 81840c50a944abf663f46f80df4ae370a7c526fa
Parents: 411625c
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Thu Sep 18 14:36:58 2014 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Thu Sep 18 14:42:59 2014 -0700
----------------------------------------------------------------------
src/linux/perf.cpp | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/81840c50/src/linux/perf.cpp
----------------------------------------------------------------------
diff --git a/src/linux/perf.cpp b/src/linux/perf.cpp
index 1a851a1..863aa4a 100644
--- a/src/linux/perf.cpp
+++ b/src/linux/perf.cpp
@@ -330,17 +330,12 @@ bool supported()
{
// Require Linux kernel version >= 2.6.38 for "-x" and >= 2.6.39 for
// "--cgroup"
- Try<os::Release> release = os::release();
+ Try<Version> release = os::release();
// This is not expected to ever be an Error.
CHECK_SOME(release);
- os::Release required;
- required.version = 2;
- required.major = 6;
- required.minor = 39;
-
- return required <= release.get();
+ return release.get() >= Version(2, 6, 39);
}