source: tol/windows/build_tools/_uptol.bat @ 654cb94

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

Updating to VC9

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

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