[squeak-dev] The Trunk: MonticelloConfigurations-mt.179.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jul 2 09:26:30 UTC 2022


Marcel Taeumel uploaded a new version of MonticelloConfigurations to project The Trunk:
http://source.squeak.org/trunk/MonticelloConfigurations-mt.179.mcz

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

Name: MonticelloConfigurations-mt.179
Author: mt
Time: 2 July 2022, 11:26:29.792753 am
UUID: 7e551122-54fa-2842-bde7-286931b40d4f
Ancestors: MonticelloConfigurations-dtl.178

Fixes HTTP-vs-HTTPS confusion during MC updates so that we can migrate from HTTP to HTTPS without having to download every .mcm there has ever been again.

=============== Diff against MonticelloConfigurations-dtl.178 ===============

Item was added:
+ ----- Method: MCMcmUpdater class>>alternativeDescriptionOf: (in category 'utilities') -----
+ alternativeDescriptionOf: repoDescription
+ 	"Treat HTTP and HTTPS as the same repository."
+ 
+ 	(repoDescription beginsWith: 'http:')
+ 		ifTrue: [^ 'https', (repoDescription allButFirst: 4)].
+ 	(repoDescription beginsWith: 'https:')
+ 		ifTrue: [^ 'http', (repoDescription allButFirst: 5)].
+ 	^ repoDescription!

Item was changed:
  ----- Method: MCMcmUpdater class>>forRepository:updateMap: (in category 'registry') -----
  forRepository: repository updateMap: basename
  	"Answer the requested updater from the repository, or nil of not found"
  
  	"MCMcmUpdater forRepository: 'http://source.squeak.org/trunk' updateMap: 'update'"
  	"MCMcmUpdater forRepository: 'foo' updateMap: 'bar'"
  
  	^ ((Registry ifNil: [Registry := Dictionary new])
  		at: repository
+ 		ifAbsent: [Registry at: (self alternativeDescriptionOf: repository) ifAbsent: [^nil]])
- 		ifAbsent: [^nil])
  			at: basename
  			ifAbsent: [^nil]!

Item was added:
+ ----- Method: MCMcmUpdater>>lastUpdateMapAt: (in category 'accessing') -----
+ lastUpdateMapAt: repoDescription
+ 	
+ 	^ self lastUpdateMap
+ 		at: repoDescription
+ 		ifAbsent: [
+ 			self lastUpdateMap
+ 				at: (self class alternativeDescriptionOf: repoDescription)
+ 				ifAbsent: [0]]!

Item was added:
+ ----- Method: MCMcmUpdater>>lastUpdateMapAt:put: (in category 'accessing') -----
+ lastUpdateMapAt: repoDescription put: lastUpdate
+ 	
+ 	self lastUpdateMap at: repoDescription put: lastUpdate.
+ 	self lastUpdateMap at: (self class alternativeDescriptionOf: repoDescription) put: lastUpdate.!

Item was changed:
  ----- Method: MCMcmUpdater>>refreshUpdateMapFor:with: (in category 'updating') -----
  refreshUpdateMapFor: r with: updateList
  	"Update the lastUpdateMap and answer a possibly reduced updateList"
  
  	| config |
+ 	(self lastUpdateMapAt: r description) = 0 ifTrue: [
- 	(lastUpdateMap at: r description ifAbsent: [0]) = 0 ifTrue: [
  		"No update has ever been loaded from this repo. If no package is
  		present in the image either, we can skip right to the latest config"
  		config := r versionNamed: updateList last value.
  		(config dependencies anySatisfy: [:dep | dep package hasWorkingCopy])
  			ifFalse: [(self useLatestPackagesFrom: r)
+ 					ifTrue: [self lastUpdateMapAt: r description put: updateList last key].
- 					ifTrue: [lastUpdateMap at: r description put: updateList last key].
  				updateList isEmpty
  					ifTrue: [^ #()]
  					ifFalse: [^ updateList last: 1]]].
  	^ updateList
  !

Item was changed:
  ----- Method: MCMcmUpdater>>updateFromRepository (in category 'updating') -----
  updateFromRepository
  
  	| config repo |
  	repo := self getRepositoryFromRepositoryGroup.
  	repo cacheAllFileNamesDuring: [ | updateList |
  		updateList := self updateListFor: repo.
  		"Proceed only if there are updates available at all."
  		updateList ifNotEmpty: [
  			updateList := self refreshUpdateMapFor: repo with: updateList.
  			"Now process each update file. Check if we have all dependencies and if not,
  			load the entire configuration (this is mostly to skip older updates quickly)"
  			updateList do:[:assoc|
  				ProgressNotification signal: '' extra: ('Processing {1}' translated format: {assoc value}).
  				config := repo versionNamed: assoc value.
  				self updateFromConfig: config.
+ 				self lastUpdateMapAt: repo description put: assoc key.
- 				self lastUpdateMap at: repo description put: assoc key.
  			] displayingProgress: 'Processing configurations' translated.
  			"We've loaded all the provided update configurations.
  			Use the latest configuration to update all the remaining packages."
  			(self useLatestPackagesFrom: repo) ifTrue: [
  				config updateFromRepositories.
  				config upgrade].
  		]].
  	^ config
  !

Item was changed:
  ----- Method: MCMcmUpdater>>updateFromRepository:upTo: (in category 'updating') -----
  updateFromRepository: repository upTo: versionNumber
  
  	| config |
  	config := nil.
  	repository cacheAllFileNamesDuring: [ | updateList |
  		updateList := self updateListFor: repository.
  		"Proceed only if there are updates available at all."
  		updateList ifNotEmpty: [
  			updateList := self refreshUpdateMapFor: repository with: updateList.
  			"Now process each update file. Check if we have all dependencies and if not,
  			load the entire configuration (this is mostly to skip older updates quickly)"
  			updateList do:[:assoc|
  				assoc key > versionNumber ifTrue: [^config].
  				ProgressNotification signal: '' extra: ('Processing ' translated format: {assoc value}).
  				config := repository versionNamed: assoc value.
  				self updateFromConfig: config.
+ 				self lastUpdateMapAt: repository description put: assoc key.
- 				self lastUpdateMap at: repository description put: assoc key.
  			] displayingProgress: 'Processing configurations' translated.
  		]].
  	^config
  !

Item was changed:
  ----- Method: MCMcmUpdater>>updateListFor: (in category 'private') -----
  updateListFor: repo
  
  	| updateList allNames minVersion |
  	updateList := OrderedCollection new.
+ 	minVersion := self lastUpdateMapAt: repo description.
- 	minVersion := self lastUpdateMap at: repo description ifAbsent: [0].
  	"Find all the update-*.mcm files"
  	allNames := ('Checking {1}' translated format: {repo description})
  		displayProgressFrom: 0 to: 1 during: [:bar| 
  			bar value: 0.
  			repo allFileNamesOrCache ].
  	allNames do: [:fileName | | version |
  		((fileName endsWith: '.mcm')
  			and: [fileName packageAndBranchName = self updateMapName
  				and: [(version := fileName versionNumber) >= minVersion]]) 
  					ifTrue: [updateList add: version -> fileName]].
  	^updateList sort!



More information about the Squeak-dev mailing list