Changeset 1122 in svn for trunk/devel/run
- Timestamp:
- 2012-08-04T03:06:15Z (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/devel/run
r1120 r1122 1 1 #!/bin/bash 2 2 # this script is for developers only 3 stopfpm() { 3 4 stopfpm() { # {{{1 4 5 if [[ -f $pidfile ]]; then 5 6 pid=`cat $pidfile 2>/dev/null || true` … … 12 13 } 13 14 14 set -e 15 MAKE=/usr/bin/make 16 17 . devel/run.cfg 18 if [[ $# -gt 0 ]]; then 19 action=$1 20 shift 21 if [[ $# -gt 0 ]]; then 22 args=("$@") 23 elif [[ $action = "make" ]]; then 24 args=() 25 fi 26 fi 27 28 case "$action" in 29 prep*) 30 exec $MAKE -f devel/prepare.mak "${args[@]}" 31 ;; 32 po2php) 33 ./run mergepo "${args[0]}" 15 xtest() { # {{{1 16 $MAKE -f devel/test.mak 17 } 18 19 prep() { # {{{1 20 $MAKE -f devel/prepare.mak "$@" 21 } 22 23 mergepo() { # {{{1 24 prep 25 local i 26 find htdocs -iname '*.po' | while read -r i; do 27 if [[ -f $i-merged ]]; then 28 mv $i-merged $i 29 fi 30 done 31 } 32 33 po2php() { # {{{1 34 mergepo 35 36 local phpfile 34 37 find htdocs -iname '*.po' | while read -r i; do 35 38 phpfile=${i/.po/.php} … … 37 40 mv $phpfile.tmp $phpfile 38 41 done 39 exit 40 ;; 41 mergepo) 42 ./run prep "${args[0]}" 43 find htdocs -iname '*.po' | while read -r i; do 44 if [[ -f $i-merged ]]; then 45 mv $i-merged $i 46 fi 47 done 48 exit 49 ;; 50 tags) 51 rm -f tags 52 exec $MAKE -f devel/prepare.mak tags "${args[@]}" 53 ;; 54 dep*) 42 } 43 44 updatedeps() { # {{{1 55 45 pwd=$(readlink -f "$(pwd)") 56 46 builddir=$(readlink -f ../trunk-php5-debug-zts) … … 97 87 echo 98 88 done > Makefile.frag.deps 99 exit 100 ;; 101 xtest) 102 exec $MAKE -f devel/test.mak 103 ;; 104 esac 105 106 case "${args[0]}" in 107 fpm) 108 pidfile=devel.pid 109 stopfpm 110 ;; 111 stopfpm) 112 pidfile=devel.pid 113 stopfpm 114 exit 115 ;; 116 esac 117 89 } 90 # }}}1 91 92 set -e 93 MAKE=/usr/bin/make 94 95 . devel/run.cfg 96 PHPSDIR=${PHPSDIR:-$HOME/test} 97 98 if [[ $# -eq 0 ]]; then 99 set -- "$action" "${args[@]}" 100 fi 101 102 if [[ $# -gt 0 ]]; then 103 action=$1 104 shift 105 fi 106 107 # devel actions 108 case "$action" in 109 prep*) prep "$@"; exit;; 110 tags) rm -f tags; prep tags "$@"; exit;; 111 po2php) po2php; exit;; 112 mergepo) mergepo; exit;; 113 dep*) updatedeps; exit;; 114 xtest) xtest; exit;; 115 esac 116 117 case "$1" in 118 fpm) pidfile=devel.pid; stopfpm;; 119 stopfpm) pidfile=devel.pid; stopfpm; exit;; 120 esac 121 122 # process each $dirs 118 123 basename=$(basename $(pwd)) 119 124 if echo $basename | grep -- - >/dev/null; then :; else … … 127 132 128 133 pwd 129 $0 "$action" "$ {args[@]}"134 $0 "$action" "$@" 130 135 done 131 136 exit … … 136 141 xcachesrcdir=../$xcachebasename 137 142 pidfile=../$xcachebasename/devel.pid 138 139 case "$action" in 140 phpize) 141 if [[ -r Makefile ]]; then 142 $MAKE xcachesvnclean || true 143 fi 144 ;; 145 esac 146 147 rm -f php-src 148 find -L . -action l | xargs rm -fv 149 lndir "$xcachesrcdir" >/dev/null || true 150 find . -iname .\*.swp | xargs rm -f 151 ln -sf ~/src/php/$phpbasename php-src 152 for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do 153 if [[ -r $i ]]; then 154 ln -sf "$i" php-cgi 155 fi 156 done 157 ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli 158 ln -sf ~/src/php/$phpbasename/sapi/fpm/php-fpm php-fpm 159 160 case "$action" in 161 phpize) 162 PHPDIRS=${PHPDIRS:-$HOME/test} 163 if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then 164 echo $PHPDIRS/$phpbasename/bin/phpize not found 143 phpize() { # {{{1 144 if [[ ! -x $PHPSDIR/$phpbasename/bin/phpize ]]; then 145 echo $PHPSDIR/$phpbasename/bin/phpize not found 165 146 exit 166 147 fi 167 export PATH=$PHP DIRS/$phpbasename/bin:$PATH148 export PATH=$PHPSDIR/$phpbasename/bin:$PATH 168 149 phpize --clean \ 169 150 && phpize \ … … 177 158 --enable-xcache-test \ 178 159 --enable-xcache-constant 179 exit 180 ;; 181 make) 182 MAKEARGS=("$@") 183 ;; 184 esac 185 186 LANG=C $MAKE $MAKEOPTS "${MAKEARGS[@]}" 2>&1 \ 187 | sed -ur \ 188 -e 's#Werror=implicit-function-declaration#We/rror=i/mplicit-function-declaration#' \ 189 -e 's#-pedantic-errors#-pedantic-e/rrors#' \ 190 -e 's#\./xc_processor\.h#'$PWD'/xc_processor.h#' \ 191 -e 's#\./xc_processor\.c\.h#'$PWD'/xc_processor.c.h#' \ 192 | hi error implicit warn FAIL 193 ret=${PIPESTATUS[0]} 194 if [[ $ret -ne 0 || $action = make ]]; then 195 exit $ret 196 fi 197 198 if [[ -z ${args[0]} ]]; then 199 args=(devel.php) 160 } 161 make() { # {{{1 162 LANG=C $MAKE $MAKEOPTS "$@" 2>&1 \ 163 | sed -ur \ 164 -e 's#Werror=implicit-function-declaration#We/rror=i/mplicit-function-declaration#' \ 165 -e 's#-pedantic-errors#-pedantic-e/rrors#' \ 166 -e 's#\./xc_processor\.h#'$PWD'/xc_processor.h#' \ 167 -e 's#\./xc_processor\.c\.h#'$PWD'/xc_processor.c.h#' \ 168 | hi error implicit warn FAIL 169 ret=${PIPESTATUS[0]} 170 if [[ $ret -ne 0 ]]; then 171 exit $ret 172 fi 173 } 174 # }}} 175 176 # prepare {{{1 177 case "$action" in 178 phpize) 179 if [[ -r Makefile ]]; then 180 $MAKE xcachesvnclean || true 181 fi 182 ;; 183 esac 184 185 rm -f php-src 186 find -L . -type l | xargs rm -fv 187 lndir "$xcachesrcdir" >/dev/null || true 188 find . -iname .\*.swp | xargs rm -f 189 ln -sf ~/src/php/$phpbasename php-src 190 for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do 191 if [[ -r $i ]]; then 192 ln -sf "$i" php-cgi 193 fi 194 done 195 ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli 196 ln -sf ~/src/php/$phpbasename/sapi/fpm/php-fpm php-fpm 197 198 case "$action" in 199 phpize) phpize; exit;; 200 make) make "$@"; exit;; 201 *) make;; 202 esac 203 # }}}1 204 205 if [[ -z $1 ]]; then 206 set -- devel.php 200 207 fi 201 208 202 209 cmd=() 203 210 tracer=() 211 212 # run utils {{{1 213 case "$action" in 214 dc) 215 exec ./php-cli -c devel.ini ./bin/phpdc.phpr $@ | tee decompiled.php 216 ;; 217 dop) 218 exec ./php-cli -c devel.ini ./bin/phpdop.phpr $@ 219 ;; 220 retest) 221 exec $MAKE xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`" 222 ;; 223 test) 224 case "$1" in 225 *.phpt) 226 exec $MAKE xcachetest TEST_ARGS=-v TESTS="$*" 227 ;; 228 */) 229 exec $MAKE xcachetest TESTS="$*" 230 ;; 231 *) 232 exec $MAKE xcachetest 233 ;; 234 esac 235 ;; 236 esac 237 # }}} 238 # pick sapi {{{1 204 239 case "$basename" in 205 240 *-apache1*) … … 210 245 ;; 211 246 *) 212 case "$ {args[0]}" in247 case "$1" in 213 248 fcgi) 214 249 cmd=(./php-cgi -q -c devel.ini) 215 args=(-b 1026)250 set -- -b 1026 216 251 ;; 217 252 fpm) 218 253 echo Starting fpm ... 219 254 cmd=(./php-fpm -c devel.ini -y devel.fpm -g $(readlink -f $pidfile)) 220 args=()255 set -- 221 256 ;; 222 257 *) … … 227 262 "${cmd[@]}" -v || true 228 263 esac 229 264 # }}} 265 # pick action {{{1 230 266 case "$action" in 231 267 ltr*) … … 244 280 tracer=(valgrind --gen-suppressions=all) 245 281 ;; 246 dc) 247 exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php 248 ;; 249 dop) 250 exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}" 251 ;; 252 retest) 253 exec $MAKE xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`" 254 ;; 255 test) 256 case "${args[0]}" in 257 *.phpt) 258 exec $MAKE xcachetest TEST_ARGS=-v TESTS="${args[*]}" 259 ;; 260 */) 261 exec $MAKE xcachetest TESTS="${args[@]}" 262 ;; 263 *) 264 exec $MAKE xcachetest 265 ;; 266 esac 267 ;; 268 esac 269 282 esac 283 284 # run {{{1 270 285 export XCACHE_SKIP_FCGI_WARNING=1 271 commandLine=("${tracer[@]}" "${cmd[@]}" "$ {args[@]}")286 commandLine=("${tracer[@]}" "${cmd[@]}" "$@") 272 287 273 288 case "${cmd[0]}" in … … 276 291 "${commandLine[@]}" 277 292 echo -n "Ctrl-C to stop" 278 trap stopfpm SIGINT SIGTERM 293 trap stopfpm SIGINT SIGTERM exit 279 294 cat > /dev/null || true 295 stopfpm 280 296 ;; 281 297 *) … … 283 299 ;; 284 300 esac 301 # }}}
Note: See TracChangeset
for help on using the changeset viewer.