You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/12/15 23:30:38 UTC

[4/4] mesos git commit: Fixed builds with HAS_AUTHENTICATION=false.

Fixed builds with HAS_AUTHENTICATION=false.

The HAS_AUTHENTICATION configuration flag exists for systems or
platforms that do not support certain authentication libraries.
However, this option is not widely exercised (either by developers
or in existing CIs), and has broken over time.  Windows, for example,
will temporarily not have agent-to-master authentication support.

This commit will add the `HAS_AUTHENTICATION` option to the CMake build
and simultaneously `#ifdef` out some test code which depends on
authentication support.

On Windows, the option for `HAS_AUTHENTICATION` will be set to FALSE
by default.

Review: https://reviews.apache.org/r/54493/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c703e0fa
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c703e0fa
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c703e0fa

Branch: refs/heads/master
Commit: c703e0fadcd6c1e01d109b71def9058e250592af
Parents: 961e801
Author: Alex Clemmer <cl...@gmail.com>
Authored: Thu Dec 15 10:55:21 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 31 +++++++++++++++++++++----------
 src/Makefile.am                  |  8 --------
 src/tests/mesos.cpp              |  4 ++++
 support/windows-build.bat        |  2 +-
 4 files changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 6bd07e0..d857587 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -49,6 +49,19 @@ option(
   "Use libevent instead of libev as the core event loop implementation"
   FALSE)
 
+option(
+  HAS_AUTHENTICATION
+  "Build Mesos against authentication libraries"
+  TRUE)
+
+if (WIN32 AND HAS_AUTHENTICATION)
+  message(
+    FATAL_ERROR
+    "Windows builds of Mesos currently do not support agent to master "
+    "authentication. To build without this capability, pass "
+    "`-HAS_AUTHENTICATION=0` as an argument when you run CMake.")
+endif (WIN32 AND HAS_AUTHENTICATION)
+
 # If 'REBUNDLED' is set to FALSE, this will cause Mesos to build against
 # the specified dependency repository.  This is especially useful for
 # Windows builds, because building on MSVC 1900 requires newer versions
@@ -148,16 +161,6 @@ if (NOT WIN32)
   set(LIBEXEC_INSTALL_DIR     ${EXEC_INSTALL_PREFIX}/libexec)
   set(PKG_LIBEXEC_INSTALL_DIR ${LIBEXEC_INSTALL_DIR}/mesos)
   set(LIB_INSTALL_DIR         ${EXEC_INSTALL_PREFIX}/libmesos)
-
-  # TODO(hausdorff): Remove our hard dependency on SASL, as some platforms
-  # (namely Windows) will not support it in the forseeable future. As a
-  # stop-gap, we conditionally compile the code in libmesos that depends on
-  # SASL, by always setting `HAS_AUTHENTICATION` on non-Windows platforms, and
-  # never setting it on Windows platforms. This means that non-Windows builds
-  # of libmesos will still take a hard dependency on SASL, while Windows builds
-  # won't. Currently, the dependency is still assumed throughout the tests,
-  # though the plan is to remove this hard dependency as well. See MESOS-5450.
-  add_definitions(-DHAS_AUTHENTICATION=1)
 endif (NOT WIN32)
 
 
@@ -224,6 +227,14 @@ endif (WIN32)
 
 # GLOBAL CONFIGURATION.
 #######################
+if (HAS_AUTHENTICATION)
+  # NOTE: This conditional is required. It is not sufficient to set
+  # `-DHAS_AUTHENTICATION=${HAS_AUTHENTICATION}`, as this will define the
+  # symbol, and our intention is to only define it if the CMake variable
+  # `HAS_AUTHENTICATION` is set.
+  add_definitions(-DHAS_AUTHENTICATION=1)
+endif (HAS_AUTHENTICATION)
+
 # Enable the INT64 support for PicoJSON.
 add_definitions(-DPICOJSON_USE_INT64)
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a4c03c2..b9db779 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -192,14 +192,6 @@ LIB_ZOOKEEPER = -lzookeeper_mt
 LDADD += -lzookeeper_mt
 endif
 
-# TODO(hausdorff): Remove our hard dependency on SASL, as some platforms
-# (namely Windows) will not support it in the forseeable future. As a
-# stop-gap, we conditionally compile the code in libmesos that depends on
-# SASL, by always setting `HAS_AUTHENTICATION` on non-Windows platforms, and
-# never setting it on Windows platforms. This means that non-Windows builds
-# of libmesos will still take a hard dependency on SASL, while Windows builds
-# won't. Currently, the dependency is still assumed throughout the tests,
-# though the plan is to remove this hard dependency as well. See MESOS-5450.
 MESOS_CPPFLAGS += -DHAS_AUTHENTICATION=1
 
 # README: we build the Mesos library out of a collection of

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 629872f..adbb697 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -107,8 +107,10 @@ master::Flags MesosTest::CreateMasterFlags()
 
   flags.authenticate_http_readonly = true;
   flags.authenticate_http_readwrite = true;
+#ifdef HAS_AUTHENTICATION
   flags.authenticate_frameworks = true;
   flags.authenticate_agents = true;
+#endif // HAS_AUTHENTICATION
 
   flags.authenticate_http_frameworks = true;
   flags.http_framework_authenticators = "basic";
@@ -176,6 +178,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
   flags.launcher_dir = getLauncherDir();
 
   {
+#ifdef HAS_AUTHENTICATION
     // Create a default credential file for master/agent authentication.
     const string& path = path::join(directory.get(), "credential");
 
@@ -199,6 +202,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
 
     // Set default (permissive) ACLs.
     flags.acls = ACLs();
+#endif // HAS_AUTHENTICATION
   }
 
   flags.authenticate_http_readonly = true;

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/support/windows-build.bat
----------------------------------------------------------------------
diff --git a/support/windows-build.bat b/support/windows-build.bat
index b3b6d0b..14a89c7 100644
--- a/support/windows-build.bat
+++ b/support/windows-build.bat
@@ -49,7 +49,7 @@ REM Generate the Visual Studio solution.
 REM You can pass in other flags by setting `OTHER_CMAKE_OPTIONS` before
 REM calling the script. For example, the ASF CI will add `-DPATCHEXE_PATH=...`
 REM because the path to GNU Patch is not the default.
-cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 %OTHER_CMAKE_OPTIONS%
+cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 -DHAS_AUTHENTICATION=0 %OTHER_CMAKE_OPTIONS%
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM NOTE: We pass in the build option `/p:PreferredToolArchitecture=x64`