source: tol/windows/build_tools/_uptol.bat @ 17113dc

1941-docker-image-to-testdevel
Last change on this file since 17113dc was 17113dc, checked in by Pedro Gea <pgea@…>, 11 years ago

Se incorpora la descarga de paquetes por defecto vía wget al uptol.
Se corrigen 3 warnings de init.tol.

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

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