Changeset 49c2acc in tol
- Timestamp:
- Jun 15, 2010, 4:03:52 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 17c3d11
- Parents:
- bcb9e10
- Location:
- tol/stdlib/general/TolPackage
- Files:
-
- 2 edited
-
repository.tol (modified) (12 diffs)
-
server.tol (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/general/TolPackage/repository.tol
rbcb9e10 r49c2acc 14 14 Real version.high, 15 15 Real version.low, 16 Text description,16 Text brief, 17 17 Set keys, 18 18 Set authors, … … 30 30 //facilitar proceso de instalación cerrada. Para ello la URL comenzará por 31 31 //file:// seguido del path local donde se ubica el repositorio.\n 32 //Si la URL empieza por http:// https:// ftp://o cualquier otro protocolo32 //Si la URL empieza por http:// https:// o cualquier otro protocolo 33 33 //reconocible por el sistema operativo se realizará la correspondiente 34 34 //descarga remota. 35 35 Text _.url; 36 36 37 //Protocolo de acceso al repositorio file://, http://, https://, ftp:// 38 Text _.protocol =""; 37 //Nombre oficial del repositorio; 38 Text _.name = ""; 39 //Tipo del repositorio : "Private" ó "Public"; 40 Text _.type = ""; 41 //Descripción del repositorio; 42 Text _.description = ""; 43 //Protocolo de acceso al repositorio file://, http://, ... 44 Text _.protocol = ""; 39 45 //Resto de la URL tras el protocolo 40 46 Text _.address = ""; … … 42 48 Real _.isRemote = ?; 43 49 //Archivo del estado actual de los paquetes del repositorio 44 Set _. status= Copy(Empty);50 Set _.index = Copy(Empty); 45 51 //Resultado de la conexión al repositorio remoto 46 52 Real _.connected = ?; … … 131 137 { 132 138 Real numErr0 = Copy(NError); 133 Text aux = GetFileContens("packages.csv"); 139 Set repInf = IncludeText(GetFileContens("index.tol")); 140 Text _.name := repInf::name; 141 Text _.type := repInf::type; 142 Text _.description := repInf::description; 143 Text aux = GetFileContens("index.csv"); 134 144 Set line = Tokenizer(aux,"\n"); 135 145 Set pckInf = For(2,Card(line), @PackageInfo(Real k) … … 142 152 Real version.low = Eval(fields[3]), 143 153 Real name.version = Eval(fields[4]), 144 Text description= fields[5],154 Text brief = fields[5], 145 155 Set keys = Eval(fields[6]), 146 156 Set authors = Eval(fields[7]), … … 152 162 aux[1] 153 163 }); 154 Set _. status:= Sort(pckInf,Real(@PackageInfo a, @PackageInfo b)164 Set _.index := Sort(pckInf,Real(@PackageInfo a, @PackageInfo b) 155 165 { 156 166 Compare(b->name.version, a->name.version) 157 167 }); 158 Real SetIndexByName(_. status);159 Set Append(_.allPackages,_. status, True);168 Real SetIndexByName(_.index); 169 Set Append(_.allPackages,_.index, True); 160 170 Set _.allPackages := Sort(_.allPackages,Real(@PackageInfo a, @PackageInfo b) 161 171 { … … 163 173 }); 164 174 Real numErr1 = Copy(NError); 165 _.connected := And(numErr1==numErr0,Card(_. status))175 _.connected := And(numErr1==numErr0,Card(_.index)) 166 176 }) 167 177 }; … … 173 183 ////////////////////////////////////////////////////////////////////////////// 174 184 { 175 Real pos = FindIndexByName(_. status,package);185 Real pos = FindIndexByName(_.index,package); 176 186 pos > 0 177 187 }; … … 220 230 ////////////////////////////////////////////////////////////////////////////// 221 231 { 222 SetMin(EvalSet(_. status, Real(@PackageInfo pi)232 SetMin(EvalSet(_.index, Real(@PackageInfo pi) 223 233 { 224 234 DownloadFile(pi->name.version) … … 233 243 ////////////////////////////////////////////////////////////////////////////// 234 244 { 235 Real pos = FindIndexByName(_. status,package);245 Real pos = FindIndexByName(_.index,package); 236 246 If(!pos, TheBegin, 237 247 { 238 _. status[pos]->lastDate248 _.index[pos]->lastDate 239 249 }) 240 250 }; … … 261 271 ////////////////////////////////////////////////////////////////////////////// 262 272 { 263 SetSum(EvalSet(_. status, Real(@PackageInfo pi)273 SetSum(EvalSet(_.index, Real(@PackageInfo pi) 264 274 { 265 275 Upgrade(pi->name.version, caducityInDays) … … 293 303 ////////////////////////////////////////////////////////////////////////////// 294 304 { 295 Real pos = FindIndexByName(_. status,package.version),305 Real pos = FindIndexByName(_.index,package.version), 296 306 If(!pos, False, 297 307 { 298 TolPackage::DoRequirements(_. status[pos]->dependencies)308 TolPackage::DoRequirements(_.index[pos]->dependencies) 299 309 }) 300 310 } -
tol/stdlib/general/TolPackage/server.tol
rbcb9e10 r49c2acc 13 13 paquetes, es decir, si A requiere a B directa o indirectamente B no puede 14 14 requerir a A ni directa ni indirectamente. 15 * Debe haber un comité o alguien responsable de probar todos los paquetes de 16 un repositorio antes de publicar las actualizaciones de los paquetes para 17 asegurar la compatibilidad conjunta de todos ellos. 15 18 16 19 */ … … 26 29 27 30 ////////////////////////////////////////////////////////////////////////////// 28 Real ResetPackageInfo(Text file, NameBlock pkg) 31 Real ResetRepository( 32 Text root, //Local server-side installing directory 33 Text url, //A unique address with remote or local protocol 34 Text name, //A unique name 35 Text type, //Private, Public 36 Text description) //Purpose of repository 29 37 ////////////////////////////////////////////////////////////////////////////// 30 38 { 31 Text in fo=39 Text index.csv = 32 40 "repository;"+ 33 41 "name;"+ … … 35 43 "version.high;"+ 36 44 "version.low;"+ 37 " description;"+45 "brief;"+ 38 46 "keys;"+ 39 47 "authors;"+ … … 41 49 "releaseDate;"+ 42 50 "dependencies;\n"; 43 Text WriteFile(file, info); 51 52 Text index.tol = 53 "//////////////////////////////////////////////////////////////////////////////\n" 54 "//FILE : index.tol \n" 55 "//PURPOSE : internal use of Class TolPackage::@Repository \n" 56 "// \n" 57 "// PLEASE, DON'T TOUCH THIS FILE NOR OTHER ONE IN THIS DIRECTORY! \n" 58 "// \n" 59 "//////////////////////////////////////////////////////////////////////////////\n" 60 " Text name = \""+name+"\";\n"+ 61 " Text type = \""+type+"\";\n"+ 62 " Text description = \""+description+"\";\n"+ 63 "\n"; 64 65 Text WriteFile(root+"index.csv", index.csv); 66 Text WriteFile(root+"index.tol", index.tol); 67 //Text WriteFile(root+"index.wiki", index.wiki); 68 //Text WriteFile(root+"index.html", index.html); 44 69 True 45 70 }; … … 69 94 ////////////////////////////////////////////////////////////////////////////// 70 95 Real AddPackageInfo.Version( 71 Text statusFile,96 Text root, 72 97 NameBlock pkg, 73 98 Real specificVersion) … … 77 102 Text name.version = GetNameVersion(pkg); 78 103 Set dependencies = GetDeepDependencies(name); 79 Text in fo=104 Text index.csv = 80 105 pkg:: _.autodoc.url + ";" 81 106 <<name + ";" … … 83 108 <<If(!specificVersion,?,pkg::_.autodoc.version.high) + ";" 84 109 <<If(!specificVersion,?,pkg::_.autodoc.version.low) + ";" 85 <<pkg::ScapeField(_.autodoc. description) + ";"110 <<pkg::ScapeField(_.autodoc.brief) + ";" 86 111 <<pkg::ScapeField(_.autodoc.keys) + ";" 87 112 <<pkg::ScapeField(_.autodoc.authors) + ";" … … 89 114 <<Now + ";" 90 115 <<dependencies+ "\n"; 91 Text AppendFile(statusFile, info); 116 Text AppendFile(root+"index.csv", index.csv); 117 //Text AppendFile(root+"index.wiki", index.wiki); 118 //Text AppendFile(root+"index.html", index.html); 92 119 True 93 120 }; 94 121 122 123 95 124 ////////////////////////////////////////////////////////////////////////////// 96 Real AddPackage Info(Text statusFile, NameBlock pkg)125 Real AddPackage(Text root, NameBlock pkg) 97 126 ////////////////////////////////////////////////////////////////////////////// 98 127 { 99 Real AddPackageInfo.Version( statusFile,pkg,True);100 Real AddPackageInfo.Version( statusFile,pkg,False)128 Real AddPackageInfo.Version(root,pkg,True); 129 Real AddPackageInfo.Version(root,pkg,False) 101 130 }; 102 131
Note: See TracChangeset
for help on using the changeset viewer.
