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

Eliot Miranda eliot.miranda at gmail.com
Thu Oct 9 01:06:17 UTC 2014


On Wed, Oct 8, 2014 at 6:05 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:

>
>
> On Wed, Oct 8, 2014 at 5:59 PM, Chris Muller <asqueaker at gmail.com> wrote:
>
>> 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.
>>
>
>  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
>

oops.  ignore the partial sentence.  I had meant to delete it ;-)


>
> 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 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.
>
>
>>
>> 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..
>>
>
> 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.
>
>
>>
>> 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
>> >
>> >
>> >
>>
>>
>
>
> --
> best,
> Eliot
>



-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20141008/da0184cf/attachment.htm


More information about the Squeak-dev mailing list