Changeset 9b57f60f in tol
- Timestamp:
- Feb 23, 2011, 3:56:29 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- d89e153
- Parents:
- 0924759e
- Location:
- tol/stdlib
- Files:
-
- 2 edited
-
general/TolPackage/client.tol (modified) (13 diffs)
-
gui/tcl/_tclutils.tol (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/general/TolPackage/client.tol
r0924759e r9b57f60f 184 184 185 185 ////////////////////////////////////////////////////////////////////////////// 186 Set GetRepositoryInfo(Text url) 187 ////////////////////////////////////////////////////////////////////////////// 188 { 189 Real Show(False,"ALL"); 190 Text pkgInfo = GetUrlContents(url); 191 Set pkgLst = IncludeText(pkgInfo); 192 Real Show(True,"ALL"); 193 /* 194 Text If(Card(pkgLst)==0, 195 { 196 WriteLn("[TolPackage::Client::GetRepositoryInfo] " 197 "Cannot connect to \n"+url,"W") 198 }); 199 */ 200 pkgLst 201 }; 202 203 204 /////////////////////////////////////////////////////////////////// /////////// 205 Real CheckRepositoryPing(Text url) 206 ////////////////////////////////////////////////////////////////////////////// 207 { 208 If(TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, False, 209 { 210 Real key = IntRand(111111111,999999999); 211 Set info = GetRepositoryInfo(url+"?action=ping&key="<<key); 212 Real ok = Case( 213 !Card(info),False, 214 Grammar(info[1])!="Real",False, 215 1==1, info[1]==key); 216 //WriteLn("TRACE [CheckRepositoryPing] url="<<url+" info="<<info+" ok="<<ok); 217 ok 218 }) 219 }; 220 221 ////////////////////////////////////////////////////////////////////////////// 222 Real ChecktolProjectPing(Real void) 223 ////////////////////////////////////////////////////////////////////////////// 224 { 225 CheckRepositoryPing(TolPackage::_.official) 226 }; 227 228 ////////////////////////////////////////////////////////////////////////////// 186 229 Text _.autodoc.member.GetMinTolVersionForPackage = 187 230 "Devuelve la versión de TOL mínima que requiere un paquete dado" … … 191 234 { 192 235 //WriteLn("TRACE [RemoteFindRepository] 1 package='"<<package+"'"); 193 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, "", {236 If(!ChecktolProjectPing(?), "", { 194 237 //WriteLn("TRACE [RemoteFindRepository] 2"); 195 238 Set repositories = … … 202 245 { 203 246 //WriteLn("TRACE [RemoteFindRepository] 4 repositories["<<k+"]="<<repositories[k]); 204 Text pkgInfo = GetUrlContents(repositories[k]+"?"247 Set pkgLst = GetRepositoryInfo(repositories[k]+"?" 205 248 "action=versions&limit=1&"+ 206 249 "package="+package); 207 Set pkgLst = IncludeText(pkgInfo);208 250 //WriteLn("TRACE [RemoteFindRepository] 5 pkgInfo="<<pkgInfo); 209 251 //WriteLn("TRACE [RemoteFindRepository] 6 pkgLst="<<pkgLst); … … 226 268 { 227 269 //WriteLn("TRACE [RemoteFindRepository] 1 package='"<<package+"'"); 228 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, "", {270 If(!ChecktolProjectPing(?), "", { 229 271 //WriteLn("TRACE [RemoteFindRepository] 2"); 230 272 Set repositories = … … 237 279 { 238 280 //WriteLn("TRACE [RemoteFindRepository] 4 repositories["<<k+"]="<<repositories[k]); 239 Text pkgInfo = GetUrlContents(repositories[k]+"?" 240 "action=versions&limit=1&"+ 241 "package="+package+"&"+ 242 min_tol_version_cond); 243 Set pkgLst = IncludeText(pkgInfo); 281 Set pkgLst = GetRepositoryInfo(repositories[k]+"?" 282 "action=versions&limit=1&"+"package="+package+"&"+min_tol_version_cond); 244 283 //WriteLn("TRACE [RemoteFindRepository] 5 pkgInfo="<<pkgInfo); 245 284 //WriteLn("TRACE [RemoteFindRepository] 6 pkgLst="<<pkgLst); … … 262 301 ////////////////////////////////////////////////////////////////////////////// 263 302 { 264 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, UnknownDate, {303 If(!ChecktolProjectPing(?), UnknownDate, { 265 304 Text rep = If(repository=="",repository,RemoteFindRepository(package)); 266 305 If(rep=="", UnknownDate, 267 306 { 268 Text pkgInfo = GetUrlContents(rep+"?"307 Set pkgLst = GetRepositoryInfo(rep+"?" 269 308 "action=versions&limit=1&"+ 270 309 "package="+package+"&"+ 271 310 min_tol_version_cond); 272 Set pkgLst = IncludeText(pkgInfo);273 pkgLst[1]->dh_release_date_remote311 If(!Card(pkgLst), TheEnd, 312 pkgLst[1]->dh_release_date_remote) 274 313 }) 275 314 })}; … … 283 322 ////////////////////////////////////////////////////////////////////////////// 284 323 { 285 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, {324 If(!ChecktolProjectPing(?), 0, { 286 325 Real OSDirMake(localRoot); 287 326 //WriteLn("TRACE [RemoteInstallPackage] 1 repository='"<<repository+"'"); 288 327 Text package.version = package; 328 Real ok = True; 289 329 Text If(TextFind(package,"."), 290 330 { … … 292 332 }, 293 333 { 294 Text pkgInfo = GetUrlContents(repository+"?"334 Set pkgLst = GetRepositoryInfo(repository+"?" 295 335 "action=versions&limit=1&"+ 296 336 "package="+package+"&"+ 297 337 min_tol_version_cond); 298 Set pkgLst = IncludeText(pkgInfo); 299 Text package.version := pkgLst[1]->co_name_version 300 }); 301 338 If(!Card(pkgLst), 339 { 340 Real ok := False; 341 "" 342 }, 343 { 344 Text package.version := pkgLst[1]->co_name_version 345 }) 346 }); 347 If(!ok, 0, { 302 348 //WriteLn("TRACE [RemoteInstallPackage] 2 package='"<<package+"'"); 303 349 //WriteLn("TRACE [RemoteInstallPackage] 3 package.version='"<<package.version+"'"); … … 324 370 //WriteLn("TRACE DownloadPackage 5"); 325 371 FileExist(localOza) 326 })};372 })})}; 327 373 328 374 ////////////////////////////////////////////////////////////////////////////// … … 356 402 ////////////////////////////////////////////////////////////////////////////// 357 403 { 358 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, {359 Text pkgInfo = GetUrlContents(repository+"?"404 If(!ChecktolProjectPing(?), 0, { 405 Set pkgLst = GetRepositoryInfo(repository+"?" 360 406 "action=versions&"+ 361 407 min_tol_version_cond); 362 Set pkgLst = IncludeText(pkgInfo);408 If(!Card(pkgLst), False, 363 409 SetMin(EvalSet(pkgLst, Real(Set pkg) 364 410 { 365 411 RemoteInstallPackage(repository, pkg->co_name_version, showError) 366 })) 412 }))) 367 413 })}; 368 414 … … 391 437 //WriteLn("TRACE [RemoteInstall] 1 repository='"<<repository+"'"); 392 438 //WriteLn("TRACE [RemoteInstall] 2 package='"<<package+"'"); 393 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, {439 If(!ChecktolProjectPing(?), 0, { 394 440 Case( 395 441 And(repository!="",package!=""), … … 454 500 ////////////////////////////////////////////////////////////////////////////// 455 501 { 456 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, {502 If(!ChecktolProjectPing(?), 0, { 457 503 Set repositories = 458 504 TolConfigManager::Config::Upgrading::TolPackage::Repositories; 459 505 Set _.versSyncInfo := SetConcat(EvalSet(repositories,Set(Text rep) 460 506 { 461 Text pkgInfo = GetUrlContents(rep+"?"507 GetRepositoryInfo(rep+"?" 462 508 "action=versions&"+ 463 min_tol_version_cond); 464 IncludeText(pkgInfo) 509 min_tol_version_cond) 465 510 })); 466 511 Real SetIndexByName(_.versSyncInfo); … … 498 543 { 499 544 Text _MID = "TolPackage::Client::[RemoteUpdatePackSyncInfo] "; 500 If( TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, {545 If(!ChecktolProjectPing(?), 0, { 501 546 Set repositories = 502 547 TolConfigManager::Config::Upgrading::TolPackage::Repositories; 503 548 Set _.packSyncInfo := SetConcat(EvalSet(repositories,Set ev.rep(Text rep) 504 549 { 505 Text pkgInfo = GetUrlContents(rep+"?"550 GetRepositoryInfo(rep+"?" 506 551 "action=packages&"+ 507 min_tol_version_cond); 508 IncludeText(pkgInfo) 552 min_tol_version_cond) 509 553 })); 510 554 Real SetIndexByName(_.packSyncInfo); -
tol/stdlib/gui/tcl/_tclutils.tol
r0924759e r9b57f60f 386 386 }, 387 387 { 388 Real If(TolConfigManager::Config::Upgrading::TolPackage::LocalOnly,389 {390 0391 },392 {393 TolPackage::Client::RemoteUpdatePackSyncInfo(True)394 });395 388 WriteLn(I2("Checking if TOL is updated.", 396 389 "Comprobando si TOL está actualizado.")); … … 399 392 FormatDate(Now,"%cy%Ym%md%dh%hi%is%s")+";\n"); 400 393 Text tol_site = "https://www.tol-project.org/wiki/DownloadTol"; 401 Text lastOldStableWin = GetVersionFromTolProject("oldstable"); 402 Text lastOfficialWin = GetVersionFromTolProject("official"); 403 Text lastDevelopmWin = GetVersionFromTolProject("development"); 404 Real ostOK = (Text lastOldStableWin!=""); 405 Real ofcOK = (Text lastOfficialWin!=""); 406 Real devOK = (Text lastDevelopmWin!=""); 394 Text lastOldStableWin =""; 395 Text lastOfficialWin = ""; 396 Text lastDevelopmWin = ""; 397 Real ostOK = False; 398 Real ofcOK = False; 399 Real devOK = False; 400 Real Show(False,"ALL"); 401 Text lastOldStableWin := GetVersionFromTolProject("oldstable"); 402 Real ostOK := (Text lastOldStableWin!=""); 403 If(ostOK, 404 { 405 Text lastOfficialWin := GetVersionFromTolProject("official"); 406 Real ofcOK := (Text lastOfficialWin!=""); 407 If(ofcOK, 408 { 409 Text lastDevelopmWin := GetVersionFromTolProject("development"); 410 Real devOK := (Text lastDevelopmWin!="") 411 }) 412 }); 413 Real Show(True,"ALL"); 407 414 Text msg=""; 415 Real cannot_connect = False; 408 416 Real check = If(Or(!ostOK, !ofcOK, !devOK), 409 417 { 418 Real cannot_connect := True; 410 419 WriteLn(msg:=I2("Cannot check TOL release.", 411 420 "No se pudo chequear la versión de TOL."),"W"); … … 461 470 Real ok = If(check==0, 1, 462 471 { 463 Text doTest = TclTkMessageBox(SetOfSet( 464 @TclArgSt("-title", "Dialogo TclWarning"), 465 @TclArgSt("-message", msg), 466 @TclArgSt("-icon", "warning"))); 472 If(!cannot_connect, 473 Text doTest = TclTkMessageBox(SetOfSet( 474 @TclArgSt("-title", "Dialogo TclWarning"), 475 @TclArgSt("-message", msg), 476 @TclArgSt("-icon", "warning")))); 467 477 0 478 }); 479 //Real If(!check|TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 480 Real If(!check|TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 481 { 482 0 483 }, 484 { 485 TolPackage::Client::RemoteUpdatePackSyncInfo(True) 468 486 }); 469 487 check
Note: See TracChangeset
for help on using the changeset viewer.
