Changeset 837719d in tol
- Timestamp:
- Dec 19, 2011, 6:07:56 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 20da7ad
- Parents:
- 13eebd9
- Location:
- tol/stdlib/general/TolPackage
- Files:
-
- 3 edited
-
client.tol (modified) (6 diffs)
-
common.tol (modified) (1 diff)
-
server.tol (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/general/TolPackage/client.tol
r13eebd9 r837719d 102 102 Real _trace("DoRequirements", "End", 1); 103 103 True 104 }; 105 106 107 ////////////////////////////////////////////////////////////////////////////// 108 Text _.autodoc.member.LocalInfo = 109 "Devuelve la información local disponible acerca de un paquete."; 110 Set LocalInfo(Text name.version) 111 ////////////////////////////////////////////////////////////////////////////// 112 { 113 Text root = TolPackage::Client::_.localRoot+"/"+name.version+"/"; 114 Text info.path=root+"info.oza"; 115 Real If(!OSFilExist(info.path), 116 { 117 Set pkgCnt = Ois.Load(root+name.version+".oza")[1]; 118 TolPackage::PackageInfo.Build(pkgCnt[1], root, UnknownDate) 119 }); 120 Ois.Load(info.path)[1] 104 121 }; 105 122 … … 126 143 Real _trace("LocalLastCompatible", "package='"<<package+"'", 1); 127 144 Set pkgLst = GetDir(TolPackage::Client::_.localRoot)[2]; 128 Text vsi.path = _.localRoot+"/VersSyncInfo.oza";129 Real If(!FileExist(vsi.path), RemoteUpdateVersSyncInfo(false));130 Set vsi = If(!FileExist(vsi.path), Copy(Empty), { Include(vsi.path) });131 145 Set pkgSel = Select(pkgLst,Real(Text pkgNamVer) 132 146 { 133 WriteLn("_trace LocalLastCompatible 2 checking version ="<<pkgNamVer);147 Real _trace("LocalLastCompatible", "checking version ="<<pkgNamVer, 5); 134 148 Real ok1 = TextBeginWith(pkgNamVer, package); 135 149 If(!ok1, False, 136 150 { 137 Real idx = FindIndexByName(vsi, pkgNamVer); 138 If(idx<=0, True, 139 { 140 Real ok2 = And( 141 Compare.VersionString(vsi[idx]->te_min_tol_version,TolPackage::_.currentTolVersion)<=0, 142 Compare.VersionString(vsi[idx]->te_max_tol_version,TolPackage::_.currentTolVersion)>=0); 143 //WriteLn("_trace LocalLastCompatible 3 min="<<vsi[idx]->te_min_tol_version); 144 //WriteLn("_trace LocalLastCompatible 4 cur="<<TolPackage::_.currentTolVersion); 145 //WriteLn("_trace LocalLastCompatible 5 max="<<vsi[idx]->te_max_tol_version); 146 //WriteLn("_trace LocalLastCompatible 6 ok2="<<ok2); 151 Set info = TolPackage::Client::LocalInfo(pkgNamVer); 152 Real ok2 = And( 153 Compare.VersionString(info::_.autodoc.minTolVersion,TolPackage::_.currentTolVersion)<=0, 154 Compare.VersionString(info::_.autodoc.maxTolVersion,TolPackage::_.currentTolVersion)>=0); 147 155 ok2 148 })149 156 }) 150 157 }); … … 198 205 { 199 206 Real _trace("LocalInstallPackage", "Begin", 1); 207 Real _trace("LocalInstallPackage", "pkg.path.zip='"+pkg.path.zip+"'", 5); 200 208 Real OSFilCopy(pkg.path.zip, _.localRoot); 201 209 Text pkg.name.zip = GetFileName(pkg.path.zip); 210 Real _trace("LocalInstallPackage", "pkg.name.zip='"+pkg.name.zip+"'", 5); 202 211 Text pkg.name = Replace(pkg.name.zip,".zip",""); 212 Real _trace("LocalInstallPackage", "pkg.name='"+pkg.name+"'", 5); 213 Real OSDirRemove(_.localRoot+pkg.name); 203 214 Real PackArchive::UnpackFull("ZipArchive",_.localRoot+pkg.name,True); 204 215 Real _trace("LocalInstallPackage", "End", 1); … … 652 663 Date If(found, 653 664 { 654 Date gmt = Copy(NowGmt); 655 Date loc = Copy(Now); 656 Real lag = Round(DateDif(S(0),loc,gmt)/10)*10; 657 Text oza = TolPackage::Client::_.localRoot+pkg+"/"+pkg+".oza"; 658 Date release.loc = FileTime(oza); 659 Date release.gmt = Succ(release.loc,S(0),lag); 660 _.versSyncInfo[found]->dh_release_date_local := release.gmt 665 Set info = LocalInfo(pkg); 666 _.versSyncInfo[found]->dh_release_date_local := info::_.autodoc.releaseDate 661 667 }); 662 668 True … … 703 709 Compare.VersionString(b, a) }); 704 710 Text ver = ord[1]; 705 Date gmt = Copy(NowGmt); 706 Date loc = Copy(Now); 707 Real lag = Round(DateDif(S(0),loc,gmt)/10)*10; 708 Text oza = TolPackage::Client::_.localRoot+ver+"/"+ver+".oza"; 709 Date release.loc = FileTime(oza); 710 Date release.gmt = Succ(release.loc,S(0),lag); 711 Date _.packSyncInfo[found]->co_last_version_local := ver; 712 Date _.packSyncInfo[found]->dh_release_date_local := release.gmt; 711 Set info = LocalInfo(ver); 712 Date _.packSyncInfo[found]->co_last_version_local := 713 pkg+"."<<info::_.autodoc.version.high+"."<<info::_.autodoc.version.low; 714 Date _.packSyncInfo[found]->dh_release_date_local := info::_.autodoc.releaseDate; 713 715 True 714 716 }); … … 717 719 Set _.packForUpdate := Select(_.packSyncInfo, Real(TolPackage::@PackageSynchro pkg) 718 720 { 719 Real need = And(pkg->co_last_version_local != "", 720 pkg->co_last_version_local == pkg->co_last_version_remote, 721 pkg->dh_release_date_local < pkg->dh_release_date_remote); 721 Real _trace("RemoteUpdateVersSyncInfo", "pkg="<<pkg, 5); 722 Real need = Case( 723 pkg->co_last_version_local == "", False, 724 pkg->co_last_version_local != pkg->co_last_version_remote, False, 725 pkg->dh_release_date_local == TheBegin, False, 726 DateDif(S(0),pkg->dh_release_date_remote,pkg->dh_release_date_local) <= 2, False, 727 1==1, True); 728 Real _trace("RemoteUpdateVersSyncInfo", "need="<<need, 5); 722 729 If(And(showWarnings,need), 723 730 { -
tol/stdlib/general/TolPackage/common.tol
r13eebd9 r837719d 120 120 Unique(SetConcat(aux)) 121 121 }) 122 } 122 }; 123 124 ////////////////////////////////////////////////////////////////////////////// 125 Text _.autodoc.member.PackageInfo.Extract = 126 "Extrae la información documental de un paquete."; 127 Set PackageInfo.Extract(NameBlock pkg) 128 ////////////////////////////////////////////////////////////////////////////// 129 { 130 Set info = [[ 131 Text _.autodoc.name = pkg::_.autodoc.name; 132 Text _.autodoc.brief = pkg::_.autodoc.brief; 133 Text _.autodoc.description = pkg::_.autodoc.description; 134 Text _.autodoc.url = pkg::_.autodoc.url; 135 Set _.autodoc.keys = pkg::_.autodoc.keys; 136 Set _.autodoc.authors = pkg::_.autodoc.authors; 137 Text _.autodoc.minTolVersion = pkg::_.autodoc.minTolVersion; 138 Text _.autodoc.maxTolVersion = pkg::_.autodoc.maxTolVersion; 139 Real _.autodoc.version.high = pkg::_.autodoc.version.high; 140 Real _.autodoc.version.low = pkg::_.autodoc.version.low; 141 Date _.autodoc.releaseDate = pkg::_.autodoc.releaseDate; 142 Set _.autodoc.dependencies = pkg::_.autodoc.dependencies; 143 Set _.autodoc.nonTolResources = pkg::_.autodoc.nonTolResources; 144 Text _.autodoc.versionControl = pkg::_.autodoc.versionControl; 145 Text _.autodoc.extra_info = pkg::_.autodoc.extra_info 146 ]]; 147 Real SetIndexByName(info); 148 info 149 }; 150 151 ////////////////////////////////////////////////////////////////////////////// 152 Text _.autodoc.member.PackageInfo.AutoFill = 153 "Rellena automaticamente algunos campos de información documental del " 154 "paquete añadiendo los miembros que falten y cambiando su valor si es " 155 "necesario."; 156 Set PackageInfo.AutoFill(NameBlock pkg, Date releaseDate) 157 ////////////////////////////////////////////////////////////////////////////// 158 { 159 Text name = Name(pkg); 160 Text name.version = name+"."<< 161 pkg::_.autodoc.version.high+"."<<pkg::_.autodoc.version.low; 162 Set dep = TolPackage::GetDeepDependencies(name, True); 163 164 Real If(!ObjectExist("Text", "pkg::_.autodoc.name"), 165 { 166 AddMember(pkg,{Text _.autodoc.name = name }) 167 }, 168 { 169 Text pkg::_.autodoc.name := name; 170 True 171 }); 172 Real If(!ObjectExist("Set", "pkg::_.autodoc.dependencies"), 173 { 174 AddMember(pkg,{Set _.autodoc.dependencies = dep }) 175 }, 176 { 177 Set pkg::_.autodoc.dependencies := dep; 178 True 179 }); 180 Real If(!ObjectExist("Date","pkg::_.autodoc.releaseDate"), 181 { 182 Real AddMember(pkg,{Date _.autodoc.releaseDate = releaseDate}) 183 }, 184 { 185 Date pkg::_.autodoc.releaseDate := releaseDate; 186 True 187 }); 188 Real If(!ObjectExist("Set", "pkg::_.autodoc.authors"), 189 { 190 AddMember(pkg,{Set _.autodoc.authors = Copy(Empty) }) 191 }); 192 Real If(!ObjectExist("Set", "pkg::_.autodoc.keys"), 193 { 194 AddMember(pkg,{Set _.autodoc.keys = Copy(Empty) }) 195 }); 196 Real If(!ObjectExist("Set", "pkg::_.autodoc.nonTolResources"), 197 { 198 AddMember(pkg,{Set _.autodoc.nonTolResources = Copy(Empty) }) 199 }); 200 Real If(!ObjectExist("Text", "pkg::_.autodoc.versionControl"), 201 { 202 AddMember(pkg,{Text _.autodoc.versionControl = "" }) 203 }); 204 Real If(!ObjectExist("Text", "pkg::_.autodoc.maxTolVersion"), 205 { 206 Real AddMember(pkg,{Text _.autodoc.maxTolVersion = "v999999999999999999" }) 207 }); 208 Real If(!ObjectExist("Text", "pkg::_.autodoc.extra_info"), 209 { 210 Real AddMember(pkg,{Text _.autodoc.extra_info = "" }) 211 }); 212 PackageInfo.Extract(pkg) 213 }; 214 215 ////////////////////////////////////////////////////////////////////////////// 216 Text _.autodoc.member.PackageInfo.Build = 217 "Builds the info.oza file with documental information about a loaded " 218 "package."; 219 Real PackageInfo.Build(NameBlock pkg, Text dirPath, Date releaseDate_) 220 ////////////////////////////////////////////////////////////////////////////// 221 { 222 Date releaseDate = Date If(""<<releaseDate_!="Unknown", 223 { 224 releaseDate_ 225 }, 226 { 227 Text name = Name(pkg); 228 Text name.version = name+"."<< 229 pkg::_.autodoc.version.high+"."<<pkg::_.autodoc.version.low; 230 Date gmt = Copy(NowGmt); 231 Date loc = Copy(Now); 232 Real lag = Round(DateDif(S(0),loc,gmt)/10)*10; 233 Text oza = dirPath+name.version+".oza"; 234 Date local = FileTime(oza); 235 Succ(local,S(0),lag) 236 }); 237 Set info = PackageInfo.AutoFill(pkg,releaseDate); 238 Real OSDirMake(dirPath); 239 Real Ois.Store(info,dirPath+"info.oza") 240 }; 241 -
tol/stdlib/general/TolPackage/server.tol
r13eebd9 r837719d 94 94 }) 95 95 }; 96 96 97 97 98 … … 114 115 ////////////////////////////////////////////////////////////////////////////// 115 116 { 117 Date release.gmt = Copy(NowGmt); 116 118 Text _MID = "[BuildPackage] "; 117 119 WriteLn(_MID+sourceRoot+name+" -> "+destination); … … 119 121 sourceRoot+name+"/"+name+".tol\",True)"); 120 122 NameBlock pkg = pkgCnt[1]; 121 Text name.version = TolPackage::GetCurrentNameVersion(name,True); 122 Set dependencies = TolPackage::GetDeepDependencies(name, True); 123 Set nonTolResources=If(!ObjectExist("Set",name+"::_.autodoc.nonTolResources"), 124 Copy(Empty),pkg::_.autodoc.nonTolResources); 125 123 Text name.version = name+"."<< 124 pkg::_.autodoc.version.high+"."<<pkg::_.autodoc.version.low; 126 125 Text ppRoot_ = destination+name.version; 127 126 Text ppRoot = ppRoot_+"/"; 127 Real TolPackage::PackageInfo.Build(pkg,ppRoot,release.gmt); 128 Set nonTolResources = pkg::_.autodoc.nonTolResources; 129 130 Real OSDirMake(ppRoot); 128 131 Real Ois.Store(pkgCnt,ppRoot+name.version+".oza"); 129 Real OSDirMake(ppRoot);130 132 131 133 Real cleanResource(Text dest) … … 143 145 True 144 146 }; 147 145 148 Real processResourceText(Text resource) 146 149 { … … 164 167 Eval("processResource"+gra+"(res)") 165 168 }); 166 Text ppr = ReplaceSlash(ppRoot_); 167 Set dep = TolPackage::GetDeepDependencies(name, True); 168 169 Text ppr = ReplaceSlash(ppRoot_); 169 170 Real PackArchive::PackFull("ZipArchive", ppr, removeDir); 170 171 ppRoot_+".zip" … … 190 191 Text oza = root+pkg.name+"/"+pkg.name+".oza"; 191 192 Set pkgCnt = Include(oza); 192 Date gmt = Copy(NowGmt);193 Date loc = Copy(Now);194 Real lag = Round(DateDif(S(0),loc,gmt)/10)*10;195 Date release.loc = FileTime(oza);196 Date release.gmt = Succ(release.loc,S(0),lag);197 198 193 NameBlock pkg = pkgCnt[1]; 199 194 Text name = Name(pkgCnt[1]); … … 234 229 }, 235 230 { 236 Set dep = TolPackage::GetDeepDependencies(name, True); 237 Set aut = If(!ObjectExist("Set","pkg::_.autodoc.authors"), 238 Copy(Empty), 239 pkg::_.autodoc.authors); 240 Set key = If(!ObjectExist("Set","pkg::_.autodoc.keys"), 241 Copy(Empty), 242 pkg::_.autodoc.keys); 243 Set res = If(!ObjectExist("Set","pkg::_.autodoc.nonTolResources"), 244 Copy(Empty), 245 pkg::_.autodoc.nonTolResources); 246 Text verCnt = If(!ObjectExist("Text","pkg::_.autodoc.versionControl"),"", 247 ReplaceTable(pkg::_.autodoc.versionControl,[[ 231 Set dep = pkg::_.autodoc.dependencies; 232 Set aut = pkg::_.autodoc.authors; 233 Set key = pkg::_.autodoc.keys; 234 Set res = pkg::_.autodoc.nonTolResources; 235 Text verCnt = ReplaceTable(pkg::_.autodoc.versionControl,[[ 248 236 [["\n","<BR>"]], 249 237 [["'","\""]] , 250 [[";",","]] ]]) );238 [[";",","]] ]]); 251 239 Text bl_contents = EncodeBase64FromFile(pkg.path.zip); 252 240 Real nu_bytes = FileBytes(pkg.path.zip); 253 241 Real id_format = 1; 254 Text te_max_tol_version = "v999999999999999999";242 Text te_max_tol_version = pkg::_.autodoc.maxTolVersion; 255 243 Text te_extra_info = ""; 256 Text If(ObjectExist("Text", "pkg::_.autodoc.maxTolVersion"),257 te_max_tol_version := pkg::_.autodoc.maxTolVersion);258 244 //Text exist.query = 259 245 Text insert.query = " … … 274 260 "'"<<TolPackage::Server::SqlFormatSetOfText(pkg::_.autodoc.authors)+"', \n"+ 275 261 "'"<<pkg::_.autodoc.minTolVersion+"', \n"+ 276 "'"<<FormatDate( release.gmt,"%c%Y-%m-%d %h:%i:%s")+"', \n"+262 "'"<<FormatDate(pkg::_.autodoc.releaseDate,"%c%Y-%m-%d %h:%i:%s")+"', \n"+ 277 263 "'"<<TolPackage::Server::SqlFormatSetOfText(dep)+"', \n"+ 278 264 "'"<<TolPackage::Server::FormatSet(res)+"', \n"+
Note: See TracChangeset
for help on using the changeset viewer.
