source: tol/windows/build_tools/_uptol.bat @ 3f7fe61

1941-docker-image-to-testdevel
Last change on this file since 3f7fe61 was 3f7fe61, checked in by Jorge Pérez <josp.jorge@…>, 18 years ago

copy into tol.localbayes.es:/var/www/win32

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