Changeset 3a14843 in tol
- Timestamp:
- Oct 18, 2010, 3:35:35 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 33ff7ee
- Parents:
- ace5023
- Location:
- tol/stdlib
- Files:
-
- 3 edited
-
general/TolPackage/client.tol (modified) (6 diffs)
-
general/TolPackage/common.tol (modified) (3 diffs)
-
gui/tcl/_tclutils.tol (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/general/TolPackage/client.tol
race5023 r3a14843 15 15 Replace(TolAppDataPath+"TolPackage/Client/","\\","/"); 16 16 17 Set _.syncInfo = Copy(Empty); 17 Set _.versSyncInfo = Copy(Empty); 18 Set _.packSyncInfo = Copy(Empty); 19 Set _.packForUpdate = Copy(Empty); 20 Set _.packForUpgrade = Copy(Empty); 21 Set _.packForInstall = Copy(Empty); 22 Set _.packInstalled = Copy(Empty); 18 23 19 24 Text min_tol_version_cond = … … 283 288 If(!FileExist(localPack), False, 284 289 { 285 //WriteLn("TRACE DownloadPackage UnpackFull("<<localDir+")");290 //WriteLn("TRACE DownloadPackage 4 UnpackFull("<<localDir+")"); 286 291 Real PackArchive::UnpackFull("ZipArchive", localDir); 287 292 Real OSFilRemove(localPack); 288 293 True 289 294 }); 295 //WriteLn("TRACE DownloadPackage 5"); 290 296 FileExist(localOza) 291 297 })}; … … 375 381 376 382 ////////////////////////////////////////////////////////////////////////////// 377 Text _.autodoc.member.RemoteUpdateSyncInfo = 378 "Actualiza la información necesaria para la sincronización de paquetes " 379 "locales con el repositorio remoto para aquellos que son compatibles con " 380 "la versión actual de TOL.\n" 381 "Devuelve el número de paquetes compatibles disponibles de forma remota."; 382 Real RemoteUpdateSyncInfo(Real void) 383 Text _.autodoc.member.RemoteUpdateVersSyncInfo = 384 "Actualiza la información necesaria para la sincronización de versiones de " 385 "paquetes locales con el repositorio remoto para aquellos que son " 386 "compatibles con la versión actual de TOL.\n" 387 "Devuelve el número de versiones de paquetes compatibles disponibles de " 388 "forma remota."; 389 Real RemoteUpdateVersSyncInfo(Real void) 383 390 ////////////////////////////////////////////////////////////////////////////// 384 391 { … … 386 393 Set repositories = 387 394 TolConfigManager::Config::Upgrading::TolPackage::Repositories; 388 Set _. syncInfo := SetConcat(EvalSet(repositories,Set(Text rep)395 Set _.versSyncInfo := SetConcat(EvalSet(repositories,Set(Text rep) 389 396 { 390 397 Text pkgInfo = GetUrlContents(rep+"?" … … 393 400 IncludeText(pkgInfo) 394 401 })); 395 Real SetIndexByName(_. syncInfo);402 Real SetIndexByName(_.versSyncInfo); 396 403 Set pkgLst = GetDir(TolPackage::Client::_.localRoot)[2]; 397 404 Set EvalSet(pkgLst, Real(Text pkg) 398 405 { 399 Real found = FindIndexByName(_. syncInfo, pkg);400 Date If(!found, WriteLn("[RemoteUpdate SyncInfo] "+I2(406 Real found = FindIndexByName(_.versSyncInfo, pkg); 407 Date If(!found, WriteLn("[RemoteUpdateVersSyncInfo] "+I2( 401 408 "Cannot find remote image of local package "+pkg+ 402 409 " in any repository." , … … 410 417 Date release.loc = FileTime(oza); 411 418 Date release.gmt = Succ(release.loc,S(0),lag); 412 _. syncInfo[found]->dh_release_date_local := release.gmt419 _.versSyncInfo[found]->dh_release_date_local := release.gmt 413 420 }); 414 421 True 415 422 }); 416 Card(_.syncInfo) 417 })}; 418 423 Card(_.versSyncInfo) 424 })}; 425 426 ////////////////////////////////////////////////////////////////////////////// 427 Text _.autodoc.member.RemoteUpdatePackSyncInfo = 428 "Actualiza la información necesaria para la sincronización de paquetes " 429 "locales con el repositorio remoto para aquellos que son " 430 "compatibles con la versión actual de TOL.\n" 431 "Devuelve el número de paquetes compatibles disponibles de forma remota."; 432 Real RemoteUpdatePackSyncInfo(Real showWarnings) 433 ////////////////////////////////////////////////////////////////////////////// 434 { 435 Text _MID = "TolPackage::Client::[RemoteUpdatePackSyncInfo]\n"; 436 If(TolConfigManager::Config::Upgrading::TolPackage::LocalOnly, 0, { 437 Set repositories = 438 TolConfigManager::Config::Upgrading::TolPackage::Repositories; 439 Set _.packSyncInfo := SetConcat(EvalSet(repositories,Set(Text rep) 440 { 441 Text pkgInfo = GetUrlContents(rep+"?" 442 "action=packages&"+ 443 min_tol_version_cond); 444 IncludeText(pkgInfo) 445 })); 446 Real SetIndexByName(_.packSyncInfo); 447 Set verLst = GetDir(TolPackage::Client::_.localRoot)[2]; 448 Set verCls = Classify(verLst,Real(Text a, Text b) 449 { 450 Compare(Tokenizer(a,".")[1], Tokenizer(b,".")[1]) 451 }); 452 Set EvalSet(verCls, Real(Set cls) 453 { 454 Text pkg = Tokenizer(cls[1],".")[1]; 455 Real found = FindIndexByName(_.packSyncInfo, pkg); 456 Date If(And(!found,showWarnings), WriteLn(_MID+I2( 457 "Cannot find remote image of local package "+pkg+ 458 " in any repository." , 459 "No se encuentra la imagen remota del paquete local "+pkg+ 460 " en ningún repositorio"),"W"), 461 { 462 Set ord = Sort(cls,Real(Text a, Text b) { Compare(b, a) }); 463 Text ver = ord[1]; 464 Date gmt = Copy(NowGmt); 465 Date loc = Copy(Now); 466 Real lag = Round(DateDif(S(0),loc,gmt)/10)*10; 467 Text oza = TolPackage::Client::_.localRoot+ver+"/"+ver+".oza"; 468 Date release.loc = FileTime(oza); 469 Date release.gmt = Succ(release.loc,S(0),lag); 470 _.packSyncInfo[found]->co_last_version_local := ver; 471 _.packSyncInfo[found]->dh_release_date_local := release.gmt 472 }); 473 True 474 }); 475 Set _.packForUpdate := Select(_.packSyncInfo, Real(TolPackage::@PackageSynchro pkg) 476 { 477 And(pkg->co_last_version_local != "", 478 pkg->co_last_version_local == pkg->co_last_version_remote, 479 pkg->dh_release_date_local < pkg->dh_release_date_remote) 480 }); 481 If(And(showWarnings,Card(_.packForUpdate)), 482 { 483 WriteLn(_MID+"There are "<<Card(_.packForUpdate)+" packages that you can update " 484 "from remote repositories to new releases of the same version.\n" 485 "You can view them at:\n " 486 " Set TolPackage::Client::_.packForUpdate\n" 487 "You can update all them running this TOL sentence: \n" 488 " Set TolPackage::Client::RemoteUpdateAll(0)\n", 489 "W") 490 }); 491 Set _.packForUpgrade := Select(_.packSyncInfo, Real(TolPackage::@PackageSynchro pkg) 492 { 493 And(pkg->co_last_version_local != "", 494 pkg->co_last_version_local < pkg->co_last_version_remote) 495 }); 496 If(And(showWarnings,Card(_.packForUpgrade)), 497 { 498 WriteLn(_MID+"There are "<<Card(_.packForUpgrade)+" packages that you can upgrade " 499 "from remote repositories to new versions.\n" 500 "You can view them at:\n " 501 " Set TolPackage::Client::_.packForUpgrade\n" 502 "You can upgrade all them running this TOL sentence: \n" 503 " Set TolPackage::Client::RemoteUpgradeAll(0)\n", 504 "W") 505 }); 506 Set _.packForInstall := Select(_.packSyncInfo, Real(TolPackage::@PackageSynchro pkg) 507 { 508 pkg->co_last_version_local == "" 509 }); 510 Set _.packInstalled := Select(_.packSyncInfo, Real(TolPackage::@PackageSynchro pkg) 511 { 512 pkg->co_last_version_local != "" 513 }); 514 Card(_.packSyncInfo) 515 })}; 516 517 518 ////////////////////////////////////////////////////////////////////////////// 519 Text _.autodoc.member.RemoteUpdateAll = 520 "Actualiza automáticamente todos los paquetes disponibles desde los " 521 "repositorios remotos para los que la copia local haya caducado.\n"; 522 Real RemoteUpdateAll(Real updateSyncInfo) 523 ////////////////////////////////////////////////////////////////////////////// 524 { 525 Real If(Or(updateSyncInfo,Card(_.packSyncInfo)), 526 RemoteUpdatePackSyncInfo(False)); 527 If(!Card(_.packForUpdate), 0, 528 SetSum(EvalSet(_.packForUpdate, Real(TolPackage::@PackageSynchro pkg) 529 { 530 RemoteInstallPackage(pkg->te_url, pkg->co_last_version_remote, True) 531 }))) 532 }; 419 533 420 534 ////////////////////////////////////////////////////////////////////////////// 421 535 Text _.autodoc.member.RemoteUpgradeAll = 422 "Actualiza automáticamente todos los paquetes disponibles en los " 423 "repositorios remotos para los que la copia local haya caducado.\n"; 424 Real RemoteUpgradeAll(Real caducityInMinutes) 425 ////////////////////////////////////////////////////////////////////////////// 426 { 427 //Real RemoteUpdateSyncInfo(0); 428 //Set outOfdate 429 False 536 "Actualiza automáticamente todos los paquetes disponibles desde los " 537 "repositorios remotos para los que exista una versión más moderna.\n"; 538 Real RemoteUpgradeAll(Real updateSyncInfo) 539 ////////////////////////////////////////////////////////////////////////////// 540 { 541 Real If(Or(updateSyncInfo,Card(_.packSyncInfo)), 542 RemoteUpdatePackSyncInfo(False)); 543 If(!Card(_.packForUpgrade), 0, 544 SetSum(EvalSet(_.packForUpgrade, Real(TolPackage::@PackageSynchro pkg) 545 { 546 RemoteInstallPackage(pkg->te_url, pkg->co_last_version_remote, True) 547 }))) 430 548 } 431 549 -
tol/stdlib/general/TolPackage/common.tol
race5023 r3a14843 9 9 //Información de un paquete que es relevante para la sincronización de las 10 10 //copias locales con el repositorio remoto. 11 Struct @ PackageSynchro {11 Struct @VersionSynchro { 12 12 ////////////////////////////////////////////////////////////////////////////// 13 13 Text te_url, //URL of repository … … 16 16 Text te_min_tol_version, //Required TOL version 17 17 Text te_dependencies, //Required packages 18 Date dh_release_date_remote, //Publication date in remote repository 19 Date dh_release_date_local //Local installing date 20 }; 21 22 ////////////////////////////////////////////////////////////////////////////// 23 //Información de un paquete que es relevante para la sincronización de las 24 //copias locales con el repositorio remoto. 25 Struct @PackageSynchro { 26 ////////////////////////////////////////////////////////////////////////////// 27 Text te_url, //URL of repository 28 Text co_name, //Generic name of package 29 Text te_brief, //Brief description of package 30 Text te_min_tol_version, //Required TOL version 31 Text co_last_version_remote, //Name of last remote version 32 Text co_last_version_local, //Name of last local version 18 33 Date dh_release_date_remote, //Publication date in remote repository 19 34 Date dh_release_date_local //Local installing date … … 73 88 Unique(SetConcat(aux)) 74 89 }) 75 } ;90 } -
tol/stdlib/gui/tcl/_tclutils.tol
race5023 r3a14843 391 391 }, 392 392 { 393 TolPackage::Client::RemoteUpgradeAll( 394 TolConfigManager::Config::Upgrading::TolPackage::CaducityInMinutes) 393 TolPackage::Client::RemoteUpdatePackSyncInfo(True) 395 394 }); 396 395 WriteLn(I2("Checking if TOL is updated.",
Note: See TracChangeset
for help on using the changeset viewer.
