@@ -44,6 +44,12 @@ function validate_package_xml() {
44
44
45
45
function install_libmemcached() {
46
46
47
+ if test -d " ${LIBMEMCACHED_PREFIX} "
48
+ then
49
+ echo " Using cached libmemcached: ${LIBMEMCACHED_PREFIX} "
50
+ return
51
+ fi
52
+
47
53
wget " https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION} /+download/libmemcached-${LIBMEMCACHED_VERSION} .tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION} .tar.gz
48
54
49
55
tar xvfz libmemcached-${LIBMEMCACHED_VERSION} .tar.gz
@@ -81,35 +87,52 @@ function install_msgpack() {
81
87
popd
82
88
}
83
89
84
- function install_sasl() {
90
+ function install_memcached() {
91
+ local prefix=" ${HOME} /cache/memcached-sasl-${MEMCACHED_VERSION} "
92
+
93
+ if test -d " $prefix "
94
+ then
95
+ echo " Using cached memcached: ${prefix} "
96
+ return
97
+ fi
85
98
86
- wget http://memcached.googlecode.com /files/memcached-1.4.15. tar.gz -O memcached-1.4.15 .tar.gz
87
- tar xfz memcached-1.4.15 .tar.gz
99
+ wget http://www. memcached.org /files/memcached-${MEMCACHED_VERSION} . tar.gz -O memcached-${MEMCACHED_VERSION} .tar.gz
100
+ tar xfz memcached-${MEMCACHED_VERSION} .tar.gz
88
101
89
- pushd memcached-1.4.15
90
- ./configure --enable-sasl --prefix=" ${HOME} /memcached "
102
+ pushd memcached-${MEMCACHED_VERSION}
103
+ ./configure --enable-sasl --enable-sasl-pwdb -- prefix=" ${prefix} "
91
104
make
92
105
make install
93
106
popd
107
+ }
108
+
109
+ function run_memcached() {
110
+ local prefix=" ${HOME} /cache/memcached-sasl-${MEMCACHED_VERSION} "
94
111
95
- sudo apt-get install sasl2-bin
96
- export SASL_CONF_PATH=" ${HOME} /sasl2"
112
+ export SASL_CONF_PATH=" /tmp/sasl2"
113
+
114
+ if test -d " ${SASL_CONF_PATH} "
115
+ then
116
+ rm -rf " ${SASL_CONF_PATH} "
117
+ fi
97
118
98
- # Create config path
99
119
mkdir " ${SASL_CONF_PATH} "
120
+ export MEMCACHED_SASL_PWDB=" ${SASL_CONF_PATH} /sasldb2"
100
121
101
122
# Create configuration
102
123
cat<< EOF > "${SASL_CONF_PATH} /memcached.conf"
103
124
mech_list: PLAIN
104
125
plainlog_level: 5
105
- sasldb_path: ${SASL_CONF_PATH} /sasldb2
126
+ sasldb_path: ${MEMCACHED_SASL_PWDB}
106
127
EOF
107
128
108
- # Create password
109
- echo " test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f " ${SASL_CONF_PATH} /sasldb2"
129
+ echo " test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f " ${MEMCACHED_SASL_PWDB} "
130
+
131
+ # Run normal memcached
132
+ " ${prefix} /bin/memcached" -d -p 11211
110
133
111
134
# Run memcached on port 11212 with SASL support
112
- " ${HOME} /memcached /bin/memcached" -S -d -p 11212
135
+ " ${prefix} /bin/memcached" -S -d -p 11212
113
136
}
114
137
115
138
function build_php_memcached() {
@@ -129,7 +152,8 @@ function build_php_memcached() {
129
152
sasl_flag=" --enable-memcached-sasl"
130
153
fi
131
154
132
- ./configure --with-libmemcached-dir=" $LIBMEMCACHED_PREFIX " $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-igbinary --enable-memcached-msgpack
155
+ # ./configure --with-libmemcached-dir="$LIBMEMCACHED_PREFIX" $protocol_flag $sasl_flag
156
+ ./configure --with-libmemcached-dir=" $LIBMEMCACHED_PREFIX " $protocol_flag $sasl_flag --enable-memcached-json --enable-memcached-msgpack --enable-memcached-igbinary
133
157
make
134
158
make install
135
159
popd
@@ -152,30 +176,24 @@ EOF
152
176
function run_memcached_tests() {
153
177
export NO_INTERACTION=1
154
178
export REPORT_EXIT_STATUS=1
155
- export TEST_PHP_EXECUTABLE=` which php`
179
+ export TEST_PHP_EXECUTABLE=$( which php)
156
180
157
181
pushd " ${PHP_MEMCACHED_BUILD_DIR} /memcached-${PHP_MEMCACHED_VERSION} "
158
182
# We have one xfail test, we run it separately
159
- php run-tests.php -d extension=msgpack.so -d extension=igbinary.so -d extension= memcached.so -n ./tests/expire.phpt
183
+ php run-tests.php -d extension=memcached.so -n ./tests/expire.phpt
160
184
rm ./tests/expire.phpt
161
185
162
186
# Run normal tests
163
- php run-tests.php -d extension=msgpack .so -d extension=igbinary .so -d extension=memcached .so -n ./tests/* .phpt
187
+ php run-tests.php --show-diff - d extension=modules/memcached .so -d extension=msgpack .so -d extension=igbinary .so -n ./tests/* .phpt
164
188
retval=$?
165
- for i in ` ls tests/* .out 2> /dev/null` ; do
166
- echo " -- START ${i} " ;
167
- cat $i ;
168
- echo " " ;
169
- echo " -- END" ;
170
- done
171
189
popd
172
-
173
190
return $retval ;
174
191
}
175
192
176
193
# Command line arguments
177
194
ACTION=$1
178
195
LIBMEMCACHED_VERSION=$2
196
+ MEMCACHED_VERSION=" 1.4.25"
179
197
180
198
if test " x$ACTION " = " x" ; then
181
199
echo " Usage: $0 <action> <libmemcached version>"
@@ -187,11 +205,15 @@ if test "x$LIBMEMCACHED_VERSION" = "x"; then
187
205
exit 1
188
206
fi
189
207
208
+ if test " x$3 " ! = " x" ; then
209
+ MEMCACHED_VERSION=$3
210
+ fi
211
+
190
212
# the extension version
191
213
PHP_MEMCACHED_VERSION=$( php -r ' $sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;' )
192
214
193
215
# Libmemcached install dir
194
- LIBMEMCACHED_PREFIX=" ${HOME} /libmemcached-${LIBMEMCACHED_VERSION} "
216
+ LIBMEMCACHED_PREFIX=" ${HOME} /cache/ libmemcached-${LIBMEMCACHED_VERSION} "
195
217
196
218
# Where to do the build
197
219
PHP_MEMCACHED_BUILD_DIR=" /tmp/php-memcached-build"
@@ -216,13 +238,11 @@ case $ACTION in
216
238
# Install igbinary extension
217
239
install_igbinary
218
240
219
- # install msgpack
241
+ # Install msgpack extension
220
242
install_msgpack
221
-
222
- # install SASL
223
- if test " x$ENABLE_SASL " = " xyes" ; then
224
- install_sasl
225
- fi
243
+
244
+ install_memcached
245
+ run_memcached
226
246
;;
227
247
228
248
script)
0 commit comments