source: tol/windows/build_tools/_uptol.bat @ 0020bfc1

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

"pscpying" to toldevel@…:.

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

  • Property mode set to 100644
File size: 13.0 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
27Set _url_bin_=http://www.tol-project.org/pub/bin/win
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    tol.exe -v -c"Text DupTestIndicatorPath=\"%CD%\\test_status\"" "..\\..\\tol_tests\\tol\\_tolTester.tol">!_tst_cd!\init.log
321    PopD
322    If Exist test_status\FAIL.txt (
323      Set test_status=FAIL
324      Set tdt_subject="ERROR ejecutando TOL_TESTS"
325      Set tdt_body="La ejecucion de TOL_TESTS genero el archivo de estado FAIL.txt. No se ha actualizado Tolbase en %_url_bin_%."
326      Set tdt_attach=test_status\FAIL.txt
327    ) Else If Exist test_status\WARNING.txt (
328      Set test_status=WARNING
329      Set tdt_subject="Version %_branchid% actualizada, WARNING ejecutando TOL_TESTS"
330      Set tdt_body=test_status\BODY.txt
331      Set tdt_attach=test_status\WARNING.txt
332    ) Else If Exist test_status\OK.txt (
333      Set test_status=OK
334      Set tdt_subject="Version %_branchid% actualizada, OK ejecutando TOL_TESTS"
335      Set tdt_body=test_status\BODY.txt
336      Set tdt_attach=test_status\OK.txt
337    ) Else (
338      Set test_status=FAIL
339      Set tdt_subject="ERROR ejecutando TOL_TEST"
340      Echo TOL_TEST no genero archivo de estado, verifique manualmente /tests>>%_fbody%
341      Echo.>>%_fbody%
342      Echo COMPUTERNAME  = %COMPUTERNAME%>>%_fbody%
343      Echo USERNAME      = %USERNAME%>>%_fbody%
344      Echo BRANCHID      = ""RAMA SVN"
345      Echo.>>%_fbody%
346      Echo Se ha adjuntado el log de inicializacion de TOL.>>%_fbody%
347      Set tdt_body=test_status\BODY.txt
348      Set tdt_attach=test_status\init.log
349    )
350  ) Else (
351    Set _msg_error=No se encuentra ..ºActiveTOL\bin\tol.exe necesario para ejecutar los tests de TOL
352    Goto ERROR
353  )
354)
355If "%test_status%"=="FAIL" (
356  Echo TOL_TESTS finalizo con errores, chequee %CD%\test_status
357  Goto SENDMAIL
358)
359
360
361Rem empaco la distribucion de tolbase si me lo han pedido
362If "%_dodist%"=="1" (
363  If Not Exist ..\NSIS\Tolbase*.exe (
364    Echo ..\NSIS\Tolbase*.exe no existe
365    If Not "%_pnsis%"=="1" (
366      Echo Habilitando /pnsis para poder hacer /dist
367      Set _pnsis=1
368    )
369  )
370)
371Set _cwd=%CD%
372If "%_pnsis%"=="1" (
373
374  Echo Generando el archivo de creación del instalador de tolbase ...
375  ..\ActiveTOL\bin\tol -v ..\NSIS\Tolbase.nsi.generate.tol
376  If Not Exist ..\NSIS\Tolbase.nsi (
377    Set _msg_error=El empaquetado de tolbase ..ºNSIS\Tolbase.nsi no existe.
378    Goto ERROR
379  )
380  If Exist ..\NSIS\Tolbase*.exe (
381    Del /Q ..\NSIS\Tolbase*.exe
382  )
383  Echo Creando instalador de tolbase ...
384  makensis /V2 /X"SetCompressor /FINAL /SOLID lzma" ..\NSIS\Tolbase.nsi
385  If Exist ..\NSIS\Tolbase*.exe (
386    Echo El instalador de Tolbase ha sido creado en "%_cwd%\..\NSIS"
387  ) Else (
388    Set _msg_error=No se ha encontrado el resultado de ejecutar makensis
389    Goto ERROR
390  )
391)
392
393:DODIST
394Rem envio el empaquetado hacia www.tol-project.org si se ha pedido
395Echo status es %test_status%
396If "%_dodist%"=="1" (
397  If Exist ..\NSIS\Tolbase*.exe (
398    For %%f In (..\NSIS\Tolbase*.exe) Do (
399      Echo encontrado %%~nxf
400      Set _fbin=%%~nxf
401    )
402    echo Creando el tag automatico correspondiente al empaquetado
403    cd NSIS
404    ..\ActiveTOL\bin\tol -v create_tag_build.tol
405    call create_tag_build.bat
406    Echo copiando last_development_tol_release_win.txt hacia www.tol-project.org
407    ..\ActiveTOL\bin\tol -v -c"Text WriteFile(\"last_development_tol_release_win.txt\",Version);"
[0020bfc1]408    pscp last_development_tol_release_win.txt toldevel@tolp.localbayes.es:.
[abf9afa]409    Echo copiando Tolbase hacia http://www.tol-project.org
[0020bfc1]410    pscp Tolbase*.exe toldevel@tolp.localbayes.es:.
411    If "%_branchid%"=="REMtrunkREM" (
[abf9afa]412      Echo copiando tolbase-%_versionNumber%-setup.exe como tolbase-cvstrunk-setup.exe en www.tol-project.org
413      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"
414    )
415    Echo Moviendo el empaquetado a la carpeta de almacenamiento historico
416    ..\ActiveTOL\bin\tol -v store_history.tol
417    cd..
418    Echo Nueva version %_branchid% disponible en %_url_bin_%/!_fbin!>test_status\BODY.txt
419    Echo.>>%_fbody%
420    Echo El resultado de tol_tests esta disponible en el archivo adjunto.>>%_fbody%
421    Echo.>>%_fbody%
422  ) Else (
423    Echo No se puede enviar Tolbase hacia www.tol-project.exe pues no existe en NSIS
424    Set _msg_error=Utilice /pnsis para construirlo
425    Goto ERROR
426  ) 
427) Else (
428  Goto END
429)
430
431GOTO END
432
433:MAILTDT
434If Not Defined _lastup (
435  Echo.>>%_fbody%
436  Echo Variable interna _lastup con la fecha de la ultima actualizacion no esta definida.>>%_fbody%
437  Echo No se podra generar el reporte de cambios.>>%_fbody%
438  Echo Verifique .cvsopts.bat>>%_fbody%
439  Goto SENDMAIL
440)
441Echo Los cambios desde la fecha %_lastup% son los siguientes:>>%_fbody%
442Rem Log de TOL
443Set _mod=tol
444Set _ret=RET_TOLLOG
445Goto CVS_GENLOG
446:RET_TOLLOG
447Rem Log de TOLTCL
448Set _mod=toltcl
449Set _ret=RET_TTLOG
450Goto CVS_GENLOG
451:RET_TTLOG
452Rem Log de VBTOL
453Set _mod=vbtol
454Set _ret=RET_VBLOG
455Goto CVS_GENLOG
456:RET_VBLOG
457Rem Log de TOLBASE
458Set _mod=tolbase
459Set _ret=RET_TBLOG
460Goto CVS_GENLOG
461:RET_TBLOG
462Rem Log de TOL_TESTS
463Set _mod=tol_tests
464Set _ret=RET_TTSTLOG
465Goto CVS_GENLOG
466:RET_TTSTLOG
467Rem Actualizo la fecha de ultima actualizacion exitosa
468Echo Set _lastup=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%>>.cvsopts.bat
469
470:SENDMAIL
471mailtdt %tdt_subject% %tdt_body% %tdt_attach%
472:END
473Rem Limpia variables d entorno
474EndLocal
Note: See TracBrowser for help on using the repository browser.