The Trunk: MonticelloConfigurations-dtl.158.mcz

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

The Trunk: MonticelloConfigurations-dtl.158.mcz

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

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

Name: MonticelloConfigurations-dtl.158
Author: dtl
Time: 15 February 2020, 7:21:06.721682 pm
UUID: df6a3d9c-f241-451b-a4f7-5b441e0bf29b
Ancestors: MonticelloConfigurations-dtl.157

Allow an MCMcmUpdater to bypass UI updates when not interactive. Force transcript to open, and present concluding OK dialog, only if interactive.

=============== Diff against MonticelloConfigurations-mt.156 ===============

Item was changed:
  Object subclass: #MCMcmUpdater
  instanceVariableNames: 'repository updateMapName lastUpdateMap'
+ classVariableNames: 'DefaultUpdateMap DefaultUpdateURL Registry SkipPackages UpdateFromServerAtStartup UpdateMissingPackages'
- classVariableNames: 'DefaultUpdateMap DefaultUpdateURL Registry SkipPackages UpdateFromServerAtStartup UpdateMissingPackages Updaters'
  poolDictionaries: ''
  category: 'MonticelloConfigurations'!
 
  !MCMcmUpdater commentStamp: 'dtl 10/12/2015 19:45' 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.
 
  Repository - A registry of known MCMcmUpdater instances identified by repository URL and update map name.
 
  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'.
 
  repository - URL of the repository in which the update maps are located.
 
  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>>initialize (in category 'class initialization') -----
  initialize
  "MCMcmUpdater initialize"
 
- self flag: #TODO. "remove Updaters class var after transition to Registry"
-
  DefaultUpdateURL ifNil:[
  DefaultUpdateURL := MCHttpRepository trunkUrlString.
  DefaultUpdateMap := self defaultBaseName.
  ].
-
- Registry ifNil: [ "Migrate from Updaters class var to Registry"
- "Set new repository ivar in all existing instances"
- Updaters keysAndValuesDo: [ :k :v | v repository: k].
- "Populate the new registry"
- Updaters do: [:e | e register].
- "Set the default update map name to its prior value"
- self updateMapName:
- ((Updaters at: MCMcmUpdater defaultUpdateURL) updateMapName) ].
  !

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"
 
  "MCMcmUpdater
  updateFromRepository: 'http://squeaksource.com/MCUpdateTest'
  baseName: 'update' "
 
+ ^ self updateFromRepository: updaterUrlKey baseName: baseName interactive: true!
- ^ (self updateMapNamed: baseName repository: updaterUrlKey)
- doUpdate!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateFromRepository:baseName:interactive: (in category 'updating') -----
+ updateFromRepository: updaterUrlKey baseName: baseName interactive: interactive
+ "Update using an MCMcmUpdater identified by updaterUrlKey, and using
+ update map baseName"
+
+ "MCMcmUpdater
+ updateFromRepository: 'http://squeaksource.com/MCUpdateTest'
+ baseName: 'update'
+ interactive: false "
+
+ ^ (self updateMapNamed: baseName repository: updaterUrlKey)
+ doUpdate: interactive!

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromServer (in category 'updating') -----
  updateFromServer
  "Update the image by loading all pending updates from the server."
 
+ ^self default doUpdate: true
- ^self default doUpdate
  !

Item was removed:
- ----- Method: MCMcmUpdater>>doUpdate (in category 'updating') -----
- doUpdate
- "Update the image by loading all pending updates from the server. If this is
- the default updater for the system, update the system version when complete.
- Flush all caches. If a previous download failed this is often helpful"
-
- ^self doUpdate: true
- !

Item was changed:
  ----- Method: MCMcmUpdater>>doUpdate: (in category 'updating') -----
  doUpdate: interactive
  "Update the image by loading all pending updates from the server. If this is
  the default updater for the system, update the system version when complete.
  If interteractive use a modal notifier, otherwise only update the transcript.
  Flush all caches. If a previous download failed this is often helpful"
 
+ | config previousUpdateLevel ensureTranscriptSetting |
- | config previousUpdateLevel |
  previousUpdateLevel := SystemVersion current highestUpdate.
+ MCFileBasedRepository flushAllCaches.
+ ensureTranscriptSetting := MCConfiguration ensureOpenTranscript.
+ [ MCConfiguration ensureOpenTranscript: interactive.
- MCFileBasedRepository flushAllCaches.
  config := self updateFromRepository.
  config ifNil: [
  interactive ifTrue: [ ^self inform: 'Unable to retrieve updates from remote repository.' translated ].
  Transcript cr; show: '==========  Unable to retrieve updates from remote repository. ==========' translated; cr.
  ^ self ].
  MCMcmUpdater default == self
  ifTrue: [
  config setSystemVersion.
  interactive ifTrue: [
  self inform: ('Update completed.\\Version: {1}\Update: {3}{2}\\Url: {4}\Map: ''{5}''{6}' translated withCRs format: {
  SystemVersion current version.
  SystemVersion current highestUpdate.
  previousUpdateLevel = SystemVersion current highestUpdate
  ifTrue: ['']
  ifFalse: [previousUpdateLevel asString, ' -> '].
  self repository.
  MCMcmUpdater updateMapName.
  SystemVersion current description ifEmpty: [''] ifNotEmpty: [:d | String cr, String cr, d]})].
  Transcript cr;
  show: '==========  Update completed:  ' translated;
  show: previousUpdateLevel;
  show: ' -> ' ;
  show: SystemVersion current highestUpdate;
  show: ' =========='; cr ]
  ifFalse: [
  interactive
  ifTrue: [ self inform: 'Update completed.' ].
+ Transcript cr; show: '==========  Update completed. ==========' translated; cr ] ]
+ ensure: [ MCConfiguration ensureOpenTranscript: ensureTranscriptSetting].
+
- Transcript cr; show: '==========  Update completed. ==========' translated; cr ]
  !