9e42ebbb67
Summary: Added wrappers for some Unix system calls in utils/filesystem.hpp and implemented a simple log storage interface for Raft. It is not very efficient, we will need something more sophisticated later, but this is good enough for testing. Reviewers: mferencevic, mislav.bradac, buda, mculinovic Reviewed By: mferencevic Subscribers: teon.banek, dgleich, pullbot Differential Revision: https://phabricator.memgraph.io/D1091
123 lines
3.1 KiB
Bash
Executable File
123 lines
3.1 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
# TODO: Consider putting boost library in libs/setup.sh, since the license
|
|
# allows source modification and static compilation. Unfortunately, it is quite
|
|
# a pain to set up the boost build process.
|
|
required_pkgs=(git arcanist # source code control
|
|
cmake clang-3.8 llvm-3.8 pkg-config # build system
|
|
curl wget # for downloading libs
|
|
uuid-dev default-jre-headless # required by antlr
|
|
libreadline-dev # for memgraph console
|
|
libboost-iostreams-dev
|
|
libboost-serialization-dev
|
|
python3 python-virtualenv python3-pip # for qa, macro_benchmark and stress tests
|
|
)
|
|
|
|
optional_pkgs=(clang-format # source code formatting
|
|
doxygen graphviz # source documentation generators
|
|
php-cli # for user technical documentation generators
|
|
)
|
|
|
|
use_sudo=0
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
cd "$DIR"
|
|
|
|
function print_help () {
|
|
echo "Usage: $0 [OPTION]"
|
|
echo -e "Check for missing packages and install them if possible.\n"
|
|
echo "Optional arguments:"
|
|
echo -e " -s\tuse sudo apt-get for installing packages"
|
|
echo -e " -h\tdisplay this help and exit"
|
|
}
|
|
|
|
function setup_virtualenv () {
|
|
pushd $1 > /dev/null
|
|
echo "Setting up virtualenv for: $1"
|
|
|
|
# remove old virtualenv
|
|
if [ -d ve3 ]; then
|
|
rm -rf ve3
|
|
fi
|
|
|
|
# create new virtualenv
|
|
virtualenv -p python3 ve3 || exit 1
|
|
source ve3/bin/activate
|
|
pip install -i http://deps.memgraph.io:3141/root/pypi \
|
|
--trusted-host deps.memgraph.io -r requirements.txt || exit 1
|
|
deactivate
|
|
|
|
popd > /dev/null
|
|
}
|
|
|
|
if [[ $# -gt 1 ]]; then
|
|
print_help
|
|
exit 1
|
|
elif [[ $# -eq 1 ]]; then
|
|
case "$1" in
|
|
-s)
|
|
use_sudo=1
|
|
;;
|
|
-h)
|
|
print_help
|
|
exit 0
|
|
;;
|
|
*)
|
|
# unknown option
|
|
print_help
|
|
exit 1
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
echo "Started installing dependencies for Memgraph"
|
|
|
|
required_missing=0
|
|
|
|
# install all dependencies on debian based operating systems
|
|
for pkg in ${required_pkgs[@]}; do
|
|
if dpkg -s $pkg 2>/dev/null >/dev/null; then
|
|
echo "Found $pkg"
|
|
elif (( $use_sudo )); then
|
|
echo "Installing $pkg"
|
|
if [[ ! `sudo apt-get -y install $pkg` ]]; then
|
|
echo "Didn't install $pkg [required]"
|
|
required_missing=1
|
|
fi
|
|
else
|
|
echo "Missing $pkg [required]"
|
|
required_missing=1
|
|
fi
|
|
done
|
|
|
|
for pkg in ${optional_pkgs[@]}; do
|
|
if dpkg -s $pkg 2>/dev/null >/dev/null; then
|
|
echo "Found $pkg [optional]"
|
|
else
|
|
echo "Missing $pkg [optional]"
|
|
fi
|
|
done
|
|
|
|
if (( $required_missing )); then
|
|
echo "Missing required packages. EXITING!"
|
|
echo "Please, install required packages and rerun $0 again."
|
|
exit 2
|
|
fi
|
|
|
|
# create a default build directory
|
|
mkdir -p ./build
|
|
|
|
# setup libs (download)
|
|
cd libs
|
|
./cleanup.sh
|
|
./setup.sh
|
|
cd ..
|
|
|
|
# setup qa dependencies
|
|
setup_virtualenv tests/qa
|
|
|
|
# setup stress dependencies
|
|
setup_virtualenv tests/stress
|
|
|
|
echo "Done installing dependencies for Memgraph"
|