A new version of Sake-Bob was added to project Sake : http://www.squeaksource.com/Sake/Sake-Bob-kph.14.mcz
==================== Summary ====================
Name: Sake-Bob-kph.14 Author: kph Time: 28 February 2009, 6:43:21 am UUID: 16faf722-0563-11de-9b6f-000a95edb42a Ancestors: Sake-Bob-kph.13
working on saving one click images
=============== Diff against Sake-Bob-kph.13 ===============
Item was changed: ----- Method: BobBuildImage>>package (in category 'as yet unclassified') ----- package + self packageDirectory: self stampedName intoZip: self publishDir from: self publishDir parent + + ! - - self exec: 'cd ', self publishDir parent, '; zip -R ', self packageFile, ' "', self stampedName ,'/*" -x "__*" ".DS*"'. - !
Item was changed: ----- Method: BobBuildImage class>>taskBuild: (in category 'as yet unclassified') ----- taskBuild: metaSelector
| isNeeded | ^ self define: [ :task | "obtain latest meta-data from instance side" (task infoFor: metaSelector) ifNil: [ ^ self noop ]. task if: [ task timeStart. isNeeded := task isBuildNeeded. self log info build: task info name isNeeded: isNeeded first because: isNeeded second. . isNeeded first ]. task action: [ + task stepAction. + task perform: task info action. - task stepAction. - task expandZipFileTo: (task newWorkingDir). - - task startImage: (task workingDir all fileMatching: '*.image'). - - task theScript scriptFileWrite. - - task launchVm: self configVm image: task startImage with: task scriptFile. - - task isSuccessfulBuild ifTrue: [ - task info timeComplete: DateAndTime now. - task info timeDuration: ((task info timeComplete - task info timeStart) roundTo: 1 second). - - task publish. - task package. - task tidy. - task publishLinks. - - task uploadImmediate. ] - ] ] + + - !
Item was changed: ----- Method: BobBuild>>nextScriptPut: (in category 'as yet unclassified') ----- nextScriptPut: aScript
| bScript |
bScript := (self class configStepScript = true) ifFalse: [ aScript ] ifTrue: [ aScript asString copyReplaceAll: self scriptCommentedHalt with: 'self halt.' ]. - script nextChunkPut: bScript, String cr. !
Item was added: + ----- Method: BobBuildImage>>configOneClickIni: (in category 'as yet unclassified') ----- + configOneClickIni: imageName + + ^ '[Global] + DeferUpdate=1 + ShowConsole=0 + DynamicConsole=0 + ReduceCPUUsage=1 + ReduceCPUInBackground=0 + 3ButtonMouse=0 + 1ButtonMouse=0 + UseDirectSound=1 + PriorityBoost=1 + B3DXUsesOpenGL=0 + CaseSensitiveFileMode=0 + ImageFile="Contents\Resources' , imageName, '.image"'!
Item was added: + ----- Method: BobBuildImage>>publishManifestTo: (in category 'as yet unclassified') ----- + publishManifestTo: aPublishDir + + aPublishDir mkpath + addAll: (self imageDir filesMatching: (self stampedName, '.*')). + + aPublishDir + addAll: (self imageDir all filesMatching: #('*.txt' '*.text' '*.pr' '*.pass' '*.fail' )) + + + + !
Item was added: + ----- Method: BobBuildImage>>workingDirOneClickIn (in category 'as yet unclassified') ----- + workingDirOneClickIn + + ^ (self workingDir + '-OneClick.in') asDirectory!
Item was added: + ----- Method: BobBuildImage>>configOneClickSh: (in category 'as yet unclassified') ----- + configOneClickSh: imageName + + ^ '#!!/bin/sh + APP=`dirname $0` + EXE="$APP/Contents/Linux686" + RES="$APP/Contents/Resources" + + exec "$EXE/squeak" -plugins "$EXE" \ + -encoding latin1 \ + -vm-display-X11 -swapbtn \ + "$RES/' , imageName , '.image"'!
Item was changed: ----- Method: BobBuildImage>>startImage: (in category 'accessing') ----- startImage: anObject "Set the value of startImage"
+ startImage := anObject. + + ! - startImage := anObject!
Item was added: + ----- Method: BobBuildImage>>oneClickUpdatePlist:fromDictionary: (in category 'as yet unclassified') ----- + oneClickUpdatePlist: originalPlistFile fromDictionary: dict + + | plist file | + + file := originalPlistFile asFile xml. + plist := file contents. + + ((plist elementAt: 'plist') elementAt: 'dict') elements pairsDo: [ :keyElement :valueElement | + + dict at: (keyElement contentString) ifPresent:[ :newValue | (valueElement contents at: 1) string: newValue ] + ]. + + file delete contents: plist.!
Item was added: + ----- Method: BobBuildImage>>workingDirOneClickOut (in category 'as yet unclassified') ----- + workingDirOneClickOut + + ^ (self workingDir + '-OneClick.out') asDirectory!
Item was added: + ----- Method: BobBuildImage>>packageDirectory:intoZip:from: (in category 'as yet unclassified') ----- + packageDirectory: directory intoZip: packageFile from: rootDir + + self exec: 'cd ', rootDir, '; zip -r ', packageFile, '.zip "', directory ,'" -x "__*" ".DS*"'. + !
Item was added: + ----- Method: BobBuildImage>>configOneClickPlist (in category 'as yet unclassified') ----- + configOneClickPlist + "we take the plist from the template and substitute these values + note: only string values are supported at this time" + + ^ self oneClickPlistBase + at: 'CFBundleName' put: (info oneClickName ifNil: [ info name ]); + at: 'CFBundleShortVersionString' put: (info oneClickName ifNil: [ info name ]); + at: 'CFBundlePackageType' put: 'APPL'; + at: 'CFBundleSignature' put: 'FAST'; + at: 'CFBundleExecutable' put: 'squeak'; + at: 'CFBundleGetInfoString' put: 'http://www.squeak.org'; + at: 'CFBundleIdentifier' put: 'org.squeak'; + at: 'CFBundleVersion' put: '3.8.18b1U'; + at: 'SqueakEncodingType' put: 'UTF-8'; + yourself + !
Item was changed: ----- Method: BobBuildImage>>scriptSetVersion (in category 'as yet unclassified') ----- scriptSetVersion
| s | s := String new writeStream. s << '"self halt."' ; cr. s << 'SystemVersion newVersion: ' << self name printString << '.' ; cr. s << 'SystemVersion current date: ''' << self timeStart asTimeStamp printString << ''' asTimeStamp.'; cr. + s << 'Smalltalk at: #Scripter ifPresent: [ :scr | scr transcript windowLabel: ''' << + self stampedName <<''' ].' ; cr.
self nextScriptPut: s contents!
Item was added: + ----- Method: BobBuildImage>>actionPublishOneClick (in category 'as yet unclassified') ----- + actionPublishOneClick + + "if our source zip has an info file accompanying read it" + | sourceInfo | + sourceInfo := Compiler evaluate: (zipFile copy ext: 'info') contents. + + info timeStart: sourceInfo timeStart. + info timeDuration: sourceInfo timeDuration. + info timeComplete: sourceInfo timeComplete. + info timeOneClickGenerated: DateAndTime now. + + self expandZipFileTo: (self workingDirOneClickIn mkpath clean). + + self startImage: (self workingDirOneClickIn all fileMatching: '*.image'). + + self packageOneClick. + + + !
Item was changed: ----- Method: BobBuildImage>>scriptAddInfoScript (in category 'as yet unclassified') ----- scriptAddInfoScript
| rs | rs := (self class docAt: self info build) readStream. [ rs atEnd ] whileFalse: [ self nextScriptPut: (rs upToAll: '""""""') asString ].!
Item was changed: ----- Method: BobBuildImage>>newWorkingDir (in category 'as yet unclassified') ----- newWorkingDir self workingDir mkpath.
+ self exec: 'cd ', self workingDir,'; rm -rf *'. - self exec: 'cd ', self workingDir,'; rm -rf *; ln -s ', self class configPackageCacheDir mkpath, ' package-cache'. ^ self workingDir. !
Item was added: + ----- Method: BobBuild>>description (in category 'as yet unclassified') ----- + description + + ^ ''!
Item was added: + ----- Method: BobBuildImage>>configOneClickCopyrightStatement (in category 'as yet unclassified') ----- + configOneClickCopyrightStatement + + ^ + + 'Distribution based on Sophie + + http://www.sophieproject.org/%27!
Item was changed: ----- Method: BobBuildImage>>scriptOpenInWorkspace: (in category 'as yet unclassified') ----- scriptOpenInWorkspace: afilename
+ self nextScriptPut: 'Workspace openFile: ', afilename printString, '.'. - self nextScriptPut: '"self halt." - Workspace openFile: ', afilename printString, '.'. !
Item was added: + ----- Method: BobBuildImage>>workingOneClickDir (in category 'as yet unclassified') ----- + workingOneClickDir + + ^ (self workingDir + '-OneClick') asDirectory!
Item was added: + ----- Method: BobBuildImage>>configOneClickIcns (in category 'as yet unclassified') ----- + configOneClickIcns + + ^ (info oneClickIcns ifNil: [ '/bob/misc/SqueakImage.icns' ]) !
Item was changed: ----- Method: BobBuildImage>>scriptAddLPF (in category 'as yet unclassified') ----- scriptAddLPF
self nextScriptPut: '"self halt." (HTTPSocket httpGet: ''ftp.squeak.org/3.11/bob/LPF.st'') readStream fileIn.'. !
Item was added: + ----- Method: BobBuildImage>>scriptAddScripter (in category 'as yet unclassified') ----- + scriptAddScripter + + self nextScriptPut: '"self halt." Installer ss project: ''Scripter''; install: ''Scripter-Core''.'. + !
Item was changed: ----- Method: BobBuildImage>>scriptCleanUp (in category 'as yet unclassified') ----- scriptCleanUp
+ self nextScriptPut: '"self halt." SmalltalkImage current cleanUpAllExcept: #(ChangeSet).'! - self nextScriptPut: 'SmalltalkImage current cleanUpAllExcept: #(ChangeSet).'!
Item was changed: ----- Method: BobBuildImage>>publish (in category 'as yet unclassified') ----- publish
"we publish to a temp directory and publish as an atomic operation otherwise the uploader might start uploading before it is ready" self info overwrite = true ifTrue: [ self outputDir all delete ]. + self publishManifestTo: self publishDir. - self publishManifest. self infoFilePublishAlongside: self publishDir. !
Item was added: + ----- Method: BobBuildImage>>actionBuild (in category 'as yet unclassified') ----- + actionBuild + + self stepAction. + self expandZipFileTo: (self workingDir mkpath clean). + + self startImage: (self workingDir all fileMatching: '*.image'). + self linkPackageCache. + + self theScript scriptFileWrite. + + self launchVm: self configVm image: self startImage with: self scriptFile. + + self isSuccessfulBuild ifFalse: [ ^ self ]. + + info timeComplete: DateAndTime now. + info timeDuration: ((info timeComplete - info timeStart) roundTo: 1 second). + + self publish. + + self package. + + self tidy. + self publishLinks. + + self uploadImmediate. + !
Item was changed: ----- Method: BobBuildImage>>scriptSaveImageAndQuit: (in category 'as yet unclassified') ----- scriptSaveImageAndQuit: requestQuit
| s | s := String new writeStream. s << ' | image resuming |' ; cr. s << '"self halt."' ; cr. + s << 'WorldState addDeferredUIMessage: [ (Delay forSeconds: 1) wait. '; cr. s << 'image := SmalltalkImage current.'; cr. s << 'resuming := image saveAs: '''<< self stampedName << '.image''.'; cr. requestQuit ifTrue: [ s << 'resuming ifFalse: [ image snapshot: false andQuit: true ].' ; cr ].
+ s << '].' + self nextScriptPut: s contents!
Item was added: + ----- Method: BobBuildImage>>packageOneClick (in category 'as yet unclassified') ----- + packageOneClick + + | appZip appDir resources plist bundleName imageName template filename | + + info oneClick = true ifFalse: [ ^ self ]. + + template := info oneClickTemplate ifNil: [ self configOneClickTemplate ]. + + "use the match string given to find the template" + appZip := self resolveFile: template ifNone: [ :msg | self error: msg ]. + + "download to images cache, and decompress to the output area" + self expand: appZip to: self workingDirOneClickOut mkpath clean. + + "the result should have a .app dir, find it" + appDir := self workingDirOneClickOut directories detect: [ :ea | ea asString endsWith: '.app' ] ifNone: [ self error: '*.app not found' ]. + + "get our plist contribution" + plist := self configOneClickPlist. + + bundleName := plist at: 'CFBundleName'. + imageName := bundleName asLowercase. + plist at: 'SqueakImageName' put: (imageName, '.image'). + + "rename the .app dir to the desired name" + appDir beRenaming fileName: (bundleName , '.app'). + + "top level directory" + (appDir filesMatching: #('*.exe' '*.ini' '*.sh')) do: [ :ea | ea rename base: bundleName ]. + (appDir / bundleName + '.ini' ) delete contents: ((self configOneClickIni: imageName) copyReplaceAll: String cr with: String crlf). + (appDir / bundleName + '.sh' ) delete contents: (self configOneClickSh: imageName). + (appDir / 'COPYRIGHT') delete contents: (info oneClickCopyrightStatement ifNil: [ self configOneClickCopyrightStatement ] ). + + "Contents Directory" + appDir / 'Contents' / 'PkgInfo' contents: ((plist at: 'CFBundlePackageType') , (plist at: 'CFBundleSignature')). + self oneClickUpdatePlist: (appDir / 'Contents' / 'Info.plist') fromDictionary: plist. + + "Resources Directory" + resources := (appDir / 'Contents' / 'Resources') all delete mkpath. + + resources addTree: self imageDir entries. + (resources filesMatching: #('*.image' '*.changes')) do: [ :ea | ea rename base: imageName ]. + resources add: self configOneClickIcns asFile. + resources add: (info oneClickSources ifNil: [ self configOneClickSources ]) asFile. + + self halt. + filename := appDir fileName. + self packageDirectory: filename intoZip: (self stamp,'_', filename) from: appDir parent. + + !
Item was added: + ----- Method: BobBuildImage>>configOneClickTemplate (in category 'as yet unclassified') ----- + configOneClickTemplate + + ^ 'file:///bob/images/Seaside-2.8.3.app.zip' !
Item was added: + ----- Method: BobBuildImage>>oneClickPlistBase (in category 'as yet unclassified') ----- + oneClickPlistBase + + ^ Dictionary new + at: 'CFBundleIconFile' put: self configOneClickIcns asFile fileName; + yourself!
Item was changed: ----- Method: BobBuild class>>taskUpload: (in category 'as yet unclassified') ----- taskUpload: metaSelector "the task of uploading is defined as a top level task, because it is more generic than image building, and may be applied to any result." | newInfo lock ul dl yes | ^ self define: [ :task | (task infoFor: metaSelector) ifNil: [ ^ self noop ]. task dependsOn: #(). newInfo := task info. "obtain and use the latest meta-data from the most recent build activity" task info: task infoFileReadLatest. "some fields in the metadata we prefer new values over the older" task info upload: newInfo upload. task info download: newInfo download. task info linkRelease: newInfo linkRelease. task info comment: newInfo comment. task if: [ lock := ul := dl := nil. yes := task name notNil and: [ (ul := task isUploadRequested) and: [ dl := task isUploadedFileAvailableForDownload. dl ifTrue: [ task uploadDirLock delete ]. dl not and: [ (lock := task uploadDirLock exists) not ] ] ]. task name ifNotNil:[ self log info name: task name uploadRequested: ul done: dl inProgress: lock. ]. "if we decide that we shall upload, we lock the upload dir to inform others" yes ifTrue: [ task uploadDirLock touch ]. yes. ]. task action: [
self log info UPLOADING: task publishDir.
task infoFilePublishAlongside: task publishDir. task linkRelease. + task oneClick = true ifTrue: [ task packageOneClick ]. + task perform: ('uploadUsing', (task info upload upTo: $:) capitalized) asSymbol. task isUploadedFileAvailableForDownload ifTrue: [ task uploadDirLock delete ]. ] ]
!
Item was changed: ----- Method: BobBuild>>infoFor: (in category 'as yet unclassified') ----- infoFor: selector selector ifNil: [ ^ nil ]. self info name: self class label. self info build: selector. self info label: self class label. self when: self class configWhen. self info linkRelease: self class configLinkRelease. + self description ifNotEmpty: [ self info description: self description ]. + info action: #actionBuild.
self perform: selector. + ! - self info when: self preprocessWhen. - - - !
Item was added: + ----- Method: BobBuildImage>>configOneClickSources (in category 'as yet unclassified') ----- + configOneClickSources + + ^ '/bob/vm/SqueakV39.sources' + + " '/bob/vm/SqueakV3.sources' " + !
Item was changed: ----- Method: BobBuild>>expandZipFileTo: (in category 'zip file') ----- expandZipFileTo: destDir - - " - (self obtainImage: 'ftp://ftp.squeak.org/3.10/Squeak3.10.2-*-basic.zip') run - " - | localZipFile | + ^ self expand: zipFile to: destDir! - zipFile executive isRemote - ifTrue: [ - - localZipFile := self class configImagesDir / zipFile fileName. - - "if it is not in the local downloaded images cache, look in our output tree" - localZipFile exists ifFalse: [ - (self outputDir parent all filesMatching: zipFile fileName) firstOrNil - ifNotNilDo: [ :found | - self log info found: found. - localZipFile := found - ]. - ]. - - localZipFile exists ifFalse: [ - self log info downloading: zipFile. - localZipFile parent mkpath add: zipFile ]. - ] - ifFalse: [ localZipFile := zipFile ]. - - self log info bob expanding: localZipFile to: destDir. - - self exec: 'unzip ', localZipFile, ' -d ', destDir full mkpath. - - ^ localZipFile - - " - localZipFile zip readArchive extractAllTo: destDir mkpath asFileDirectory. - " - !
Item was added: + ----- Method: BobBuildImage>>linkPackageCache (in category 'accessing') ----- + linkPackageCache + + self exec: 'cd ', self imageDir,'; ln -s ', self class configPackageCacheDir mkpath, ' package-cache'. + !
Item was added: + ----- Method: BobBuild>>expand:to: (in category 'zip file') ----- + expand: aZipFile to: destDir + + " + (self obtainImage: 'ftp://ftp.squeak.org/3.10/Squeak3.10.2-*-basic.zip') run + " + | localZipFile | + + aZipFile executive isRemote + ifTrue: [ + + localZipFile := self class configImagesDir / aZipFile fileName. + + "if it is not in the local downloaded images cache, look in our output tree" + localZipFile exists ifFalse: [ + (self outputDir parent all filesMatching: aZipFile fileName) firstOrNil + ifNotNilDo: [ :found | + self log info found: found. + localZipFile := found + ]. + ]. + + localZipFile exists ifFalse: [ + self log info downloading: zipFile. + localZipFile parent mkpath add: zipFile ]. + ] + ifFalse: [ localZipFile := aZipFile ]. + + self log info bob expanding: localZipFile to: destDir. + + self exec: 'unzip ', localZipFile, ' -d ', destDir full mkpath. + + ^ localZipFile + + " + localZipFile zip readArchive extractAllTo: destDir mkpath asFileDirectory. + " + !
Item was removed: - ----- Method: BobBuildImage>>scriptGoAtomic (in category 'as yet unclassified') ----- - scriptGoAtomic - - self nextScriptPut: 'Preferences setPreference; #useMonticelloAtomicLoader toValue: true.'!
Item was removed: - ----- Method: BobBuildImage>>packageFile (in category 'as yet unclassified') ----- - packageFile - - ^ self publishDir + '.zip'!
packages@lists.squeakfoundation.org