com pftt2: Fixes #53: Created batch files: bin/get_latest_r evision.cmd bin/get_qa.cmd bin/get_release.cmd bin/get_snapshot.cmd
[email protected] (Christoph Michael Becker)
| Newsgroups | php.qa |
|---|---|
| Message-ID | <[email protected]> |
Commit: 7c40ee87a37e52bcfe479bf2bc2261db4869d08d Author: Allen Truong <[email protected]> Fri, 12 Jul 2019 21:18:42 +0200 Committer: Christoph M. Becker <[email protected]> Fri, 12 Jul 2019 22:44:00 +0200 Parents: 1bb5ffcc657a36d2fcc14577e4d2e70e0ac1efd8 Branches: master Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=7c40ee87a37e52bcfe479bf2bc2261db4869d08d Log: Fixes #53: Created batch files Bugs: https://bugs.php.net/53 Changed paths: A bin/get_latest_revision.cmd A bin/get_qa.cmd A bin/get_release.cmd A bin/get_snapshot.cmd
diff_7c40ee87a37e52bcfe479bf2bc2261db4869d08d.txt
(text/plain, 8.2 KB)
diff --git a/bin/get_latest_revision.cmd b/bin/get_latest_revision.cmd
new file mode 100644
index 0000000..7a01628
--- /dev/null
+++ b/bin/get_latest_revision.cmd
@@ -0,0 +1,10 @@
+set SNAP_JSON=php-%branch%.json
+set SNAP_JSON_URL=https://windows.php.net/downloads/snaps/php-%branch%/%SNAP_JSON%
+bitsadmin /transfer DownloadingJson /download /priority high !SNAP_JSON_URL! %PFTT_CACHE%\!SNAP_JSON!
+
+set "psCmd="add-type -As System.Web.Extensions;^
+$JSON = new-object Web.Script.Serialization.JavaScriptSerializer;^
+$JSON.DeserializeObject($input).revision_last_exported""
+
+for /f %%I in ('^<"%PFTT_CACHE%\!SNAP_JSON!" powershell -noprofile %psCmd%') do set "revision=r%%I"
+del %PFTT_CACHE%\!SNAP_JSON!
\ No newline at end of file
diff --git a/bin/get_qa.cmd b/bin/get_qa.cmd
new file mode 100644
index 0000000..3a75601
--- /dev/null
+++ b/bin/get_qa.cmd
@@ -0,0 +1,75 @@
+@ECHO OFF
+setlocal enabledelayedexpansion
+
+set branch=%1
+set build=%2
+set cpu=%3
+
+REM Check if parameters are set
+if %branch%.==. GOTO args_error
+if %build%.==. GOTO args_error
+if %cpu%.==. (
+ GOTO args_error
+) else (
+ GOTO set_env
+)
+
+:args_error
+echo User error: must specify branch, build type, CPU arch and revision code
+echo get_release "<branch> <build> <cpu>"
+echo Branch can be any of: 7.2.XRCX, 7.3.XRCX, 7.4.XRCX
+echo Build can be any of: NTS, TS
+echo CPU can be any of: X64, X86
+exit /b
+
+:set_env
+REM set important env vars
+IF DEFINED PFTT_SHELL GOTO :skip_set_env
+CALL %~dp0set_env.cmd
+:skip_set_env
+
+SET PHP_BUILDS=%~d0\PHPBuilds
+
+REM Create cache folder if it does not exist
+if not exist %PHP_BUILDS% (
+ md %~d0\PHPBuilds
+)
+
+set file_name=php-%branch%
+set test_pack=php-test-pack-%branch%
+
+REM Add nts to file_name if needed
+if /I %build%==nts (
+ set file_name=%file_name%-nts
+)
+
+REM Set file_name based on parameters
+if not x%branch:7.2=%==x%branch% (
+ set file_name=%file_name%-win32-vc15-%cpu%
+) else if not x%branch:7.3=%==x%branch% (
+ set file_name=%file_name%-win32-vc15-%cpu%
+) else if not x%branch:7.4=%==x%branch% (
+ set file_name=%file_name%-win32-vs16-%cpu%
+)
+
+REM Download the build if it is not available
+if not exist %PHP_BUILDS%\%file_name% (
+ set build_link=https://windows.php.net/downloads/qa/%file_name%.zip
+
+ bitsadmin /transfer DownloadingQABuild /download /priority high !build_link! %PFTT_CACHE%\%file_name%.zip
+ 7za.exe x %PFTT_CACHE%\%file_name%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%file_name%.zip
+) else (
+ echo QA build already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
+
+REM Also download test-pack if it is not available
+if not exist %PHP_BUILDS%\%test_pack% (
+ set test_pack_link=https://windows.php.net/downloads/qa/%test_pack%.zip
+
+ bitsadmin /transfer DownloadingQATestPack /download /priority high !test_pack_link! %PFTT_CACHE%\%test_pack%.zip
+ 7za.exe x %PFTT_CACHE%\%test_pack%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%test_pack%.zip
+) else (
+ echo Test pack already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
\ No newline at end of file
diff --git a/bin/get_release.cmd b/bin/get_release.cmd
new file mode 100644
index 0000000..53b7f30
--- /dev/null
+++ b/bin/get_release.cmd
@@ -0,0 +1,77 @@
+@ECHO OFF
+setlocal enabledelayedexpansion
+
+set branch=%1
+set build=%2
+set cpu=%3
+
+REM Check if parameters are set
+if %branch%.==. GOTO args_error
+if %build%.==. GOTO args_error
+if %cpu%.==. (
+ GOTO args_error
+) else (
+ GOTO set_env
+)
+
+:args_error
+echo User error: must specify branch, build type, CPU arch and revision code
+echo get_release "<branch> <build> <cpu>"
+echo Branch can be any of: 7.1, 7.2, 7.3, 7.4
+echo Build can be any of: NTS, TS
+echo CPU can be any of: X64, X86
+exit /b
+
+:set_env
+REM set important env vars
+IF DEFINED PFTT_SHELL GOTO :skip_set_env
+CALL %~dp0set_env.cmd
+:skip_set_env
+
+SET PHP_BUILDS=%~d0\PHPBuilds
+
+REM Create cache folder if it does not exist
+if not exist %PHP_BUILDS% (
+ md %~d0\PHPBuilds
+)
+
+set file_name=php-%branch%
+set test_pack=php-test-pack-%branch%-latest
+
+REM Add nts to file_name if needed
+if /I %build%==nts (
+ set file_name=%file_name%-nts
+)
+
+REM Set file_name based on parameters
+if %branch%==7.1 (
+ set file_name=%file_name%-win32-vc14-%cpu%-latest
+) else if %branch%==7.2 (
+ set file_name=%file_name%-win32-vc15-%cpu%-latest
+) else if %branch%==7.3 (
+ set file_name=%file_name%-win32-vc15-%cpu%-latest
+) else if %branch%==7.4 (
+ set file_name=%file_name%-win32-vs16-%cpu%-latest
+)
+
+REM Download the build if it is not available
+if not exist %PHP_BUILDS%\%file_name% (
+ set build_link=https://windows.php.net/downloads/releases/latest/%file_name%.zip
+
+ bitsadmin /transfer DownloadingReleaseBuild /download /priority high !build_link! %PFTT_CACHE%\%file_name%.zip
+ 7za.exe x %PFTT_CACHE%\%file_name%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%file_name%.zip
+) else (
+ echo Release build already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
+
+REM Also download test-pack if it is not available
+if not exist %PHP_BUILDS%\%test_pack% (
+ set test_pack_link=https://windows.php.net/downloads/releases/latest/%test_pack%.zip
+
+ bitsadmin /transfer DownloadingReleaseTestPack /download /priority high !test_pack_link! %PFTT_CACHE%\%test_pack%.zip
+ 7za.exe x %PFTT_CACHE%\%test_pack%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%test_pack%.zip
+) else (
+ echo Test pack already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
\ No newline at end of file
diff --git a/bin/get_snapshot.cmd b/bin/get_snapshot.cmd
new file mode 100644
index 0000000..10fafab
--- /dev/null
+++ b/bin/get_snapshot.cmd
@@ -0,0 +1,81 @@
+@ECHO OFF
+setlocal enabledelayedexpansion
+
+set branch=%1
+set build=%2
+set cpu=%3
+set revision=%4
+
+REM Check if parameters are set
+if %branch%.==. GOTO args_error
+if %build%.==. GOTO args_error
+if %cpu%.==. GOTO args_error
+if %revision%.==. (
+ GOTO args_error
+) else (
+ GOTO set_env
+)
+
+:args_error
+echo User error: must specify branch, build type, CPU arch and revision code
+echo get_release "<branch> <build> <cpu> <revision code | latest>"
+echo Branch can be any of: 7.1, 7.2, 7.3, 7.4
+echo Build can be any of: NTS, TS
+echo CPU can be any of: X64, X86
+echo Revision code starts with r (i.e. rxxxxxx)
+exit /b
+
+:set_env
+REM set important env vars
+IF DEFINED PFTT_SHELL GOTO :skip_set_env
+CALL %~dp0set_env.cmd
+:skip_set_env
+
+SET PHP_BUILDS=%~d0\PHPBuilds
+
+REM Create cache folder if it does not exist
+if not exist %PHP_BUILDS% (
+ md %~d0\PHPBuilds
+)
+
+REM Set file_name and test_pack based on parameters
+if %branch%==7.1 (
+ set file_name=php-%branch%-%build%-windows-vc14-%cpu%
+ set test_pack=php-test-pack-%branch%-%build%-windows-vc14-%cpu%
+) else if %branch%==7.2 (
+ set file_name=php-%branch%-%build%-windows-vc15-%cpu%
+ set test_pack=php-test-pack-%branch%-%build%-windows-vc15-%cpu%
+) else if %branch%==7.3 (
+ set file_name=php-%branch%-%build%-windows-vc15-%cpu%
+ set test_pack=php-test-pack-%branch%-%build%-windows-vc15-%cpu%
+) else if %branch%==7.4 (
+ set file_name=php-%branch%-%build%-windows-vs16-%cpu%
+ set test_pack=php-test-pack-%branch%-%build%-windows-vs16-%cpu%
+)
+
+if /i %revision%==latest call get_latest_revision.cmd
+
+set file_name=%file_name%-%revision%
+set test_pack=%test_pack%-%revision%
+
+REM Download the build if it is not available
+if not exist %PHP_BUILDS%\%file_name% (
+ set build_link=https://windows.php.net/downloads/snaps/php-%branch%/%revision%/%file_name%.zip
+
+ bitsadmin /transfer DownloadingSnapBuild /download /priority high !build_link! %PFTT_CACHE%\%file_name%.zip
+ 7za.exe x %PFTT_CACHE%\%file_name%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%file_name%.zip
+) else (
+ echo Snap build already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
+
+REM Also download test-pack if it is not available
+if not exist %PHP_BUILDS%\%test_pack% (
+ set test_pack_link=https://windows.php.net/downloads/snaps/php-%branch%/%revision%/%test_pack%.zip
+
+ bitsadmin /transfer DownloadingSnapTestPack /download /priority high !test_pack_link! %PFTT_CACHE%\%test_pack%.zip
+ 7za.exe x %PFTT_CACHE%\%test_pack%.zip -o%PHP_BUILDS%\*
+ del %PFTT_CACHE%\%test_pack%.zip
+) else (
+ echo Test pack already exists. Remove or move file in %PHP_BUILDS% if you want new copy.
+)
\ No newline at end of file