[squeak-dev] Re: .mcd to .mcz (urgent)
Eliot Miranda
eliot.miranda at gmail.com
Thu Oct 9 00:37:39 UTC 2014
OK here's what I came up with, and it's not pretty. But it is useful.
Should this be included in MCCacheRepository or MCFileBasedRepository as a
general facility? IMO, yes, to have some poor soul going down this same
route. But I want to canvas opinion first. Nte that one wpould think all
one had to do was
cacheRepo storeVersion: (repo versionNamed: versionName).
but MCCacheRepository defeats that simple route with
MCCacheRepository >>basicStoreVersion: aVersion
(aVersion isCacheable not or: [self allFileNames includes: aVersion
fileName])
ifFalse: [super basicStoreVersion: aVersion]
So that leaves the brute-force:
cachedNonDiffyVersionNamed: versionName from: repo
"Make sure that the cache contains a non-diffy version of versionName and
answer it."
| cacheRepo |
self assert: (versionName endsWith: '.mcz').
cacheRepo := MCCacheRepository default.
"Make sure that at least the diffy (.mcd) version is present"
(cacheRepo directory includesKey: versionName) ifFalse:
[cacheRepo storeVersion: (repo versionNamed: versionName)].
"if after storeVersion there's still no .mcz we need to create one; sigh..."
(cacheRepo directory includesKey: versionName) ifFalse:
[| baseName diffyVersionName diffyVersion file delete |
baseName := versionName allButLast: 4. "strip .mcz"
diffyVersionName := cacheRepo directory fileNames detect: [:fn| (fn
endsWith: '.mcd') and: [(fn copyUpTo: $() = baseName]].
diffyVersion := cacheRepo versionNamed: diffyVersionName.
file := cacheRepo directory newFileNamed: versionName.
delete := false.
[file binary.
[MCMczWriter fileOut: diffyVersion on: file]
on: Error
do: [:ex|
delete := true. "don't leave half-formed .mcz files around to screw things
up later on..."
ex pass]]
ensure:
[file close.
delete ifTrue:
[cacheRepo directory deleteFileNamed: versionName]].
"now delete the damn diffy version that caused all the pain in the first
place"
delete ifFalse:
[cacheRepo directory deleteFileNamed: diffyVersionName].
cacheRepo cacheAllFilenames].
^cacheRepo versionNamed: versionName
On Wed, Oct 8, 2014 at 4:12 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:
> Hi All,
>
> so *how* do I ensure I have a .mcz when there appears to only be a
> .mcd? I'm talking about trying to get 'Kernel-ul.875.mcz' from trunk
> when Kernel-ul.875(eem.872).mcd appears to be on offer. If I try
>
> MCCacheRepository default storeVersion: (trunk versionNamed:
> 'Kernel-ul.875.mcz') I *do not* get a 'Kernel-ul.875.mcz' in my cache
> repository. I'm f*&^%d until I can get this working. help, please!
>
> --
> best,
> Eliot
>
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20141008/9abf3d16/attachment.htm
More information about the Squeak-dev
mailing list
|