@@ -26,7 +26,8 @@ REM ****************************************************************************
2626
2727REM
2828REM usage: MAKEPKG.BAT [< cmd> ]
29- REM : Possible values for < cmd> are: CLEANUP and CREATEBINARY
29+ REM : Possible values for < cmd> are: CLEANUP, CREATEBINARY
30+ REM and CREATESTAGEBINARY
3031REM
3132REM expected to run this batch file from package sub-directory,
3233REM where a fresh clone is created.
@@ -38,6 +39,7 @@ if "%1" == "" GOTO usage
3839REM jump to appropriate sections based on < cmd>
3940if " %1 " == " CLEANUP" GOTO cleanup
4041if " %1 " == " CREATEBINARY" GOTO createbinary
42+ if " %1 " == " CREATESTAGEBINARY" GOTO createstagebinary
4143goto usage
4244
4345REM cleanup section, remove file(s) created by this batch file
@@ -47,6 +49,67 @@ del ..\package-lock.json
4749del SHASUMS256.txt oracledb-v*-node-*.gz
4850goto exit
4951
52+
53+ REM compile, package to gz file
54+ :createstagebinary
55+ echo " createstagebinary section"
56+
57+ REM Append SHA to LICENSE.MD
58+ git checkout ..\LICENSE.md
59+ setlocal enabledelayedexpansion
60+ REM compose a string with commands to execute one by one
61+
62+ REM start with empty string
63+ set CONCAT_STR =
64+ REM capture SHA
65+ FOR /F " tokens=* USEBACKQ" %%F IN (`git --git-dir=..\.git rev-parse HEAD`) DO (
66+ SET CONCAT_STR = %%F
67+ )
68+
69+ set DATE_STR =
70+ FOR /F " tokens=* USEBACKQ" %%F IN (`DATE /T`) DO ( SET DATE_STR = %%F )
71+
72+ REM append output of other commands
73+ set CMD_STR = " git --git-dir=..\odpi\.git rev-parse HEAD && node --version"
74+ for /f %%i in ('%CMD_STR% ') do set " CONCAT_STR = !CONCAT_STR! %%i "
75+ set CONCAT_STR = !CONCAT_STR! !DATE_STR!
76+ echo !CONCAT_STR! >> ..\LICENSE.MD
77+
78+ REM Compile node-oracledb
79+ cd ..
80+ CALL npm install
81+ echo " NODE oracledb compiled"
82+ cd package
83+ echo " ==> Staging Binary package created for Node.js "
84+
85+ Set " hostname = %NODE_ORACLEDB_PACKAGE_HOSTNAME% "
86+ Set " pathname = %NODE_ORACLEDB_PACKAGE_URL_PATH% "
87+ Set " newname = %NODE_PKG_HOSTNAME% "
88+ echo ON
89+ echo %hostname%
90+ echo %pathname%
91+ echo %newname%
92+
93+ sed " s/github.com/%hostname% /g" oracledbinstall.js
94+ sed " s/oracle\/node-oracledb\/releases\/download\//%pathname% /g" oracledbinstall.js
95+
96+ del /S *.gz
97+
98+ node createpackage.js
99+ xcopy /Y " package.json" " ../package.json"
100+ npm pack
101+ Setlocal enabledelayedexpansion
102+
103+ Set " Pattern = oracledb"
104+ Set " Replace = oracledb-staging"
105+
106+ For %%a in (*.gz) Do (
107+ Set " File = %%~a "
108+ Ren " %%a " " !File:%Pattern% =%Replace% ! "
109+ )
110+
111+ goto exit
112+
50113REM compile, package to gz file
51114:createbinary
52115echo " createbinary section"
0 commit comments