[squeak-dev] Re: .mcd to .mcz (urgent)

Chris Muller asqueaker at gmail.com
Thu Oct 9 00:59:19 UTC 2014

Hi, I'm sure it would help to understand the broader context of why
the .mcd doesn't meet your needs.  I assume you must have some
external (non-Smalltalk) tool unzipping the mcz to get at the
contents?  Because if you were only accessing via the MCRepository
API's then mcd shouldn't matter.

I think you're on the right track with the

   cacheRepo storeVersion: (repo versionNamed: versionName).

approach, because that lets the Repository "do its job" the way it
wants or needs to, able to assume its users would only care about the
objects returned, not its private, internal storage format.

There is a 'alwaysStoreDiffs' option for every Repository, so it might
help to make sure that's turned off on your CacheRepository.  But I
know that's not what you want if the incoming is _already_ a mcd,
because you want a 'alwaysStoreFull', but I'm not sure why..

On Wed, Oct 8, 2014 at 7:37 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> 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

More information about the Squeak-dev mailing list