[squeak-dev] The Inbox: MonticelloConfigurations-fbs.115.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 29 15:44:18 UTC 2013


A new version of MonticelloConfigurations was added to project The Inbox:
http://source.squeak.org/inbox/MonticelloConfigurations-fbs.115.mcz

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

Name: MonticelloConfigurations-fbs.115
Author: fbs
Time: 29 July 2013, 4:44:33.359 pm
UUID: e5e2b7a8-2588-6e44-b968-88ab3f4635b2
Ancestors: MonticelloConfigurations-fbs.114

Move check-for-updates into MonticelloConfigurations, thanks to pragma preferences and Smalltalk's startup/shutdown registration.

Remove the old preference in Preferences' initialize. A later System commit can remove this removal.

=============== Diff against MonticelloConfigurations-fbs.114 ===============

Item was changed:
  Object subclass: #MCMcmUpdater
  	instanceVariableNames: ''
+ 	classVariableNames: 'DefaultUpdateURL LastUpdateMap SkipPackages UpdateAtStartup UpdateMissingPackages'
- 	classVariableNames: 'DefaultUpdateURL LastUpdateMap SkipPackages UpdateMissingPackages'
  	poolDictionaries: ''
  	category: 'MonticelloConfigurations'!
  
  !MCMcmUpdater commentStamp: 'cbc 8/26/2010 16:42' prior: 0!
  MCMcmUpdater provides utility methods for updating Monticello packages from Monticello configurations.
  
  When Monticello configurations are stored in a repository (or repositories), MCMcmUpdater acts as an update stream. It first ensures that each configuration map has been loaded in sequence, then updates the last configuration map to the most recent version for each specified package, and finally loads these versions to produce a fully updated configuration.
  
  Currently if a set of packages are unloaded from the image, using this class to reload them may cause problems, depending on what dependencies those classes have.  Success is not assured.  Removing packages via SmalltalkImage>>unloadAllKnownPackages will be successful, it flags the packages removed so that they are not loaded by this utility.
  
  If you wish to not have MCMcmUpdater update packages, there are two ways to handle this:
  
  1) To have MCMcmUpdater not update any packages not currently in the image set the UpdateMissingPackages preference to false:
  		MCMcmUpdater updateMissingPackages: false
  	Note that any new packages added to the repositories will not be picked up when this is turned off.
  2) To have MCMcmUpdater not update a specific package, evaluate
  		MCMcmUpdater disableUpdatesOfPackage: <packageName>
  
  Class Variables definitions:
  
  DefaultUpdateURL - String: the URL that will be checked by default for updates.  This would be set for a common standard location to check.
  
  LastUpdateMap - Dictionary of Integer: version number of the last loaded update map per repository.  Keeps track of the last configuration map, so that the utility will not have to run through the full history in the repositories each time you ask to update.
  
  SkipPackages - Set of Strings: names of packages to not update in MCMcmUpdater (empty by default).
  
  UpdateMissingPackages - Boolean: if true (default), new packages in the update config map will be loaded unless they are in SkipPackages.  If false, packages not currently loaded in the image will not be loaded by MCMcmUpdater.  (This can be dangerous if packages are split - use at your own risk).
  !

Item was changed:
  ----- Method: MCMcmUpdater class>>initialize (in category 'class initialization') -----
  initialize
  	"MCMcmUpdater initialize"
  	LastUpdateMap ifNil:[
  		LastUpdateMap := Dictionary new.
  	].
  	DefaultUpdateURL ifNil:[
  		DefaultUpdateURL := 'http://source.squeak.org/trunk'.
+ 	].
+ 
+ 	UpdateAtStartup ifNil: [UpdateAtStartup := false].!
- 	].!

Item was added:
+ ----- Method: MCMcmUpdater class>>promptForUpdatesAtStartup (in category 'preferences') -----
+ promptForUpdatesAtStartup
+ 	<preference: 'Update from server at startup'
+ 		category: 'updates'
+ 		description: 'If enabled, will ask you if you wish to update from the server'
+ 		type: #Boolean>
+ 	^ self updateFromServerAtStartup.!

Item was added:
+ ----- Method: MCMcmUpdater class>>setSystemVersionFromConfig: (in category 'private') -----
+ setSystemVersionFromConfig: anMCConfiguration
+ 	"Set the current system version date to the latest date found in anMCConfiguration (or the associated working copy). Also set the highest update number to the sum of version numbers in the config."
+ 
+ 	| versionNumbers versionDates |
+ 	versionNumbers := anMCConfiguration dependencies collect: [:d |
+ 		(d versionInfo name copyAfterLast: $.) asInteger].
+ 	versionDates := anMCConfiguration dependencies collect: [:d |
+ 		d versionInfo date
+ 			ifNil: [d package workingCopy ancestors first date]].
+ 	SystemVersion current
+ 		date: versionDates max;
+ 		highestUpdate: versionNumbers sum.!

Item was added:
+ ----- Method: MCMcmUpdater class>>shutDown: (in category 'system startup') -----
+ shutDown: quitting
+ 	"Nothing to do!!"!

Item was added:
+ ----- Method: MCMcmUpdater class>>startUp: (in category 'system startup') -----
+ startUp: resuming
+ 	"Process update files from a well-known update server.  This method is called at system startup time. Only if the preference #updateFromServerAtStartup is true is the actual update processing undertaken automatically"
+ 	| choice |
+ 	(Preferences valueOfFlag: #updateFromServerAtStartup) ifTrue:
+ 		[choice := UIManager default
+ 			chooseFrom: #('Yes, Update' 'No, Not now' 'Don''t ask again')
+ 			title: 'Shall I look for new code\updates on the server?' withCRs.
+ 		choice = 1 ifTrue: [ MCMcmUpdater updateFromServer ].
+ 		choice = 3 ifTrue: [
+ 			self updateFromServerAtStartup: false.
+ 			self inform: 'Remember to save your image to make this setting permanent.']].!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateFromServer (in category 'updating') -----
+ updateFromServer
+ 	"Update the image by loading all pending updates from the server."
+ 	| config |
+ 	"Flush all caches. If a previous download failed this is often helpful"
+ 	MCFileBasedRepository flushAllCaches.
+ 	config := MCMcmUpdater updateFromDefaultRepository.
+ 	config ifNil: [^self inform: 'Unable to retrieve updates from remote repository.' translated].
+ 	self setSystemVersionFromConfig: config.
+ 	self inform: ('Update completed.
+ Current update number: ' translated, SystemVersion current highestUpdate).!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateFromServerAtStartup (in category 'preferences') -----
+ updateFromServerAtStartup
+ 	^ UpdateAtStartup.!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateFromServerAtStartup: (in category 'preferences') -----
+ updateFromServerAtStartup: aBoolean
+ 	UpdateAtStartup := aBoolean.!



More information about the Squeak-dev mailing list