This repository was archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
/
Copy pathpackages.sh
executable file
·176 lines (154 loc) · 3.76 KB
/
packages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/bash
## =================================================================
## NOISEPAGE PACKAGE INSTALLATION
##
## This script will install all the packages that are needed to
## build and run the DBMS.
##
## Supported environments:
## * Ubuntu 20.04
##
## Note that macOS support has been dropped.
## =================================================================
LINUX_BUILD_PACKAGES=(\
"build-essential" \
"clang-8" \
"clang-format-8" \
"clang-tidy-8" \
"cmake" \
"doxygen" \
"git" \
"libevent-dev" \
"libjemalloc-dev" \
"libpq-dev" \
"libpqxx-dev" \
"libtbb-dev" \
"libzmq3-dev" \
"lld" \
"llvm-8" \
"pkg-config" \
"postgresql-client" \
"python3-pip" \
"ninja-build"
"wget" \
"zlib1g-dev" \
"time" \
)
LINUX_TEST_PACKAGES=(\
"ant" \
"ccache" \
"curl" \
"lcov" \
"lsof" \
)
# Packages to be installed through pip3.
PYTHON_BUILD_PACKAGES=(
)
PYTHON_TEST_PACKAGES=(\
"distro" \
"lightgbm" \
"numpy" \
"pandas" \
"prettytable" \
"psutil" \
"psycopg2" \
"pyarrow" \
"pyzmq" \
"requests" \
"sklearn" \
"torch" \
"tqdm" \
"coverage" \
)
## =================================================================
main() {
set -o errexit
INSTALL_TYPE="$1"
if [ -z "$INSTALL_TYPE" ]; then
INSTALL_TYPE="build"
fi
ALLOWED=("build" "test" "all")
FOUND=0
for key in "${ALLOWED[@]}"; do
if [ "$key" == "$INSTALL_TYPE" ] ; then
FOUND=1
fi
done
if [ "$FOUND" = "0" ]; then
echo "Invalid installation type '$INSTALL_TYPE'"
echo -n "Allowed Values: "
( IFS=$' '; echo "${ALLOWED[*]}" )
exit 1
fi
echo "PACKAGES WILL BE INSTALLED. THIS MAY BREAK YOUR EXISTING TOOLCHAIN."
echo "YOU ACCEPT ALL RESPONSIBILITY BY PROCEEDING."
echo
echo "INSTALLATION TYPE: $INSTALL_TYPE"
read -p "Proceed? [Y/n] : " yn
case $yn in
Y|y) install;;
*) ;;
esac
echo "Script complete."
}
give_up() {
set +x
OS=$1
VERSION=$2
[ ! -z "$VERSION" ] && VERSION=" $VERSION"
echo
echo "Unsupported distribution '${OS}${VERSION}'"
echo "Please contact our support team for additional help."
echo "Be sure to include the contents of this message."
echo "Platform: $(uname -a)"
echo
echo "https://github.com/cmu-db/noisepage/issues"
echo
exit 1
}
install() {
set -x
UNAME=$(uname | tr "[:lower:]" "[:upper:]" )
VERSION=""
case $UNAME in
LINUX)
DISTRO=$(cat /etc/os-release | grep '^ID=' | cut -d '=' -f 2 | tr "[:lower:]" "[:upper:]" | tr -d '"')
VERSION=$(cat /etc/os-release | grep '^VERSION_ID=' | cut -d '"' -f 2)
# We only support Ubuntu right now
[ "$DISTRO" != "UBUNTU" ] && give_up $DISTRO $VERSION
# Check Ubuntu version
case $VERSION in
20.04) install_linux ;;
*) give_up $DISTRO $VERSION;;
esac
;;
*) give_up $UNAME $VERSION;;
esac
}
install_pip() {
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
rm get-pip.py
}
install_linux() {
# Update apt-get.
apt-get -y update
# Install packages. Note that word splitting is desired behavior.
if [ "$INSTALL_TYPE" == "build" ] || [ "$INSTALL_TYPE" = "all" ]; then
apt-get -y install $( IFS=$' '; echo "${LINUX_BUILD_PACKAGES[*]}" )
fi
if [ "$INSTALL_TYPE" == "test" ] || [ "$INSTALL_TYPE" = "all" ]; then
apt-get -y install $( IFS=$' '; echo "${LINUX_TEST_PACKAGES[*]}" )
fi
if [ "$INSTALL_TYPE" == "build" ] || [ "$INSTALL_TYPE" = "all" ]; then
for pkg in "${PYTHON_BUILD_PACKAGES[@]}"; do
python3 -m pip show $pkg || python3 -m pip install $pkg
done
fi
if [ "$INSTALL_TYPE" == "test" ] || [ "$INSTALL_TYPE" = "all" ]; then
for pkg in "${PYTHON_TEST_PACKAGES[@]}"; do
python3 -m pip show $pkg || python3 -m pip install $pkg
done
fi
}
main "$@"