You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2017/06/27 03:19:30 UTC
kudu git commit: Add mustache as a dependency
Repository: kudu
Updated Branches:
refs/heads/master baa8d1716 -> ab07952fb
Add mustache as a dependency
Mustache is a popular template engine. The version
added by this commit is a C++ implementation found
at https://github.com/henryr/cpp-mustache. Mustache
is intended to be use for rendering HTML pages in
the kudu webserver.
Change-Id: I058c19ef32e80f122bfa125de42c39d52286e796
Reviewed-on: http://gerrit.cloudera.org:8080/7298
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/ab07952f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/ab07952f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/ab07952f
Branch: refs/heads/master
Commit: ab07952fb511527053f9336a416a361b8b51dbd3
Parents: baa8d17
Author: Sam Okrent <sa...@cloudera.com>
Authored: Thu Jun 22 18:24:21 2017 -0700
Committer: Dan Burkert <da...@apache.org>
Committed: Tue Jun 27 03:19:05 2017 +0000
----------------------------------------------------------------------
CMakeLists.txt | 6 +++++
cmake_modules/FindMustache.cmake | 34 +++++++++++++++++++++++++++
src/kudu/server/default-path-handlers.cc | 2 ++
thirdparty/LICENSE.txt | 4 ++++
thirdparty/build-definitions.sh | 12 ++++++++++
thirdparty/build-thirdparty.sh | 9 +++++++
thirdparty/download-thirdparty.sh | 4 ++++
thirdparty/vars.sh | 11 +++++++++
8 files changed, 82 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c103802..ad0c47b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -851,6 +851,12 @@ include_directories(SYSTEM ${SQUEASEL_INCLUDE_DIR})
ADD_THIRDPARTY_LIB(squeasel
STATIC_LIB "${SQUEASEL_STATIC_LIB}")
+## Mustache
+find_package(Mustache REQUIRED)
+include_directories(SYSTEM ${MUSTACHE_INCLUDE_DIR})
+ADD_THIRDPARTY_LIB(mustache
+ STATIC_LIB "${MUSTACHE_STATIC_LIB}")
+
## OpenSSL
##
## Version 1.0.0 or higher is required because we are using the following
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/cmake_modules/FindMustache.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindMustache.cmake b/cmake_modules/FindMustache.cmake
new file mode 100644
index 0000000..e1e38f7
--- /dev/null
+++ b/cmake_modules/FindMustache.cmake
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# - Find Mustache (mustache.h, libmustache.a)
+# This module defines
+# MUSTACHE_INCLUDE_DIR, directory containing headers
+# MUSTACHE_STATIC_LIB, path to libmustache.a
+# MUSTACHE_FOUND, whether mustache has been found
+
+find_path(MUSTACHE_INCLUDE_DIR mustache.h
+ # make sure we don't accidentally pick up a different version
+ NO_CMAKE_SYSTEM_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH)
+
+find_library(MUSTACHE_STATIC_LIB libmustache.a
+ NO_CMAKE_SYSTEM_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MUSTACHE REQUIRED_VARS
+ MUSTACHE_STATIC_LIB MUSTACHE_INCLUDE_DIR)
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/src/kudu/server/default-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/default-path-handlers.cc b/src/kudu/server/default-path-handlers.cc
index 7f32e26..7d85f91 100644
--- a/src/kudu/server/default-path-handlers.cc
+++ b/src/kudu/server/default-path-handlers.cc
@@ -28,6 +28,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
#include <gperftools/malloc_extension.h>
+#include <mustache.h>
#include "kudu/gutil/map-util.h"
#include "kudu/gutil/strings/human_readable.h"
@@ -44,6 +45,7 @@
#include "kudu/util/metrics.h"
#include "kudu/util/process_memory.h"
+using mustache::RenderTemplate;
using std::ifstream;
using std::string;
using std::endl;
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/thirdparty/LICENSE.txt
----------------------------------------------------------------------
diff --git a/thirdparty/LICENSE.txt b/thirdparty/LICENSE.txt
index 558daee..623fd46 100644
--- a/thirdparty/LICENSE.txt
+++ b/thirdparty/LICENSE.txt
@@ -240,6 +240,10 @@ changed to a GPL license. squeasel was forked from a revision of mongoose
obtained prior to the license change.
--------------------------------------------------------------------------------
+thirdparty/mustache-*/: Apache 2.0 license
+Source: https://github.com/henryr/cpp-mustache
+
+--------------------------------------------------------------------------------
thirdparty/protobuf-*/: BSD 3-clause
Source: https://github.com/google/protobuf
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/thirdparty/build-definitions.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 20dea1d..3b76691 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -496,6 +496,18 @@ build_squeasel() {
popd
}
+build_mustache() {
+ MUSTACHE_BDIR=$TP_BUILD_DIR/$MUSTACHE_NAME$MODE_SUFFIX
+ mkdir -p $MUSTACHE_BDIR
+ pushd $MUSTACHE_BDIR
+ # We add $PREFIX/include for boost and $PREFIX_COMMON/include for rapidjson.
+ ${CXX:-g++} $EXTRA_CXXFLAGS -I$PREFIX/include -I$PREFIX_COMMON/include -O3 -DNDEBUG -fPIC -c "$MUSTACHE_SOURCE/mustache.cc"
+ ar rs libmustache.a mustache.o
+ cp libmustache.a $PREFIX/lib/
+ cp $MUSTACHE_SOURCE/mustache.h $PREFIX/include/
+ popd
+}
+
build_curl() {
# Configure for a very minimal install - basically only HTTP(S), since we only
# use this for testing our own HTTP/HTTPS endpoints at this point in time.
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/thirdparty/build-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index a94b496..668aae6 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -82,6 +82,7 @@ else
"snappy") F_SNAPPY=1 ;;
"zlib") F_ZLIB=1 ;;
"squeasel") F_SQUEASEL=1 ;;
+ "mustache") F_MUSTACHE=1 ;;
"gsg") F_GSG=1 ;;
"gcovr") F_GCOVR=1 ;;
"curl") F_CURL=1 ;;
@@ -315,6 +316,10 @@ if [ -n "$F_UNINSTRUMENTED" -o -n "$F_BOOST" ]; then
build_boost normal
fi
+if [ -n "$F_UNINSTRUMENTED" -o -n "$F_MUSTACHE" ]; then
+ build_mustache
+fi
+
if [ -n "$F_UNINSTRUMENTED" -o -n "$F_BREAKPAD" ]; then
build_breakpad
fi
@@ -482,6 +487,10 @@ if [ -n "$F_TSAN" -o -n "$F_BOOST" ]; then
build_boost tsan
fi
+if [ -n "$F_TSAN" -o -n "$F_MUSTACHE" ]; then
+ build_mustache
+fi
+
if [ -n "$F_TSAN" -o -n "$F_BREAKPAD" ]; then
build_breakpad
fi
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/thirdparty/download-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index 7cd5b25..6249ea2 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -211,6 +211,10 @@ if [ ! -d $SQUEASEL_SOURCE ]; then
fetch_and_expand squeasel-${SQUEASEL_VERSION}.tar.gz
fi
+if [ ! -d $MUSTACHE_SOURCE ]; then
+ fetch_and_expand mustache-${MUSTACHE_VERSION}.tar.gz
+fi
+
if [ ! -d $GSG_SOURCE ]; then
fetch_and_expand google-styleguide-${GSG_VERSION}.tar.gz
fi
http://git-wip-us.apache.org/repos/asf/kudu/blob/ab07952f/thirdparty/vars.sh
----------------------------------------------------------------------
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index 3e90a00..3bc5f9a 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -95,6 +95,17 @@ SQUEASEL_VERSION=c304d3f3481b07bf153979155f02e0aab24d01de
SQUEASEL_NAME=squeasel-$SQUEASEL_VERSION
SQUEASEL_SOURCE=$TP_SOURCE_DIR/$SQUEASEL_NAME
+# Hash of the mustache git revision to use.
+# (from https://github.com/henryr/cpp-mustache)
+#
+# To re-build this tarball use the following in the mustache repo:
+# export NAME=mustache-$(git rev-parse HEAD)
+# git archive HEAD --prefix=$NAME/ -o /tmp/$NAME.tar.gz
+# s3cmd put -P /tmp/$NAME.tar.gz s3://cloudera-thirdparty-libs/$NAME.tar.gz
+MUSTACHE_VERSION=87a592e8aa04497764c533acd6e887618ca7b8a8
+MUSTACHE_NAME=mustache-$MUSTACHE_VERSION
+MUSTACHE_SOURCE=$TP_SOURCE_DIR/$MUSTACHE_NAME
+
# git revision of google style guide:
# https://github.com/google/styleguide
# git archive --prefix=google-styleguide-$(git rev-parse HEAD)/ -o /tmp/google-styleguide-$(git rev-parse HEAD).tgz HEAD