[Pkg] Installer: Installer-Core-mtf.216.mcz

squeaksource-noreply at iam.unibe.ch squeaksource-noreply at iam.unibe.ch
Thu Jul 24 07:48:44 UTC 2008


A new version of Installer-Core was added to project Installer:
http://www.squeaksource.com/Installer/Installer-Core-mtf.216.mcz

==================== Summary ====================

Name: Installer-Core-mtf.216
Author: mtf
Time: 24 July 2008, 12:48:21 am
UUID: 01df2311-5a03-4413-a516-e4abb500e933
Ancestors: Installer-Core-mtf.215

Made Installer sm update work when SM needs an upgrade. This was surprisingly complex, due to very evil things the loader does. See Installer >> smUpdate for details.

=============== Diff against Installer-Core-mtf.215 ===============

Item was changed:
  ----- Method: Installer>>smUpdate (in category 'squeakmap') -----
  smUpdate
+ "Updates the local map for SqueakMap, upgrading SqueakMap to the latest version if necessary.
+ 
+ When SqueakMap is old and needs to be upgraded, it does four things that mostly make sense in the interactive world SM was built for, but are totally evil here in the world of automatic scripting:
+ 1. It asks the user if she wants to upgrade, in the form of a pop-up (see SMSqueakMap >> #checkVersion:).
+ 2. It terminates its own process.
+ 3. It creates a new UI process.
+ (see the last line of the SqueakMap upgrade file-in: ''Project spawnNewProcessAndTerminateOld: true'', from 
+ http://map.squeak.org/accountbyid/9bdedc18-1525-44a6-9b79-db5d4a87f6f8/files/SqueakMap8.st
+ 4. It opens a SqueakMap window
- "Answer the confirm: popup that happens when SM is old with true"
  
+ We work around these three problems seperately:
+ 1. We use #answer:with: and #withAnswersDo: to automatically answer ''Yes'' when asked if we want to upgrade
+ 2. We don't want this process to be terminated, so we run the update in a forked process and wait for it to finish, using #fork, #ensure:, and a Semaphore
+ 3. We keep track of the UI process before updating, and if it changes, we terminate the new UI process and reinstall the old one using Project >> #resumeProcess:
+ 4. We don't bother with the newly opened window. The other three problems are much worse.
+ 
+ We do all this in a new process, since it is not unlikely that this method is executing in the UI process"
+ 
+ 	| oldUIProcess newUIProcess doneSema |
  	self answer: 'You need to upgrade the SqueakMap package' with: true.
+ 	oldUIProcess := Project uiProcess.
+ 	doneSema := Semaphore new.
+ 
+ [[
+ 	self withAnswersDo: [self classSMSqueakMap default loadUpdates]
+ ] ensure: [
+ 	newUIProcess := Project uiProcess.
+ 
+ 	(
+ 		oldUIProcess ~~ newUIProcess
+ 		and: [oldUIProcess notNil]
+ 		and: [oldUIProcess isTerminated not]
+ 	) ifTrue: [
+ 		newUIProcess ifNotNil: [newUIProcess terminate].
+ 		oldUIProcess suspend.
+ 		Project resumeProcess: oldUIProcess.
+ 	].
+ 
+ 	doneSema signal
+ ]] fork.
+ 	doneSema wait!
-  	self withAnswersDo: [self classSMSqueakMap default loadUpdates]
-  !



More information about the Packages mailing list