From 423c000f98a3341eab39776ee5700cdf98475223 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Mon, 30 Jul 2018 14:14:12 -0400 Subject: [PATCH 1/3] MINFICIPP-582: Update readme to implement bustache and kafka constraints --- aptitude.sh | 2 +- bootstrap.sh | 76 ++++++++++++++++++++++++++++++++------------------- centos.sh | 4 +-- debian.sh | 2 +- fedora.sh | 4 ++- linux.sh | 40 +++++++++++++++++++++++++++ rheldistro.sh | 4 +-- suse.sh | 4 +-- 8 files changed, 99 insertions(+), 37 deletions(-) create mode 100644 linux.sh diff --git a/aptitude.sh b/aptitude.sh index 8c14456815..061ea00cb0 100644 --- a/aptitude.sh +++ b/aptitude.sh @@ -19,7 +19,7 @@ verify_enable(){ feature="$1" feature_status=${!1} - echo "true" + verify_gcc_enable $feature } add_os_flags() { CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DFAIL_ON_WARNINGS= " diff --git a/bootstrap.sh b/bootstrap.sh index 97e8b5fa05..0474838f84 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -56,7 +56,7 @@ while :; do FEATURES_SELECTED="true" EnableAllFeatures ;; - -c|--clear) + -c|--clear) rm ${script_directory}/bt_state > /dev/null 2>&1 ;; -d|--deploy) @@ -149,34 +149,52 @@ fi OS_MAJOR=`echo $VER | cut -d. -f1` OS_MINOR=`echo $VER | cut -d. -f2` OS_REVISION=`echo $EVR | cut -d. -f3` + +### Verify the compiler version + +COMPILER_VERSION="0.0.0" + +COMPILER_COMMAND="" + +if [ -x "$(command -v g++)" ]; then + COMPILER_COMMAND="g++" + COMPILER_VERSION=`${COMPILER_COMMAND} -dumpversion` +fi + +COMPILER_MAJOR=`echo $COMPILER_VERSION | cut -d. -f1` +COMPILER_MINOR=`echo $COMPILER_VERSION | cut -d. -f2` +COMPILER_REVISION=`echo $COMPILER_VERSION | cut -d. -f3` + + if [[ "$OS" = "Darwin" ]]; then . "${script_directory}/darwin.sh" -elif [[ "$OS" = Deb* ]]; then - . "${script_directory}/debian.sh" -elif [[ "$OS" = Rasp* ]]; then - . "${script_directory}/aptitude.sh" -elif [[ "$OS" = Pop* ]]; then - . "${script_directory}/aptitude.sh" -elif [[ "$OS" = Ubuntu* ]]; then - . "${script_directory}/aptitude.sh" -elif [[ "$OS" = *SUSE* ]]; then - . "${script_directory}/suse.sh" -elif [[ "$OS" = *SLE* ]]; then - if [[ "$VER" = 11* ]]; then - echo "Please install SLES11 manually...exiting" - exit - else +else + . "${script_directory}/linux.sh" + if [[ "$OS" = Deb* ]]; then + . "${script_directory}/debian.sh" + elif [[ "$OS" = Rasp* ]]; then + . "${script_directory}/aptitude.sh" + elif [[ "$OS" = Pop* ]]; then + . "${script_directory}/aptitude.sh" + elif [[ "$OS" = Ubuntu* ]]; then + . "${script_directory}/aptitude.sh" + elif [[ "$OS" = *SUSE* ]]; then . "${script_directory}/suse.sh" + elif [[ "$OS" = *SLE* ]]; then + if [[ "$VER" = 11* ]]; then + echo "Please install SLES11 manually...exiting" + exit + else + . "${script_directory}/suse.sh" + fi + elif [[ "$OS" = Red* ]]; then + . "${script_directory}/rheldistro.sh" + elif [[ "$OS" = CentOS* ]]; then + . "${script_directory}/centos.sh" + elif [[ "$OS" = Fedora* ]]; then + . "${script_directory}/fedora.sh" fi -elif [[ "$OS" = Red* ]]; then - . "${script_directory}/rheldistro.sh" -elif [[ "$OS" = CentOS* ]]; then - . "${script_directory}/centos.sh" -elif [[ "$OS" = Fedora* ]]; then - . "${script_directory}/fedora.sh" fi - - ### verify the cmake version CMAKE_COMMAND="" @@ -206,6 +224,8 @@ CMAKE_MAJOR=`echo $CMAKE_VERSION | cut -d. -f1` CMAKE_MINOR=`echo $CMAKE_VERSION | cut -d. -f2` CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3` + + add_cmake_option PORTABLE_BUILD ${TRUE} add_cmake_option DEBUG_SYMBOLS ${FALSE} add_cmake_option BUILD_ROCKSDB ${TRUE} @@ -259,9 +279,9 @@ fi BUILD_DIR_D=${BUILD_DIR} load_state if [ "$BUILD_DIR_D" != "build" ] && [ "$BUILD_DIR_D" != "$BUILD_DIR" ]; then - read -p "Build dir will override stored state, $BUILD_DIR. Press any key to continue " overwrite - BUILD_DIR=$BUILD_DIR_D - + read -p "Build dir will override stored state, $BUILD_DIR. Press any key to continue " overwrite + BUILD_DIR=$BUILD_DIR_D + fi if [ ! -d "${BUILD_DIR}" ]; then @@ -296,7 +316,7 @@ do read_advanced_menu_options else show_supported_features - read_feature_options + read_feature_options fi done ### ensure we have all dependencies diff --git a/centos.sh b/centos.sh index 14d1e6530b..f99d51a6b6 100644 --- a/centos.sh +++ b/centos.sh @@ -27,13 +27,13 @@ verify_enable() { elif [ "$feature" = "TENSORFLOW_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi else if [ "$feature" = "USB_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi fi } diff --git a/debian.sh b/debian.sh index 4a50dbb3c2..1758081fc2 100644 --- a/debian.sh +++ b/debian.sh @@ -19,7 +19,7 @@ verify_enable(){ feature="$1" feature_status=${!1} - echo "true" + verify_gcc_enable $feature } add_os_flags() { CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DFAIL_ON_WARNINGS= " diff --git a/fedora.sh b/fedora.sh index 252ed5b940..0bf7d4b1d4 100644 --- a/fedora.sh +++ b/fedora.sh @@ -17,7 +17,9 @@ # under the License. verify_enable(){ - echo "true" + feature="$1" + feature_status=${!1} + verify_gcc_enable $feature } add_os_flags() { : diff --git a/linux.sh b/linux.sh new file mode 100644 index 0000000000..106d21eb24 --- /dev/null +++ b/linux.sh @@ -0,0 +1,40 @@ +# 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. +#!/bin/bash +verify_gcc_enable(){ + feature="$1" + feature_status=${!1} + if [ "$feature" = "BUSTACHE_ENABLED" ]; then + if (( COMPILER_MAJOR >= 6 )); then + echo "true" + else + echo "false" + fi + elif [ "$feature" = "KAFKA_ENABLED" ]; then + if (( COMPILER_MAJOR >= 4 )); then + if (( COMPILER_MAJOR > 4 || COMPILER_MINOR >= 9 )); then + echo "true" + else + echo "false" + fi + else + echo "false" + fi + else + echo "true" + fi +} \ No newline at end of file diff --git a/rheldistro.sh b/rheldistro.sh index 52ef928b80..0cf67e5a90 100644 --- a/rheldistro.sh +++ b/rheldistro.sh @@ -25,13 +25,13 @@ verify_enable() { elif [ "$feature" = "USB_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi else if [ "$feature" = "USB_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi fi } diff --git a/suse.sh b/suse.sh index 955e047bda..7a40bd5583 100644 --- a/suse.sh +++ b/suse.sh @@ -25,13 +25,13 @@ verify_enable() { elif [ "$feature" = "USB_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi else if [ "$feature" = "USB_ENABLED" ]; then echo "false" else - echo "true" + verify_gcc_enable $feature fi fi } From 652aeff06338f77e1fda3c966e6aeaed97333f06 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Mon, 30 Jul 2018 14:57:53 -0400 Subject: [PATCH 2/3] MINIFICPP-582: Run bash beautify --- bstrp_functions.sh | 42 +++++++++++++++++++++--------------------- debian.sh | 6 +++--- deploy.sh | 4 ++-- generateVersion.sh | 2 +- rheldistro.sh | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bstrp_functions.sh b/bstrp_functions.sh index aa1daf355f..2d16b5e637 100755 --- a/bstrp_functions.sh +++ b/bstrp_functions.sh @@ -72,29 +72,29 @@ pause(){ load_state(){ -if [ -f ${script_directory}/bt_state ]; then - . ${script_directory}/bt_state - for option in "${OPTIONS[@]}" ; do + if [ -f ${script_directory}/bt_state ]; then + . ${script_directory}/bt_state + for option in "${OPTIONS[@]}" ; do option_value="${!option}" - if [ "${option_value}" = "${FALSE}" ]; then - ALL_FEATURES_ENABLED=${FALSE} - fi - done -fi + if [ "${option_value}" = "${FALSE}" ]; then + ALL_FEATURES_ENABLED=${FALSE} + fi + done + fi } echo_state_variable(){ -VARIABLE_VALUE=${!1} -echo "$1=\"${VARIABLE_VALUE}\"" >> ${script_directory}/bt_state + VARIABLE_VALUE=${!1} + echo "$1=\"${VARIABLE_VALUE}\"" >> ${script_directory}/bt_state } save_state(){ - echo "VERSION=1" > ${script_directory}/bt_state - echo_state_variable BUILD_IDENTIFIER - echo_state_variable BUILD_DIR - for option in "${OPTIONS[@]}" ; do - echo_state_variable $option - done + echo "VERSION=1" > ${script_directory}/bt_state + echo_state_variable BUILD_IDENTIFIER + echo_state_variable BUILD_DIR + for option in "${OPTIONS[@]}" ; do + echo_state_variable $option + done } can_deploy(){ @@ -189,7 +189,7 @@ show_main_menu() { echo "****************************************" echo " MiNiFi C++ Main Menu." echo "****************************************" - echo "A. Select MiNIFi C++ Features " + echo "A. Select MiNIFi C++ Features " if [ "$ALL_FEATURES_ENABLED" = "${TRUE}" ]; then echo " All features enabled ........$(print_feature_status ALL_FEATURES_ENABLED)" fi @@ -257,7 +257,7 @@ show_supported_features() { echo "M. Enable all extensions" echo "P. Continue with these options" if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then - echo "R. Return to Main Menu" + echo "R. Return to Main Menu" fi echo "Q. Quit" echo "* Extension cannot be installed due to" @@ -284,9 +284,9 @@ read_feature_options(){ m) EnableAllFeatures ;; p) FEATURES_SELECTED="true" ;; r) if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then - MENU="main" - fi - ;; + MENU="main" + fi + ;; q) exit 0;; *) echo -e "${RED}Please enter an option A-L...${NO_COLOR}" && sleep 2 esac diff --git a/debian.sh b/debian.sh index 1758081fc2..8a8ae2548b 100644 --- a/debian.sh +++ b/debian.sh @@ -28,12 +28,12 @@ bootstrap_cmake(){ sudo apt-get -y install cmake } build_deps(){ - sudo apt-get -y update + sudo apt-get -y update ## need to account for debian sudo apt-get install -y libssl1.0-dev > /dev/null RETVAL=$? - if [ "$RETVAL" -ne "0" ]; then - sudo apt-get install -y libssl-dev > /dev/null + if [ "$RETVAL" -ne "0" ]; then + sudo apt-get install -y libssl-dev > /dev/null fi COMMAND="sudo apt-get -y install cmake gcc g++ zlib1g-dev uuid uuid-dev" export DEBIAN_FRONTEND=noninteractive diff --git a/deploy.sh b/deploy.sh index 00a1c69407..c28c63c482 100755 --- a/deploy.sh +++ b/deploy.sh @@ -23,6 +23,6 @@ echo "${build_identifier}" > build_identifier ./bootstrap.sh -d -p --build_identifier=${build_identifier} -pushd build - ./controller/minificontroller --manifest >> build_output +pushd build +./controller/minificontroller --manifest >> build_output popd diff --git a/generateVersion.sh b/generateVersion.sh index a0796cbf76..238104ba70 100755 --- a/generateVersion.sh +++ b/generateVersion.sh @@ -34,7 +34,7 @@ fi IFS=';' read -r -a extensions_array <<< "$extensions" -extension_list="${extension_list} } " +extension_list="${extension_list} } " cat >"$out_dir/agent_version.h" < Date: Wed, 1 Aug 2018 12:45:32 -0400 Subject: [PATCH 3/3] MINIFICPP-582: Add LUA limitations --- linux.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linux.sh b/linux.sh index 106d21eb24..e279c840c7 100644 --- a/linux.sh +++ b/linux.sh @@ -18,7 +18,15 @@ verify_gcc_enable(){ feature="$1" feature_status=${!1} - if [ "$feature" = "BUSTACHE_ENABLED" ]; then + if [ "$feature" = "BUSTACHE_ENABLED" ]; then + if (( COMPILER_MAJOR == 6 && COMPILER_MINOR >= 3 && COMPILER_REVISION >= 1 )); then + echo "true" + elif (( COMPILER_MAJOR > 6 )); then + echo "true" + else + echo "false" + fi + elif [ "$feature" = "EXECUTE_SCRIPT_ENABLED" ]; then if (( COMPILER_MAJOR >= 6 )); then echo "true" else @@ -37,4 +45,4 @@ verify_gcc_enable(){ else echo "true" fi -} \ No newline at end of file +}