<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 5:59 PM, Chris Muller <span dir="ltr"><<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, I'm sure it would help to understand the broader context of why<br>
the .mcd doesn't meet your needs. I assume you must have some<br>
external (non-Smalltalk) tool unzipping the mcz to get at the<br>
contents? Because if you were only accessing via the MCRepository<br>
API's then mcd shouldn't matter.<br></blockquote><div><br></div><div> The Spur bootstrap depends on being able to generate patched files. I could, had I known the syetem better, have produced those patches as mcd's, but have produced them as .mczs. IMO mcd is a premature optimization, saving a littel bit</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think you're on the right track with the<br>
<span class=""><br>
cacheRepo storeVersion: (repo versionNamed: versionName).<br>
<br>
</span>approach, because that lets the Repository "do its job" the way it<br>
wants or needs to, able to assume its users would only care about the<br>
objects returned, not its private, internal storage format.<br></blockquote><div><br></div><div>There really should be an "If I say store a version I mean it" API that means that diffy versions can be stored. It's a PITA not having this.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
There is a 'alwaysStoreDiffs' option for every Repository, so it might<br>
help to make sure that's turned off on your CacheRepository. But I<br>
know that's not what you want if the incoming is _already_ a mcd,<br>
because you want a 'alwaysStoreFull', but I'm not sure why..<br></blockquote><div><br></div><div>Um, the cache repository's value is indeed false (actually nil, which defaults to false). But the storeVersion code doesn't pay attention to that flag.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Oct 8, 2014 at 7:37 PM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br>
> OK here's what I came up with, and it's not pretty. But it is useful.<br>
> Should this be included in MCCacheRepository or MCFileBasedRepository as a<br>
> general facility? IMO, yes, to have some poor soul going down this same<br>
> route. But I want to canvas opinion first. Nte that one wpould think all<br>
> one had to do was<br>
><br>
> cacheRepo storeVersion: (repo versionNamed: versionName).<br>
><br>
> but MCCacheRepository defeats that simple route with<br>
><br>
> MCCacheRepository >>basicStoreVersion: aVersion<br>
> (aVersion isCacheable not or: [self allFileNames includes: aVersion<br>
> fileName])<br>
> ifFalse: [super basicStoreVersion: aVersion]<br>
><br>
> So that leaves the brute-force:<br>
><br>
> cachedNonDiffyVersionNamed: versionName from: repo<br>
> "Make sure that the cache contains a non-diffy version of versionName and<br>
> answer it."<br>
> | cacheRepo |<br>
> self assert: (versionName endsWith: '.mcz').<br>
> cacheRepo := MCCacheRepository default.<br>
> "Make sure that at least the diffy (.mcd) version is present"<br>
> (cacheRepo directory includesKey: versionName) ifFalse:<br>
> [cacheRepo storeVersion: (repo versionNamed: versionName)].<br>
> "if after storeVersion there's still no .mcz we need to create one; sigh..."<br>
> (cacheRepo directory includesKey: versionName) ifFalse:<br>
> [| baseName diffyVersionName diffyVersion file delete |<br>
> baseName := versionName allButLast: 4. "strip .mcz"<br>
> diffyVersionName := cacheRepo directory fileNames detect: [:fn| (fn<br>
> endsWith: '.mcd') and: [(fn copyUpTo: $() = baseName]].<br>
> diffyVersion := cacheRepo versionNamed: diffyVersionName.<br>
> file := cacheRepo directory newFileNamed: versionName.<br>
> delete := false.<br>
> [file binary.<br>
> [MCMczWriter fileOut: diffyVersion on: file]<br>
> on: Error<br>
> do: [:ex|<br>
> delete := true. "don't leave half-formed .mcz files around to screw things<br>
> up later on..."<br>
> ex pass]]<br>
> ensure:<br>
> [file close.<br>
> delete ifTrue:<br>
> [cacheRepo directory deleteFileNamed: versionName]].<br>
> "now delete the damn diffy version that caused all the pain in the first<br>
> place"<br>
> delete ifFalse:<br>
> [cacheRepo directory deleteFileNamed: diffyVersionName].<br>
> cacheRepo cacheAllFilenames].<br>
> ^cacheRepo versionNamed: versionName<br>
><br>
> On Wed, Oct 8, 2014 at 4:12 PM, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi All,<br>
>><br>
>> so *how* do I ensure I have a .mcz when there appears to only be a<br>
>> .mcd? I'm talking about trying to get 'Kernel-ul.875.mcz' from trunk when<br>
>> Kernel-ul.875(eem.872).mcd appears to be on offer. If I try<br>
>><br>
>> MCCacheRepository default storeVersion: (trunk versionNamed:<br>
>> 'Kernel-ul.875.mcz') I *do not* get a 'Kernel-ul.875.mcz' in my cache<br>
>> repository. I'm f*&^%d until I can get this working. help, please!<br>
>><br>
>> --<br>
>> best,<br>
>> Eliot<br>
><br>
><br>
><br>
><br>
> --<br>
> best,<br>
> Eliot<br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>