Changeset efe6202 in tol
- Timestamp:
- Jun 16, 2010, 7:03:19 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 77d8a87
- Parents:
- d1b9c9c2
- Location:
- tol/stdlib/general/TolPackage
- Files:
-
- 3 edited
-
client.tol (modified) (1 diff)
-
common.tol (modified) (1 diff)
-
repository.tol (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/general/TolPackage/client.tol
rd1b9c9c2 refe6202 84 84 "Busca un paquete entre todos los repositorios consultables y si lo " 85 85 "encuentra lo instala."; 86 Real FindAndInstall(Text remote.repository )86 Real FindAndInstall(Text remote.repository, Real showError) 87 87 ////////////////////////////////////////////////////////////////////////////// 88 88 { 89 @Repository::FindAndInstall(remote.repository) 89 //WriteLn("TRACE Client::FindAndInstall(\""+remote.repository+"\","<<showError+")"); 90 @Repository::FindAndInstall(remote.repository, showError) 90 91 }; 91 92 -
tol/stdlib/general/TolPackage/common.tol
rd1b9c9c2 refe6202 19 19 Set authors, 20 20 Text minTolVersion, 21 TextreleaseDate,21 Date releaseDate, 22 22 Set dependencies 23 23 }; -
tol/stdlib/general/TolPackage/repository.tol
rd1b9c9c2 refe6202 55 55 "Loading list of available repositories from "+file); 56 56 NameBlock @Repository::Get( 57 "http://packages.tol-project.org/ tol_pkg/", False);57 "http://packages.tol-project.org/OfficialTolArchiveNetwork/", False); 58 58 Real If(FileExist(file), 59 59 { … … 96 96 "//This repository is very recommendable. Please don't remove next line\n" 97 97 "//Type: Public\n" 98 " http://packages.tol-project.org/ tol_pkg/\n"98 " http://packages.tol-project.org/OfficialTolArchiveNetwork/\n" 99 99 "\n"); 100 100 Set EvalSet(_.instances,Real(@Repository r) 101 101 { 102 Text If(r::_.url != "http://packages.tol-project.org/ tol_pkg/",102 Text If(r::_.url != "http://packages.tol-project.org/OfficialTolArchiveNetwork/", 103 103 { 104 104 AppendFile(file, … … 124 124 ////////////////////////////////////////////////////////////////////////////// 125 125 { 126 //WriteLn("TRACE @Repository::Get(\""+url+"\","<<connect+")"); 126 127 Real pos = FindIndexByName(@Repository::_.instances, ToName(url)); 128 //WriteLn("TRACE @Repository::Get 1 pos="<<pos); 127 129 If(pos, 128 130 { 131 //WriteLn("TRACE @Repository::Get 2"); 129 132 Real If(connect, (_.instances[pos])::Connect(0)); 130 133 _.instances[pos] 131 134 }, 132 135 { 136 //WriteLn("TRACE @Repository::Get 3"); 133 137 @Repository::Open(url, connect) 134 138 }) … … 180 184 If(!_.isRemote, 181 185 { 182 OSFilCopy(_.address+"packages/"+pa th,localPath)186 OSFilCopy(_.address+"packages/"+packageName+".oza",localPath) 183 187 }, 184 188 { 185 189 //Hay que buscar una forma de copiar remoto sin wget, con el TCL 186 190 OSCmdWait("wget -O\""+localPath+"\" \""+ 187 _.url+"packages/"+pa th+"\"")191 _.url+"packages/"+packageName+".oza\"") 188 192 }); 189 193 FileExist(localPath) … … 197 201 If(Not(IsUnknown(_.connected)), _.connected, 198 202 { 203 WriteLn("[TolPackage::Client::@Repository::Connect] " 204 "Trying to conect to repository "+_.url+" ..."); 199 205 Real numErr0 = Copy(NError); 200 206 Set repInf = IncludeText(GetFileContens("index.tol")); … … 204 210 Text aux = GetFileContens("index.csv"); 205 211 Set line = Tokenizer(aux,"\n"); 206 Set pckInf = For(2,Card(line), @PackageInfo(Real k) 212 213 Set cells.all = For(2,Card(line), Set(Real k) 207 214 { 208 Set fields = Tokenizer(line[k],";","\"","\\"); 209 Set aux = { [[ @PackageInfo( 210 Text repository = url, 211 Text name = fields[1], 212 Real version.high = Eval(fields[2]), 213 Real version.low = Eval(fields[3]), 214 Real name.version = Eval(fields[4]), 215 Text brief = fields[5], 216 Set keys = Eval(fields[6]), 217 Set authors = Eval(fields[7]), 218 Text minTolVersion = fields[8], 219 Text releaseDate = fields[9], 220 Set dependencies = Eval(fields[10]) 215 //WriteLn("TRACE Connect line["<<k+"] = '"<<line[k]+"'"); 216 Set fields = Tokenizer(line[k],";"); 217 //WriteLn("TRACE Connect Card(fields) = "<<Card(fields)); 218 fields 219 }); 220 Set cells = Select(cells.all, Real(Set s) { Card(s)==11 }); 221 Set pckInf = For(1,Card(cells), TolPackage::@PackageInfo(Real k) 222 { 223 Set fields = cells[k]; 224 Set aux = { [[ TolPackage::@PackageInfo( 225 Text repository = fields[1], 226 Text name = fields[2], 227 Text name.version = fields[3], 228 Real version.high = Eval(fields[4]), 229 Real version.low = Eval(fields[5]), 230 Text brief = fields[6], 231 Set keys = Eval(fields[7]), 232 Set authors = Eval(fields[8]), 233 Text minTolVersion = fields[9], 234 Date releaseDate = Eval(fields[10]), 235 Set dependencies = Eval(fields[11]) 221 236 ) ]] }; 222 237 Set PutName(aux[1]->name.version,aux[1]); 223 238 aux[1] 224 239 }); 225 Set _.index := Sort(pckInf,Real(@PackageInfo a, @PackageInfo b) 240 241 Set _.index := Sort(pckInf,Real(TolPackage::@PackageInfo a, TolPackage::@PackageInfo b) 226 242 { 227 243 Compare(b->name.version, a->name.version) … … 229 245 Real SetIndexByName(_.index); 230 246 Set Append(_.allPackages,_.index, True); 231 Set _.allPackages := Sort(_.allPackages,Real( @PackageInfo a,@PackageInfo b)247 Set _.allPackages := Sort(_.allPackages,Real(TolPackage::@PackageInfo a, TolPackage::@PackageInfo b) 232 248 { 233 249 Compare(b->name.version, a->name.version) 234 250 }); 235 251 Real numErr1 = Copy(NError); 236 _.connected := And(numErr1==numErr0,Card(_.index)) 252 Real _.connected := And(numErr1==numErr0,Card(_.index)); 253 If(_.connected, WriteLn(" ... Connected!"), 254 WriteLn(" ... NOT Connected!","W")); 255 _.connected 237 256 }) 238 257 }; … … 274 293 ////////////////////////////////////////////////////////////////////////////// 275 294 { 295 WriteLn("[TolPackage::Client::@Repository::Install] " 296 "Trying to download package from "+_.url+package.version); 276 297 Real DownloadPackage(package.version); 277 298 Real ok = FileExist(TolPackage::Client::_.localRoot+package.version); … … 291 312 ////////////////////////////////////////////////////////////////////////////// 292 313 { 293 SetMin(EvalSet(_.index, Real( @PackageInfo pi)314 SetMin(EvalSet(_.index, Real(TolPackage::@PackageInfo pi) 294 315 { 295 316 DownloadPackage(pi->name.version) … … 305 326 ////////////////////////////////////////////////////////////////////////////// 306 327 { 328 Set EvalSet(_.instances,Real(@Repository r) 329 { 330 If(!IsUnknown(r::_.connected), False, r::Connect(0)) 331 }); 307 332 Real pos = FindIndexByName(_.allPackages,package.version); 308 If(pos<=0, Copy(Empty), _.allPackages[pos]) 333 Set found = If(pos<=0, Copy(Empty), _.allPackages[pos]); 334 found 309 335 }; 310 336 … … 316 342 ////////////////////////////////////////////////////////////////////////////// 317 343 { 318 Set pkgInf = @Repository::Find(_.allPackages,package.version); 344 //WriteLn("TRACE @Repository::FindAndInstall(\""+remote.repository+"\","<<showError+")"); 345 Set pkgInf = @Repository::Find(package.version); 346 //WriteLn("TRACE @Repository::FindAndInstall 1 Card(pkgInf)="<<Card(pkgInf)); 319 347 Case( 320 pos>0,348 Card(pkgInf)>0, 321 349 { 350 //WriteLn("TRACE @Repository::FindAndInstall 2"); 322 351 @Repository r = @Repository::Get(pkgInf->repository, True); 323 r::Install(pkgInf->name )352 r::Install(pkgInf->name, showError) 324 353 }, 325 354 showError, 326 355 { 356 //WriteLn("TRACE @Repository::FindAndInstall 3"); 327 357 WriteLn("[TolPackage::FindAndInstall] " 328 358 "Cannot find package "+package.version+" in available repositories","E"); … … 331 361 1==1, 332 362 { 363 //WriteLn("TRACE @Repository::FindAndInstall 4"); 333 364 False 334 365 }) … … 371 402 ////////////////////////////////////////////////////////////////////////////// 372 403 { 373 SetSum(EvalSet(_.index, Real( @PackageInfo pi)404 SetSum(EvalSet(_.index, Real(TolPackage::@PackageInfo pi) 374 405 { 375 406 Upgrade(pi->name.version, caducityInDays)
Note: See TracChangeset
for help on using the changeset viewer.
