Göran Krampe uploaded a new version of SMBase to project The Trunk:
http://source.squeak.org/trunk/SMBase-gk.104.mcz ==================== Summary ==================== Name: SMBase-gk.104 Author: gk Time: 11 April 2010, 9:28:15.38 pm UUID: 98f3d474-b746-4636-9bc2-b5ae77e26946 Ancestors: SMBase-ul.103 Trying to quickly update trunk and SqueakMap server for release 4.1: - Fixes for downloads/installation - Move to SmartRefStream =============== Diff against SMBase-ul.103 =============== Item was changed: ----- Method: SMSqueakMap>>createCheckpointNumber: (in category 'checkpoints') ----- createCheckpointNumber: number + "Export me using an ImageSegment or SmartRefStream. - "Export me using an ImageSegment. This is used for checkpointing the map on disk in a form that can be brought into an independent image. + We do not overwrite older versions." - We do not overwrite older versions, since using ImageSegments - is an intermediate hack anyway we don't care about the disk waste!! - Sidenote: Some refactoring was needed to produce a .gz file directly so - I didn't bother." + | fname stream oldMutex | + fname := self filename, '.', number asString, '.r'. + (self directory fileExists: fname, 'gz') ifTrue: [self error: 'Checkpoint already exists!!']. - | is fname stream oldMutex | - fname := self filename, '.', number asString, '.s'. - (self directory fileExists: fname) ifTrue: [self error: 'Checkpoint already exists!!']. stream := StandardFileStream newFileNamed: (self directory fullNameFor: fname). checkpointNumber := number. oldMutex := mutex. mutex := nil. self clearCaches. + [| smartStream | + [smartStream := SmartRefStream on: stream. + smartStream nextPut: self] ensure: [smartStream close]. - [is := ImageSegment new. - is copyFromRoots: (Array with: self) sizeHint: 1000000 areUnique: true. - is writeForExportOn: stream. self compressFile: (StandardFileStream oldFileNamed: (self directory fullNameFor: fname)). isDirty := false] + ensure: [mutex := oldMutex]! - ensure: [mutex := oldMutex]. - ^is! Item was changed: ----- Method: SMSqueakMap classSide>>version (in category 'constants') ----- version "This is the protocol version number used for clients to decide if they need to update SMSqueakMap before synching with the master. In short - only increase this if changes have made the clients incompatible so that they need to be updated. 2.0: Removed Module stuff and added Package releases. 2.1: Various changes/additions and class shape changes. + 2.2: Various 3.9 related fixes and bug fix in segment compression etc. + 2.3: Moving to SmartRefStream when preparing to release Squeak 4.1." - 2.2: Various 3.9 related fixes and bug fix in segment compression etc." + ^'2.3'! - ^'2.2'! Item was changed: ----- Method: SMFileCache>>download: (in category 'services') ----- download: aDownloadable "Download the file for this SMObject into the local file cache. If the file already exists, delete it. No unpacking or installation into the running image." + | stream file fileName dir | + [fileName := aDownloadable downloadFileName. - - [ | dir fileName | - fileName := aDownloadable downloadFileName. fileName ifNil: [self inform: 'No download url, can not download.'. ^ false]. fileName isEmpty ifTrue: [self inform: 'Download url lacks filename, can not download.'. ^ false]. dir := aDownloadable cacheDirectory. + [stream := self getStream: aDownloadable. - [ | stream | - stream := self getStream: aDownloadable. stream ifNil: [^ false]. (dir fileExists: fileName) ifTrue: [dir deleteFileNamed: fileName]. + file := dir newFileNamed: fileName. + file binary; nextPutAll: stream contents] + ensure: [file ifNotNil: [file close]]] - dir newFileNamed: fileName do: [:file | file binary; nextPutAll: stream contents]]] on: Error do: [^ false]. ^ true! Item was changed: ----- Method: SMFileCache>>getStream: (in category 'private') ----- getStream: aDownloadable "Get the stream, either from the original url or if that fails, from the server cache - unless this is the actual server of course. :) We also verify that the sha1sum is correct." | stream | [stream := aDownloadable downloadUrl asUrl retrieveContents contentStream binary. (aDownloadable correctSha1sum: stream contents) ifFalse: [self error: 'Incorrect SHA checksum of file from original URL']] + on: Error do: [:ex | - on: Exception do: [:ex | Transcript show: 'Download from original url (', aDownloadable downloadUrl, ') failed with this exception: ', ex messageText;cr. SMUtilities isServer ifTrue: [^nil] ifFalse: [ Transcript show: 'Trying server cache instead.'; cr. [stream := (self cacheUrlFor: aDownloadable) asUrl retrieveContents contentStream binary. (stream contents size = 21 and: [stream contents asString = 'SMFILEMISSINGONSERVER']) ifTrue: [self error: 'File missing in server cache']. (stream contents size = 24 and: [stream contents asString = 'SMRELEASENOTDOWNLOADABLE']) ifTrue: [self error: 'Release not downloadable']. (aDownloadable correctSha1sum: stream contents) ifFalse: [self error: 'Incorrect SHA checksum of file from server']] + on: Error do: [:ex2 | | msg | - on: Exception do: [:ex2 | | msg | msg := 'Download from server cache of ', aDownloadable printName, ' failed with this exception: ', ex2 messageText. Transcript show: msg; cr. self error: msg]]]. ^ stream! Item was changed: ----- Method: SMSqueakMap>>reload (in category 'public') ----- reload "Reload the map from the latest checkpoint on disk. The opposite of #purge." | fname stream map | fname := self lastCheckpointFilename. fname ifNil: [self error: 'No checkpoint available!!']. "Code below uses good ole StandardFileStream to avoid m17n issues (this is binary data) and also uses #unzipped since it works in older Squeaks" stream := (StandardFileStream oldFileNamed: (self directory fullNameFor: fname)) asUnZippedStream. - "stream := (RWBinaryOrTextStream with: contents) reset." stream ifNil: [self error: 'Couldn''t open stream on checkpoint file!!']. + [map := stream fileInObjectAndCode] ensure: [stream close]. - [map := (stream fileInObjectAndCode) install arrayOfRoots first] ensure: [stream close]. self copyFrom: map! Item was changed: ----- Method: SMSqueakMap>>extension (in category 'checkpoints') ----- extension + ^'rgz'! - ^'sgz'! |
Free forum by Nabble | Edit this page |