com web/rmtools: refactor the pre build script: bin/pecl_snap _pre.bat
| From: | Anatol Belski | Date: | Mon, 31 Jul 2017 10:08:16 +0000 |
| Subject: | com web/rmtools: refactor the pre build script: bin/pecl_snap _pre.bat | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26271@lists.php.net to get a copy of this message | ||
Commit: 7e48c4b962d74f1a4131520434ed4063db17534c
Author: Anatol Belski <ab@php.net> Mon, 31 Jul 2017 12:08:16 +0200
Parents: 69c0bd89e3d8c2817e77bffd078d9b31ca66b553
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=7e48c4b962d74f1a4131520434ed4063db17534c
Log:
refactor the pre build script
Changed paths:
M bin/pecl_snap_pre.bat
Diff:
diff --git a/bin/pecl_snap_pre.bat b/bin/pecl_snap_pre.bat
index 1317b4a..0de5c01 100644
--- a/bin/pecl_snap_pre.bat
+++ b/bin/pecl_snap_pre.bat
@@ -1,19 +1,15 @@
@ECHO OFF
-SET BAT_DIR=%~dp0
-
-set yyyy=%date:~6,4%
-set mm=%date:~3,2%
-set dd=%date:~0,2%
+if not exist %~dp0rmtools_setvars.bat (
+ echo RMTOOLS is not setup, create %~dp0rmtools_setvars.bat
+ exit /b 3
+)
+call %~dp0rmtools_setvars.bat
-set hh=%time:~0,2%
-if %hh% lss 10 (set hh=0%time:~1,1%)
-set nn=%time:~3,2%
-set ss=%time:~6,2%
-set cur_date=%yyyy%%mm%%dd%-%hh%%nn%%ss%
+for /f "tokens=2-8 delims=.:/ " %%a in ("%date% %time%") do set
cur_date=%%c-%%a-%%b_%%d-%%e-%%f.%%g
-set LOG_FILE=c:\php-sdk\logs\task-pecl-%cur_date%.log
-set RMTOOLS_BASE_DIR=c:\php-sdk\rmtools-client
+set LOG_FILE=%PHP_RMTOOLS_LOG_PATH%\task-pecl-pre-%cur_date%.log
+set LOCK_FILE=%PHP_RMTOOLS_LOCK_PATH%\pecl.lock
if "%1"=="" goto :help
if "%1"=="--help" goto :help
@@ -27,17 +23,17 @@ echo This is the PECL build batch script. You can see the help
echo output of the underlaying worker below. Note that you HAVE
echo TO ommit the --config option when running this batch.
echo ==========================================================
-%BAT_DIR%pecl.bat
+call "%PHP_RMTOOLS_PHP_SDK_ROOT_PATH%\phpsdk-starter.bat" -c vc15 -a x64 -t
"%PHP_RMTOOLS_BIN_PATH%\pecl.bat"
GOTO EXIT_LOCKED
:skip_help
-IF EXIST c:\php-sdk\locks\pecl.lock (
+IF EXIST "%LOCK_FILE%" (
ECHO Pecl build script is already running.
GOTO EXIT_LOCKED
)
-ECHO running > c:\php-sdk\locks\pecl.lock
+ECHO running > "%LOCK_FILE%"
rem Notice the --first and the --last calls marked, that's important
rem to maintain the state between call for the same package. For instance
@@ -47,12 +43,12 @@ rem call %BAT_DIR%pecl.bat --config=pecl55_x86 %* >> %LOG_FILE%
2<&1
rem call %BAT_DIR%pecl.bat --config=pecl54 %* >> %LOG_FILE% 2<&1
rem call %BAT_DIR%pecl.bat --config=pecl53 --last %* >> %LOG_FILE% 2<&1
rem
-call %BAT_DIR%pecl.bat --config=pecl72_x86 --first %* >> %LOG_FILE% 2<&1
-call %BAT_DIR%pecl.bat --config=pecl72_x64 --last %* >> %LOG_FILE% 2<&1
+call "%PHP_RMTOOLS_PHP_SDK_ROOT_PATH%\phpsdk-starter.bat" -c vc15 -a x64 -t
"%PHP_RMTOOLS_BIN_PATH%\pecl.bat" --task-args "--config=pecl72_x64 --first %*"
>> "%LOG_FILE%" 2<&1
+call "%PHP_RMTOOLS_PHP_SDK_ROOT_PATH%\phpsdk-starter.bat" -c vc15 -a x86 -t
"%PHP_RMTOOLS_BIN_PATH%\pecl.bat" --task-args "--config=pecl72_x86 --last %*"
>> "%LOG_FILE%" 2<&1
-echo Done.>> %LOG_FILE%
+echo Done.>> "%LOG_FILE%"
-del c:\php-sdk\locks\pecl.lock >> %LOG_FILE% 2<&1
+del "%LOCK_FILE%" >> "%LOG_FILE%" 2<&1
:EXIT_LOCKED
echo .