Skip to content

Commit acb97eb

Browse files
committed
Updated Install_RedisGears.sh
1 parent a197b9f commit acb97eb

File tree

3 files changed

+87
-31
lines changed

3 files changed

+87
-31
lines changed

tests/flow/Install_RedisGears.sh

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,94 @@
1-
if [ -z ${OS+x} ]
2-
then
3-
echo "os is not set"
4-
exit 1
5-
fi
1+
#!/bin/bash
2+
3+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4+
ROOT=$(cd $HERE/../..; pwd)
5+
READIES=$ROOT/opt/readies
6+
. $READIES/shibumi/defs
67

7-
echo "installing redisgears for :" $OS
8+
if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
9+
cat <<-END
10+
Obtain RedisGears module binaries
811
9-
WORK_DIR=./bin/RedisGears/
10-
REDISGEARS_ZIP=redisgears.linux-$OS-x64.master.zip
11-
REDISGEARS_DEPS=redisgears-python.linux-$OS-x64.master.tgz
12-
REDISGEARS_S3_PATH=http://redismodules.s3.amazonaws.com/redisgears/snapshots/$REDISGEARS_ZIP
13-
REDISGEARS_DEPS_S3_PATH=http://redismodules.s3.amazonaws.com/redisgears/snapshots/$REDISGEARS_DEPS
12+
Install_RedisGears.sh [--help|help]
13+
14+
Argument variables:
15+
GEARS_OSNICK=nick Get binaries for give osnick
16+
GEARS_PATH=dir Get binaries from given Gears repo
17+
NOP=1 No operation
18+
HELP=1 Show help
19+
20+
END
21+
exit 0
22+
fi
1423

15-
mkdir -p $WORK_DIR
24+
OP=""
25+
[[ $NOP == 1 ]] && OP=echo
1626

17-
if [ -f "$WORK_DIR$REDISGEARS_ZIP" ]; then
18-
echo "Skiping RedisGears download"
27+
os=$($READIES/bin/platform --os)
28+
arch=$($READIES/bin/platform --arch)
29+
30+
if [[ ! -z $GEARS_PATH ]]; then
31+
platform=$($READIES/bin/platform -t)
1932
else
20-
echo "Download RedisGears"
21-
wget -P $WORK_DIR $REDISGEARS_S3_PATH
22-
unzip $WORK_DIR$REDISGEARS_ZIP -d $WORK_DIR
33+
if [[ $os != linux || $arch != x64 ]]; then
34+
eprint "Cannot match binary artifacts - build RedisGears and set GEARS_PATH"
35+
exit 1
36+
fi
37+
38+
dist=$($READIES/bin/platform --dist)
39+
nick=$($READIES/bin/platform --osnick)
40+
41+
if [[ $dist == ubuntu ]]; then
42+
if [[ $nick != bionic && $nick != xenial && $nick != trusty ]]; then
43+
nick=bionic
44+
fi
45+
elif [[ $dist == debian ]]; then
46+
nick=bionic
47+
elif [[ $dist == centos || $dist == redhat || $dist == fedora ]]; then
48+
nick=centos7
49+
elif [[ ! -z $GEARS_OSNICK ]]; then
50+
nick="$GEARS_OSNICK"
51+
else
52+
eprint "Cannot match binary artifacts - build RedisGears and set GEARS_PATH"
53+
exit 1
54+
fi
55+
platform="${os}-${nick}-${arch}"
2356
fi
2457

25-
if [ -f "$WORK_DIR$REDISGEARS_DEPS" ]; then
26-
echo "Skiping RedisGears download"
58+
GEARS_S3_URL=http://redismodules.s3.amazonaws.com/redisgears/snapshots
59+
GEARS_MOD=redisgears.$platform.master.zip
60+
GEARS_DEPS=redisgears-python.$platform.master.tgz
61+
62+
FINAL_WORK_DIR=$ROOT/bin/$($READIES/bin/platform -t)/RedisGears
63+
64+
if [[ -d $FINAL_WORK_DIR && -f $FINAL_WORK_DIR/redisgears.so ]]; then
65+
echo "RedisGears is in $FINAL_WORK_DIR"
66+
exit 0
67+
fi
68+
69+
$OP rm -rf ${FINAL_WORK_DIR}.*
70+
WORK_DIR=$(mktemp -d ${FINAL_WORK_DIR}.XXXXXX)
71+
$OP mkdir -p $WORK_DIR
72+
73+
if [[ -z $GEARS_PATH ]]; then
74+
F_GEARS_MOD=$WORK_DIR/$GEARS_MOD
75+
if [[ ! -f $F_GEARS_MOD ]]; then
76+
echo "Download RedisGears ..."
77+
$OP wget -q -P $WORK_DIR $GEARS_S3_URL/$GEARS_MOD
78+
fi
79+
80+
F_GEARS_DEPS=$WORK_DIR/$GEARS_DEPS
81+
if [[ ! -f $F_GEARS_DEPS ]]; then
82+
echo "Download RedisGears deps ..."
83+
$OP wget -q -P $WORK_DIR $GEARS_S3_URL/$GEARS_DEPS
84+
fi
2785
else
28-
echo "Download RedisGears deps"
29-
wget -P $WORK_DIR $REDISGEARS_DEPS_S3_PATH
30-
tar -C $WORK_DIR -xvf $WORK_DIR$REDISGEARS_DEPS
86+
F_GEARS_MOD=$GEARS_PATH/artifacts/snapshot/$GEARS_MOD
87+
F_GEARS_DEPS=$GEARS_PATH/artifacts/snapshot/$GEARS_DEPS
88+
[[ ! -f $F_GEARS_MOD ]] && { eprint "$F_GEARS_MOD is missing"; exit 1; }
89+
[[ ! -f $F_GEARS_DEPS ]] && { eprint "$F_GEARS_DEPS is missing"; exit 1; }
3190
fi
91+
92+
$OP unzip -q $F_GEARS_MOD -d $WORK_DIR
93+
$OP tar --no-same-owner -C $WORK_DIR -xzf $F_GEARS_DEPS
94+
$OP mv $WORK_DIR $FINAL_WORK_DIR

tests/flow/tests.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ install_git_lfs() {
5252

5353
#----------------------------------------------------------------------------------------------
5454

55-
install_redis_gears() {
56-
57-
OS=bionic /bin/bash $HERE/Install_RedisGears.sh
58-
}
59-
60-
#----------------------------------------------------------------------------------------------
6155
check_redis_server() {
6256
if ! command -v redis-server > /dev/null; then
6357
echo "Cannot find redis-server. Aborting."
@@ -142,8 +136,7 @@ cd $ROOT/tests/flow
142136

143137
install_git_lfs
144138
check_redis_server
145-
install_redis_gears
146-
139+
./Install_RedisGears.sh
147140

148141
[[ ! -z $REDIS ]] && RL_TEST_ARGS+=" --env exiting-env --existing-env-addr $REDIS" run_tests "redis-server: $REDIS"
149142
[[ $GEN == 1 ]] && run_tests

0 commit comments

Comments
 (0)