The Inbox: MonticelloConfigurations-dtl.137.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: MonticelloConfigurations-dtl.137.mcz

commits-2
David T. Lewis uploaded a new version of MonticelloConfigurations to project The Inbox:
http://source.squeak.org/inbox/MonticelloConfigurations-dtl.137.mcz

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

Name: MonticelloConfigurations-dtl.137
Author: dtl
Time: 28 August 2015, 10:22:42.408 pm
UUID: 420cae25-4016-48ba-8101-1881773d5098
Ancestors: MonticelloConfigurations-dtl.136

Fix updating the default update map name from preferences. Change constructor to avoid conflict with setter used by the preference. When the preference for default update map changes, initialize with a new default updater. The previous updater for the default update URL is replaced because its remembered position in the update stream will not be valid for a different update map sequence. Therefore ask confirmation from the user before accepting the preference change.

Class var UpdateMapName is no longer needed, remove it.

The LastUpdateMap class var was retained to support transition to instance based updaters. Remove it now.

=============== Diff against MonticelloConfigurations-dtl.136 ===============

Item was changed:
  Object subclass: #MCMcmUpdater
  instanceVariableNames: 'updateMapName lastUpdateMap'
+ classVariableNames: 'DefaultUpdateURL SkipPackages UpdateFromServerAtStartup UpdateMissingPackages Updaters'
- classVariableNames: 'DefaultUpdateURL LastUpdateMap SkipPackages UpdateFromServerAtStartup UpdateMapName UpdateMissingPackages Updaters'
  poolDictionaries: ''
  category: 'MonticelloConfigurations'!
 
+ !MCMcmUpdater commentStamp: 'dtl 8/28/2015 22:07' prior: 0!
- !MCMcmUpdater commentStamp: 'dtl 5/4/2015 16:03' 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.
 
  Updaters - A dictionary of MCMcmUpdater instances keyed by repository URL.
 
  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).
 
  Instance Variables:
 
  updateMapName - Base name of the files used for this updater, typically a name such as 'update' or 'update.spur'.
 
  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.
  !

Item was changed:
  ----- Method: MCMcmUpdater class>>default (in category 'instance creation') -----
  default
  "The default instance for system updates. Uses a default update map
  name that may be set as a preference to enable a specific update stream
  for a repository."
 
  ^ self updaters
  at: self defaultUpdateURL
+ ifAbsentPut: [self updateMapNamed: self updateMapName]!
- ifAbsentPut: [self updateMapName: self updateMapName]!

Item was changed:
  ----- Method: MCMcmUpdater class>>initialize (in category 'class initialization') -----
  initialize
  "MCMcmUpdater initialize"
- LastUpdateMap ifNil:[
- LastUpdateMap := Dictionary new.
- ].
  DefaultUpdateURL ifNil:[
  DefaultUpdateURL := MCHttpRepository trunkUrlString.
  ].
  Updaters := nil.
- self flag: #FIXME.
- "The next line is to faciliate updating from class-side methods to instance based.
- Building a new default update map is very time consuming, so do not do it.
- Delete this after the transition is complete. Also delete class var LastUpdateMap
- and its initialization above. -dtl May 2015"
- LastUpdateMap ifNotNil: [ self default lastUpdateMap: LastUpdateMap ]
  !

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromRepositories:using:baseName: (in category 'updating') -----
  updateFromRepositories: repositoryUrls using: updaterUrlKey baseName: baseName
  "Update all repositoryUrls using an MCMcmUpdater identified by updaterUrlKey, and
  using update map baseName"
 
+ ^ (self updateMapNamed: baseName repository: updaterUrlKey)
- ^ (self updateMapName: baseName repository: updaterUrlKey)
  updateFromRepositories: repositoryUrls!

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromRepository:baseName: (in category 'updating') -----
  updateFromRepository: updaterUrlKey baseName: baseName
  "Update using an MCMcmUpdater identified by updaterUrlKey, and using
  update map baseName"
 
+ ^ (self updateMapNamed: baseName repository: updaterUrlKey)
- ^ (self updateMapName: baseName repository: updaterUrlKey)
  updateFrom: updaterUrlKey!

Item was changed:
  ----- Method: MCMcmUpdater class>>updateMapName (in category 'preferences') -----
  updateMapName
+ "The default update map name"
- "Name for update map, without version info"
 
  <preference: 'Update map name'
  category: 'updates'
  description: 'Base name for the update maps'
  type: #String>
 
+ ^ 'update'!
- ^UpdateMapName ifNil: ['update']!

Item was changed:
+ ----- Method: MCMcmUpdater class>>updateMapName: (in category 'preferences') -----
+ updateMapName: mapName
+ "The default update map name for the default updater. If this is changed,
+ then the default updater must be replaced because its remembered position
+ in the update map sequence will not be valid for the new update map."
- ----- Method: MCMcmUpdater class>>updateMapName: (in category 'instance creation') -----
- updateMapName: baseName
- "Answer a new instance with a base update name baseName such as
- 'update' or 'update.oscog' "
 
+ self default updateMapName = mapName
+ ifFalse: [(self confirm: 'Initializing updater for ' , DefaultUpdateURL , ' to use new update stream ' , mapName)
+ ifTrue: [self updaters
+ at: self defaultUpdateURL
+ put: (self updateMapNamed: mapName)]]!
- ^ self new updateMapName: baseName!

Item was removed:
- ----- Method: MCMcmUpdater class>>updateMapName:repository: (in category 'instance creation') -----
- updateMapName: baseName repository: url
- "Answer an instance for the given repository URL with a base update name
- baseName. The instance will be updated in the Updaters dictionary if baseName
- has changed."
-
- | updater |
- updater := self updaters at: url ifAbsentPut: [ self updateMapName: baseName ].
- updater updateMapName = baseName
- ifFalse: [ ^ self updaters at: url put: (self updateMapName: baseName )].
- ^ updater
- !

Item was added:
+ ----- Method: MCMcmUpdater class>>updateMapNamed: (in category 'instance creation') -----
+ updateMapNamed: baseName
+ "Answer a new instance with a base update name baseName such as
+ 'update' or 'update.oscog' "
+
+ ^ self new
+ updateMapName: baseName;
+ lastUpdateMap: Dictionary new!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateMapNamed:repository: (in category 'instance creation') -----
+ updateMapNamed: baseName repository: url
+ "Answer an instance for the given repository URL with a base update name
+ baseName. The instance will be updated in the Updaters dictionary if baseName
+ has changed."
+
+ | updater |
+ updater := self updaters at: url ifAbsentPut: [ self updateMapNamed: baseName ].
+ updater updateMapName = baseName
+ ifFalse: [ ^ self updaters at: url put: (self updateMapNamed: baseName )].
+ ^ updater
+ !