build: remove restrict to build from non-git-repo (#602)
diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh
index 39ca5e4..9770964 100755
--- a/scripts/bump_version.sh
+++ b/scripts/bump_version.sh
@@ -1,16 +1,17 @@
#!/bin/bash
+set -e
+
if [ $# -ne 1 ]; then
echo "USAGE: $0 <version>"
exit 1
fi
-pwd="$( cd "$( dirname "$0" )" && pwd )"
-shell_dir="$( cd $pwd/.. && pwd )"
-cd $shell_dir
+pwd="$(cd "$(dirname "$0")" && pwd)"
+shell_dir="$(cd "$pwd"/.. && pwd)"
+cd "$shell_dir" || exit 1
VERSION=$1
sed -i "s/^#define PEGASUS_VERSION .*/#define PEGASUS_VERSION \"$VERSION\"/" src/include/pegasus/version.h
echo "Files modified successfully, version bumped to $VERSION"
-
diff --git a/src/build.sh b/src/build.sh
index 9e441fa..3b8dd80 100755
--- a/src/build.sh
+++ b/src/build.sh
@@ -10,7 +10,6 @@
# RUN_VERBOSE YES|NO
# WARNING_ALL YES|NO
# ENABLE_GCOV YES|NO
-# BOOST_DIR <dir>|""
# TEST_MODULE "<module1> <module2> ..."
#
# CMake options:
@@ -19,7 +18,6 @@
# [-DCMAKE_BUILD_TYPE=Debug]
# [-DWARNING_ALL=TRUE]
# [-DENABLE_GCOV=TRUE]
-# [-DBoost_NO_BOOST_CMAKE=ON -DBOOST_ROOT=$BOOST_DIR -DBoost_NO_SYSTEM_PATHS=ON]
ROOT=`pwd`
BUILD_DIR="$ROOT/builder"
@@ -97,27 +95,7 @@
echo "DISABLE_GPERF=NO"
fi
-# You can specify customized boost by defining BOOST_DIR.
-# Install boost like this:
-# wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.zip?r=&ts=1442891144&use_mirror=jaist
-# unzip -q boost_1_54_0.zip
-# cd boost_1_54_0
-# ./bootstrap.sh --with-libraries=system,filesystem --with-toolset=gcc
-# ./b2 toolset=gcc cxxflags="-std=c++11 -fPIC" -j8 -d0
-# ./b2 install --prefix=$DSN_ROOT -d0
-# And set BOOST_DIR as:
-# export BOOST_DIR=/path/to/boost_1_54_0/output
-if [ -n "$BOOST_DIR" ]
-then
- echo "Use customized boost: $BOOST_DIR"
- CMAKE_OPTIONS="$CMAKE_OPTIONS -DBoost_NO_BOOST_CMAKE=ON -DBOOST_ROOT=$BOOST_DIR -DBoost_NO_SYSTEM_PATHS=ON"
- # for makefile
- export BOOST_ROOT=$BOOST_DIR
-else
- echo "Use system boost"
-fi
-
-echo "CMAKE_OPTIONS=$CMAKE_OPTIONS"
+CMAKE_OPTIONS="$CMAKE_OPTIONS -DBoost_NO_BOOST_CMAKE=ON -DBOOST_ROOT=${ROOT}/rdsn/thirdparty/output -DBoost_NO_SYSTEM_PATHS=ON"
echo "#############################################################################"
@@ -152,21 +130,16 @@
cd ..
fi
-cd $ROOT
-PEGASUS_GIT_COMMIT=`git log | head -n 1 | awk '{print $2}'`
-if [ $? -ne 0 ] || [ -z "$PEGASUS_GIT_COMMIT" ]
-then
- echo "ERROR: get PEGASUS_GIT_COMMIT failed"
- echo "HINT: check if pegasus is a git repo"
- exit 1
+cd "$ROOT" || exit 1
+PEGASUS_GIT_COMMIT="non-git-repo"
+if git rev-parse HEAD; then # this is a git repo
+ PEGASUS_GIT_COMMIT=$(git rev-parse HEAD)
fi
+echo "PEGASUS_GIT_COMMIT=${PEGASUS_GIT_COMMIT}"
GIT_COMMIT_FILE=include/pegasus/git_commit.h
-if [ ! -f $GIT_COMMIT_FILE ] || ! grep $PEGASUS_GIT_COMMIT $GIT_COMMIT_FILE
-then
- echo "Generating $GIT_COMMIT_FILE..."
- echo "#pragma once" >$GIT_COMMIT_FILE
- echo "#define PEGASUS_GIT_COMMIT \"$PEGASUS_GIT_COMMIT\"" >>$GIT_COMMIT_FILE
-fi
+echo "Generating $GIT_COMMIT_FILE..."
+echo "#pragma once" >$GIT_COMMIT_FILE
+echo "#define PEGASUS_GIT_COMMIT \"$PEGASUS_GIT_COMMIT\"" >>$GIT_COMMIT_FILE
cd $BUILD_DIR
echo "Building..."
diff --git a/src/server/main.cpp b/src/server/main.cpp
index f12cf1a..ab7b8e5 100644
--- a/src/server/main.cpp
+++ b/src/server/main.cpp
@@ -7,7 +7,6 @@
#include "info_collector_app.h"
#include "brief_stat.h"
-#include <dsn/git_commit.h>
#include <pegasus/version.h>
#include <pegasus/git_commit.h>
@@ -37,7 +36,6 @@
#if defined(DSN_BUILD_TYPE)
" " STR(DSN_BUILD_TYPE)
#endif
- ", built with rDSN (" DSN_GIT_COMMIT ")"
", built by gcc " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__)
#if defined(DSN_BUILD_HOSTNAME)
", built on " STR(DSN_BUILD_HOSTNAME)