source: tol/windows/build_tools/_uptol.bat @ 1bd698a

1941-docker-image-to-testdevel
Last change on this file since 1bd698a was 1bd698a, checked in by Víctor de Buen <vdebuen@…>, 16 years ago

using vc8
refs #969

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2517 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 13.1 KB
RevLine 
[abf9afa]1@Rem Author: Jorge <josp.jorge@gmail.com>
2
3rem @Echo Off
4Rem Compila tol y toltcl, el postbuild se encarga de copiar los binarios
5Rem Copia stdlib hacia ActiveTOL
6Rem Copia tolbase\toltklib\byswidget, tolbase\lib\ hacia ActiveTOL
7
8rem SetLocal enableextensions enabledelayedexpansion
9Rem Validacion de argumentos
10
11Rem procesamiento de opciones de linea de comandos
12Set _rebuild=0
13Set _jup=0
14Set _pnsis=0
15Set _dotests=0
16Set _dodist=0
17
18Set _plog=!CD!\log2clog.exe
19Set _fbody=!CD!\test_status\BODY.txt
20
21If Not Exist test_status\nul (
22  Md test_status
23)
24
25Rem !!!!!!!!!!!!!!!!!!!!!!!
26
[3f7fe61]27Set _url_bin_=https://www.tol-project.org/win32
[abf9afa]28
29Set tdt_subject="UPTOL works fine"
30Set tdt_body=%_fbody%
31Set tdt_attach=""
32
33     
34:READ_OPTS
35If "%1"=="" Goto END_OPTS
36If "%1"=="/?" Goto SHOW_HELP
[c91df70]37If "%1"=="/no_update" (
38  Goto NEXT_OPTS
39)
[abf9afa]40If "%1"=="/smartbuild" (
41  Set _rebuild=0
42  Goto NEXT_OPTS
43)
44If "%1"=="/rebuild" (
45  Set _rebuild=1
46  Goto NEXT_OPTS
47)
48If "%1"=="/jup" (
49  Set _jup=1
50  Goto NEXT_OPTS
51)
52If "%1"=="/pnsis" (
53  Set _pnsis=1
54  Goto NEXT_OPTS
55)
56If "%1"=="/tests" (
57  Set _dotests=1
58  Goto NEXT_OPTS
59)
60If "%1"=="/no_tests" (
61  Set _dotests=0
62  Goto NEXT_OPTS
63)
64If "%1"=="/dist" (
65  Set _dodist=1
66  Goto NEXT_OPTS
67)
68Set _msg_error=Opcion invalida %1
69Goto ERROR
70:NEXT_OPTS
71Shift
72Goto READ_OPTS
73:END_OPTS
74
75Rem Goto TMP
76Rem Goto DODIST
77
78
79If "%_rebuild%"=="1" (
80  Set _rbopt=/rebuild
81)
82
83Set ATOLDIR=!CD!\..\ActiveTol\bin
84
85Goto BEGIN
86
87Rem Ayuda de uso
88:SHOW_HELP
89@more README
90Goto END
91
92Rem Codigo de error
93:ERROR
94If Not Defined _msg_error (
95  Echo Error invocado sin mensage
96) else (
97  Echo %_msg_error%
98  Set tdt_subject="UPTOL works badly"
99  Echo %_msg_error% >> %_fbody%
100)
101Pause
102Goto END
103
104Rem Codigo de retorno generico
105:RET
106If Defined _ret (
107  Goto %_ret%
108) Else (
109  Set _msg_error=Error interno! Punto de retorno no definido.
110  Goto ERROR
111)
112
113Rem Actualiza scripts en ActiveTOL, recibe como argumento
114Rem   - _dir_src,  directorio origen
115Rem   - _dir_dest,  directorio destino
116:UP_SCRIPTS
117If Exist %_dir_dest%\nul (
118  Echo Borrando scripts antiguos de %_dir_dest%
119  Rmdir /S /Q %_dir_dest%
120)
121Echo Copiando scripts nuevos de %_dir_src% a %_dir_dest%
122xcopy %_dir_src% %_dir_dest% /S /F /Y /I /EXCLUDE:exclude.lst
123If errorlevel 1  (
124  Set _msg_error=Error copiando %_dir_src% hacia %_dir_dest%
125  Goto ERROR
126)
127Goto RET
128
129Rem Codigo generico de compilacion
130:COMPILE
131Rem Verifico que ejecutemos desde el SDK
132If Not Defined MSSdk (
133  Set _msg_error=Solo se puede compilar desde una consola Microsoft Platform SDK
134  Goto ERROR
135)
136If Not Defined _mod (
137  Set _msg_error=Error interno! variable _mod no definida en COMPILE
138  Goto ERROR
139)
140If Not Exist ..\..\%_mod%\nul (
141  Set _msg_error=Error interno! el directorio %_mod% debia existir cuando se ha solicitado su compilacion.
142  Goto ERROR
143)
144If Not Defined _sln (
145  Set _msg_error=Error interno variable _sln no definida en COMPILE
146  Goto ERROR
147)
[1bd698a]148If Not Exist ..\..\%_mod%\win-VC8\%_sln% (
149  Set _msg_error=No se puede compilar, el archivo %_mod%\win-VC8\%_sln% no existe
[abf9afa]150  Goto ERROR
151)
152If "%_vsvars32%"=="" (
[c91df70]153  If Defined VS90COMNTOOLS (
154    call "%VS90COMNTOOLS%vsvars32"
[abf9afa]155    If errorlevel 1 (
156      Set _msg_error=No se pudo ejecutar vsvars32
157      Goto ERROR
158    )
159    Set _vsvars32=1
160  ) else (
[c91df70]161    Echo VS90COMNTOOLS no esta definida intentanto vsvars32 desde el PATH
[abf9afa]162    call vsvars32
163    If errorlevel 1 (
164      Set _msg_error=No se pudo ejecutar vsvars32
165      Goto ERROR
166    )
167  )
168) else  (
169  Echo vsvars32 ya ha sido invocado
170)
171Rem Verifico postbuild.bat: aseguro que existe. postbuild copia la compilacion a ActiveTOL
[1bd698a]172If Not Exist ..\..\%_mod%\win-VC8\postbuild.bat (
173  xcopy /F /Y postbuild.bat %_mod%\win-VC8
[abf9afa]174)
[1bd698a]175vcbuild %_rbopt% /useenv ..\..\%_mod%\win-VC8\%_sln% "Release|Win32"
[abf9afa]176If errorlevel 1 (
177  Set _msg_error=Fallo en vcbuild con la solucion %_sln%
178  Goto ERROR
179)
180Goto RET
181
182:CHECK_VARS
183For %%v in %_vars% do (
184  If Not defined %%v (
185    Echo La variable %%v debe estar definida para compilar %_mod%
186    If Not Defined _msg_extra Goto END
187    If "%_msg_extra%"=="" Goto END
188    Echo %_msg_extra%
189    Pause
190    Goto END
191  )
192)
193Goto RET
194
195:BEGIN
196
197Rem Compilacion de TOL
198Set _mod=tol
199Set _sln=gnutol.sln
200Set _ret=RET_TOLCC
201Goto COMPILE
202:RET_TOLCC
203
204Rem Compilacion de TOLTCL
205Rem Verifico que las variable de entorno de TOLTCL esten definidas
206Set _vars=(TCL_INCLUDE TCL_LIB)
207Set _msg_extra=TCL_INCLUDE debe apuntar a los include de Tcl. TCL_LIB debe apuntar a las librerias de Tcl.
208Set _ret=RET_VARTT
209Goto CHECK_VARS
210:RET_VARTT
211Set _mod=toltcl
212Set _sln=toltcl.sln
213Set _ret=RET_TTCC
214Goto COMPILE
215:RET_TTCC
216
217Rem Compilacion de VBTOL
218If "%_jup%"=="1" Goto RET_VBCC
219Set _mod=vbtol
220Set _sln=vbtol.sln
221Set _ret=RET_VBCC
222Goto COMPILE
223:RET_VBCC
224
225Rem Compilacion de TOLSH
226If "%_jup%"=="1" Goto RET_TSHCC
227PushD ..\..\tolsh
228call build
229xcopy /F /Y tolsh.exe !ATOLDIR!
230PopD
231:RET_TSHCC
232
233If "%_jup%"=="1" Goto END
234
235Rem Copio scripts TOL y TCL hacia ActiveTOL
236If Not Exist ..\ActiveTOL\nul (
237  Echo Directorio ActiveTOL no existente. No se copiaran scripts.
238  Pause
239  Goto END
240)
241
242Rem Copia de stdlib
243Set _dir_src=..\..\tol\stdlib
244Set _dir_dest=..\ActiveTOL\bin\stdlib
245Set _ret=RET_CPTL
246Goto UP_SCRIPTS
247:RET_CPTL
248Rem copiamos pkgIndex.tcl de toltcl
249xcopy ..\..\toltcl\pkgIndex.tcl ..\ActiveTOL\lib\toltcl\ /F /Y /I
250If errorlevel 1 (
251  Set _msg_error=Error copiando toltcl\pkgIndex.tcl hacia ActiveTOL
252  Goto ERROR
253)
254Rem Copia de scripts tcl, byswidget, toltk y rmtps_client
255Rem byswidget
256Set _dir_src=..\..\tolbase\lib\byswidget
257Set _dir_dest=..\ActiveTOL\lib\byswidget
258Set  _ret=RET_CPBYS
259Goto UP_SCRIPTS
260:RET_CPBYS
261Rem toltk
262Set _dir_src=..\..\tolbase\lib\toltk
263Set _dir_dest=..\ActiveTOL\lib\toltk
264Set  _ret=RET_CPTTK
265Goto UP_SCRIPTS
266:RET_CPTTK
267Rem rmtps_client
268Set _dir_src=..\..\tolbase\lib\rmtps_client
269Set _dir_dest=..\ActiveTOL\lib\rmtps_client
270Set  _ret=RET_CPRMT
271Goto UP_SCRIPTS
272:RET_CPRMT
273
274Rem Recupero ficheros perdidos por cualquier causa
275If Not Exist ..\ActiveTOL\bin\tol.exe (
276  Echo Recuperando ejecutable perdido ..\ActiveTOL\bin\tol.exe
[1bd698a]277  copy ..\..\tol\win-VC8\release\tol.exe ..\ActiveTOL\bin\tol.exe
[abf9afa]278)
279If Not Exist ..\ActiveTOL\bin\tol.dll (
280  Echo Recuperando librería perdida ..\ActiveTOL\bin\tol.dll
[1bd698a]281  copy ..\..\tol\win-VC8\release\tol.dll ..\ActiveTOL\bin\tol.dll
[abf9afa]282)
283If Not Exist ..\ActiveTOL\bin\tolodbc*.dll (
284  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolodbc*.dll
[1bd698a]285  copy ..\..\tol\win-VC8\libtolodbc\Release\*.dll ..\ActiveTOL\bin
[abf9afa]286) 
287If Not Exist ..\ActiveTOL\bin\tolmysql*.dll (
288  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolmysql*.dll
[1bd698a]289  copy ..\..\tol\win-VC8\libtolmysql\Release\*.dll ..\ActiveTOL\bin
[abf9afa]290) 
291If Not Exist ..\ActiveTOL\bin\tolpgsql*.dll (
292  Echo Recuperando librería perdida ..\ActiveTOL\bin\tolpgsql*.dll
[1bd698a]293  copy ..\..\tol\win-VC8\libtolpgsql\Release\*.dll ..\ActiveTOL\bin
[abf9afa]294) 
295If Not Exist ..\ActiveTOL\lib\toltcl\toltcl.dll (
296  Echo Recuperando librería perdida ..\ActiveTOL\lib\toltcl\toltcl.dll
[1bd698a]297  copy ..\..\toltcl\win-VC8\Release\toltcl.dll ..\ActiveTOL\lib\toltcl\toltcl.dll
[abf9afa]298)
299If Not Exist ..\ActiveTOL\bin\vbtol.dll (
300  Echo Recuperando librería perdida ..\ActiveTOL\bin\vbtol.dll
[1bd698a]301  copy ..\..\vbtol\win-VC8\Release\vbtol.dll ..\ActiveTOL\bin\vbtol.dll
[abf9afa]302)
303
304Rem Ejecuto los tests si me lo han pedido
305:DO_TESTS
306If "%_dodist%"=="1" (
307  If "%_dotests%"=="0" (
308    Echo "Forzando los test de tol debido a que se ha solicitado /dist"
309    Set _dotests=1
310  )
311)
312
313If "%_dotests%"=="1" (
314  If Exist ..\ActiveTOL\bin\tol.exe (
315    If Not Exist test_status (
316      Md test_status
317    ) Else (
318      Del /Q test_status\*.*
319    )
320    Set _tst_cd=!CD!\test_status
321    PushD ..\ActiveTOL\bin
322    Echo Ejecutando Tol standard tests ...
[a6dab000]323        echo %CD%\\test_status\
[3f7fe61]324       
[a6dab000]325    tol.exe -v -c"Text DupTestIndicatorPath=\"%CD%\\test_status\"" "..\\..\\..\\tol_tests\\tol\\_tolTester.tol">!_tst_cd!\init.log
[abf9afa]326    PopD
327    If Exist test_status\FAIL.txt (
328      Set test_status=FAIL
329      Set tdt_subject="ERROR ejecutando TOL_TESTS"
330      Set tdt_body="La ejecucion de TOL_TESTS genero el archivo de estado FAIL.txt. No se ha actualizado Tolbase en %_url_bin_%."
331      Set tdt_attach=test_status\FAIL.txt
332    ) Else If Exist test_status\WARNING.txt (
333      Set test_status=WARNING
334      Set tdt_subject="Version %_branchid% actualizada, WARNING ejecutando TOL_TESTS"
335      Set tdt_body=test_status\BODY.txt
336      Set tdt_attach=test_status\WARNING.txt
337    ) Else If Exist test_status\OK.txt (
338      Set test_status=OK
339      Set tdt_subject="Version %_branchid% actualizada, OK ejecutando TOL_TESTS"
340      Set tdt_body=test_status\BODY.txt
341      Set tdt_attach=test_status\OK.txt
342    ) Else (
343      Set test_status=FAIL
344      Set tdt_subject="ERROR ejecutando TOL_TEST"
345      Echo TOL_TEST no genero archivo de estado, verifique manualmente /tests>>%_fbody%
346      Echo.>>%_fbody%
347      Echo COMPUTERNAME  = %COMPUTERNAME%>>%_fbody%
348      Echo USERNAME      = %USERNAME%>>%_fbody%
349      Echo BRANCHID      = ""RAMA SVN"
350      Echo.>>%_fbody%
351      Echo Se ha adjuntado el log de inicializacion de TOL.>>%_fbody%
352      Set tdt_body=test_status\BODY.txt
353      Set tdt_attach=test_status\init.log
354    )
355  ) Else (
356    Set _msg_error=No se encuentra ..ºActiveTOL\bin\tol.exe necesario para ejecutar los tests de TOL
357    Goto ERROR
358  )
359)
360If "%test_status%"=="FAIL" (
361  Echo TOL_TESTS finalizo con errores, chequee %CD%\test_status
362  Goto SENDMAIL
363)
364
365
366Rem empaco la distribucion de tolbase si me lo han pedido
367If "%_dodist%"=="1" (
368  If Not Exist ..\NSIS\Tolbase*.exe (
369    Echo ..\NSIS\Tolbase*.exe no existe
370    If Not "%_pnsis%"=="1" (
371      Echo Habilitando /pnsis para poder hacer /dist
372      Set _pnsis=1
373    )
374  )
375)
376Set _cwd=%CD%
377If "%_pnsis%"=="1" (
378
379  Echo Generando el archivo de creación del instalador de tolbase ...
380  ..\ActiveTOL\bin\tol -v ..\NSIS\Tolbase.nsi.generate.tol
381  If Not Exist ..\NSIS\Tolbase.nsi (
382    Set _msg_error=El empaquetado de tolbase ..ºNSIS\Tolbase.nsi no existe.
383    Goto ERROR
384  )
385  If Exist ..\NSIS\Tolbase*.exe (
386    Del /Q ..\NSIS\Tolbase*.exe
387  )
388  Echo Creando instalador de tolbase ...
389  makensis /V2 /X"SetCompressor /FINAL /SOLID lzma" ..\NSIS\Tolbase.nsi
390  If Exist ..\NSIS\Tolbase*.exe (
391    Echo El instalador de Tolbase ha sido creado en "%_cwd%\..\NSIS"
392  ) Else (
393    Set _msg_error=No se ha encontrado el resultado de ejecutar makensis
394    Goto ERROR
395  )
396)
397
398:DODIST
399Rem envio el empaquetado hacia www.tol-project.org si se ha pedido
400Echo status es %test_status%
401If "%_dodist%"=="1" (
402  If Exist ..\NSIS\Tolbase*.exe (
403    For %%f In (..\NSIS\Tolbase*.exe) Do (
404      Echo encontrado %%~nxf
405      Set _fbin=%%~nxf
406    )
[3f7fe61]407    REM echo Creando el tag automatico correspondiente al empaquetado
408    cd ..\NSIS
409    REM ..\ActiveTOL\bin\tol -v create_tag_build.tol
410    REM call create_tag_build.bat
411    REM Echo copiando last_development_tol_release_win.txt hacia www.tol-project.org
412    REM ..\ActiveTOL\bin\tol -v -c"Text WriteFile(\"last_development_tol_release_win.txt\",Version);"
413    REM pscp last_development_tol_release_win.txt toldevel@tolp.localbayes.es:.
414    Echo copiando Tolbase hacia www.tol-project.org
415    pscp Tolbase*.exe toldevel@tolp.localbayes.es:/var/www/packages/win32/.
[0020bfc1]416    If "%_branchid%"=="REMtrunkREM" (
[abf9afa]417      Echo copiando tolbase-%_versionNumber%-setup.exe como tolbase-cvstrunk-setup.exe en www.tol-project.org
418      plink tdt@cvs.tol-project.org "cp /home/bayes/pub/bin/win/tolbase-%_versionNumber%-setup.exe /home/bayes/pub/bin/win/tolbase-cvstrunk-setup.exe"
419    )
[3f7fe61]420    REM Echo Moviendo el empaquetado a la carpeta de almacenamiento historico
421    REM ..\ActiveTOL\bin\tol -v store_history.tol
[abf9afa]422    cd..
[3f7fe61]423        GOTO END
424    REM Echo Nueva version %_branchid% disponible en %_url_bin_%/!_fbin!>test_status\BODY.txt
[abf9afa]425    Echo.>>%_fbody%
426    Echo El resultado de tol_tests esta disponible en el archivo adjunto.>>%_fbody%
427    Echo.>>%_fbody%
428  ) Else (
429    Echo No se puede enviar Tolbase hacia www.tol-project.exe pues no existe en NSIS
430    Set _msg_error=Utilice /pnsis para construirlo
431    Goto ERROR
432  ) 
433) Else (
434  Goto END
435)
436
437GOTO END
438
439:MAILTDT
440If Not Defined _lastup (
441  Echo.>>%_fbody%
442  Echo Variable interna _lastup con la fecha de la ultima actualizacion no esta definida.>>%_fbody%
443  Echo No se podra generar el reporte de cambios.>>%_fbody%
444  Echo Verifique .cvsopts.bat>>%_fbody%
445  Goto SENDMAIL
446)
447Echo Los cambios desde la fecha %_lastup% son los siguientes:>>%_fbody%
448Rem Log de TOL
449Set _mod=tol
450Set _ret=RET_TOLLOG
451Goto CVS_GENLOG
452:RET_TOLLOG
453Rem Log de TOLTCL
454Set _mod=toltcl
455Set _ret=RET_TTLOG
456Goto CVS_GENLOG
457:RET_TTLOG
458Rem Log de VBTOL
459Set _mod=vbtol
460Set _ret=RET_VBLOG
461Goto CVS_GENLOG
462:RET_VBLOG
463Rem Log de TOLBASE
464Set _mod=tolbase
465Set _ret=RET_TBLOG
466Goto CVS_GENLOG
467:RET_TBLOG
468Rem Log de TOL_TESTS
469Set _mod=tol_tests
470Set _ret=RET_TTSTLOG
471Goto CVS_GENLOG
472:RET_TTSTLOG
473Rem Actualizo la fecha de ultima actualizacion exitosa
474Echo Set _lastup=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%>>.cvsopts.bat
475
476:SENDMAIL
477mailtdt %tdt_subject% %tdt_body% %tdt_attach%
478:END
479Rem Limpia variables d entorno
480EndLocal
Note: See TracBrowser for help on using the repository browser.