[squeak-dev] The Trunk: MonticelloConfigurations-bf.96.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 12 18:45:05 UTC 2011


Bert Freudenberg uploaded a new version of MonticelloConfigurations to project The Trunk:
http://source.squeak.org/trunk/MonticelloConfigurations-bf.96.mcz

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

Name: MonticelloConfigurations-bf.96
Author: bf
Time: 12 July 2011, 8:44:53.731 pm
UUID: 55679e6b-ade6-4ea4-a959-a625de620b4b
Ancestors: MonticelloConfigurations-ul.95

refactor MCMcmUpdater to allow overriding parts of the huge updateFromRepositories: method

=============== Diff against MonticelloConfigurations-ul.95 ===============

Item was changed:
+ ----- Method: MCMcmUpdater class>>defaultUpdateURL (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>defaultUpdateURL (in category 'updating') -----
  defaultUpdateURL
  	"The default update repository URL"
  
  	<preference: 'Update URL'
  		category: 'Monticello'
  		description: 'The repository URL for loading updates'
  		type: #String>
  
  	^DefaultUpdateURL ifNil:['']!

Item was changed:
+ ----- Method: MCMcmUpdater class>>defaultUpdateURL: (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>defaultUpdateURL: (in category 'updating') -----
  defaultUpdateURL: aString
  	"The default update repository URL"
  
  	DefaultUpdateURL := aString!

Item was changed:
+ ----- Method: MCMcmUpdater class>>disableUpdatesOfPackage: (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>disableUpdatesOfPackage: (in category 'updating') -----
  disableUpdatesOfPackage: packageName
  	self skipPackages add: packageName!

Item was changed:
+ ----- Method: MCMcmUpdater class>>enableUpdatesForAllPackages (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>enableUpdatesForAllPackages (in category 'updating') -----
  enableUpdatesForAllPackages
  	SkipPackages := Set new!

Item was changed:
+ ----- Method: MCMcmUpdater class>>enableUpdatesOfPackage: (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>enableUpdatesOfPackage: (in category 'updating') -----
  enableUpdatesOfPackage: packageName
  	self skipPackages remove: packageName ifAbsent: [].!

Item was changed:
+ ----- Method: MCMcmUpdater class>>skipPackages (in category 'private') -----
- ----- Method: MCMcmUpdater class>>skipPackages (in category 'updating') -----
  skipPackages
  	^SkipPackages ifNil: [SkipPackages := Set new]!

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromRepositories: (in category 'updating') -----
  updateFromRepositories: repositoryUrls
  	"MCMcmUpdater updateFromRepositories: #(
  		'http://squeaksource.com/MCUpdateTest'
  	)"
  
  	| repos config |
  	Preferences enable: #upgradeIsMerge.
  	LastUpdateMap ifNil:[LastUpdateMap := Dictionary new].
  	"The list of repositories to consult in order"
  	repos := repositoryUrls collect:[:url| 
  		MCRepositoryGroup default repositories 
  			detect:[:r| r description = url]
  			ifNone:[ | r |
  				r := MCHttpRepository location: url user: '' password: ''.
  				MCRepositoryGroup default addRepository: r.
  				r]].
  
  	"The list of updates-author.version.mcm sorted by version"
  	repos do:[:r| r cacheAllFileNamesDuring:[
+ 		| updateList |
+ 		updateList := self updateListFor: r.
- 		| minVersion updateList allNames |
- 		updateList := SortedCollection new.
- 		minVersion := LastUpdateMap at: r description ifAbsent:[0].
- 		"Find all the updates-author.version.mcm files"
- 		'Checking ', r description
- 			displayProgressFrom: 0 to: 1 during:[:bar| 
- 				bar value: 0.
- 				allNames := r allFileNames.
- 			].
- 		allNames do:[:versionedName| | version base parts author type |
- 			parts := versionedName findTokens: '.-'.
- 			parts size = 4 ifTrue:[
- 				base := parts at: 1.
- 				author := parts at: 2.
- 				version := [(parts at: 3) asNumber] on: Error do:[:ex| ex return: 0].
- 				type := parts at: 4.
- 			].
- 			(base = 'update' and:[version >= minVersion and:[type = 'mcm']]) 
- 				ifTrue:[updateList add: version -> versionedName]].
- 		
  		"Proceed only if there are updates available at all."
  		updateList ifNotEmpty: [
  			"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 ', assoc value.
  				config := r versionNamed: assoc value.
  				"Skip packages that were specifically unloaded"
  				config dependencies: (config dependencies 
  					reject: [:dep| self skipPackages includes: dep package name]).
  				self updateMissingPackages ifFalse:[
  					"Skip packages that are not in the image"
  					config dependencies: (config dependencies 
  						select: [:dep| dep package hasWorkingCopy])].
  				(config dependencies allSatisfy:[:dep| dep isFulfilled]) 
  					ifFalse:[config upgrade].
  				LastUpdateMap at: r description put: assoc key.
  			] displayingProgress: 'Processing configurations'.
  			"We've loaded all the provided update configurations.
  			Use the latest configuration to update all the remaining packages."
+ 			(self useLatestPackagesFrom: r) ifTrue: [
+ 				config updateFromRepositories.
+ 				config upgrade].
- 			config updateFromRepositories.
- 			config upgrade.
  		]].
  	].
  	^config!

Item was added:
+ ----- Method: MCMcmUpdater class>>updateListFor: (in category 'private') -----
+ updateListFor: repo
+ 	| updateList allNames minVersion |
+ 	updateList := SortedCollection new.
+ 	minVersion := LastUpdateMap at: repo description ifAbsent: [0].
+ 	"Find all the updates-author.version.mcm files"
+ 	'Checking ', repo description
+ 		displayProgressFrom: 0 to: 1 during: [:bar| 
+ 			bar value: 0.
+ 			allNames := repo allFileNames].
+ 	allNames do: [:versionedName | | version base parts author type |
+ 		parts := versionedName findTokens: '.-'.
+ 		parts size = 4 ifTrue: [
+ 			base := parts at: 1.
+ 			author := parts at: 2.
+ 			version := [(parts at: 3) asNumber] on: Error do: [:ex | ex return: 0].
+ 			type := parts at: 4.
+ 		].
+ 		(base = 'update' and: [version >= minVersion and: [type = 'mcm']]) 
+ 			ifTrue: [updateList add: version -> versionedName]].
+ 	^updateList!

Item was changed:
+ ----- Method: MCMcmUpdater class>>updateMissingPackages (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>updateMissingPackages (in category 'updating') -----
  updateMissingPackages
  	"Whether to update missing (unloaded) packages"
  
  	<preference: 'Update missing package'
  		category: 'Monticello'
  		description: 'If true, missing (unloaded) packages will be loaded during the update process.'
  		type: #Boolean>
  
  	^UpdateMissingPackages ifNil:[true]!

Item was changed:
+ ----- Method: MCMcmUpdater class>>updateMissingPackages: (in category 'preferences') -----
- ----- Method: MCMcmUpdater class>>updateMissingPackages: (in category 'updating') -----
  updateMissingPackages: aBool
  	"Whether to update missing (unloaded) packages"
  
  	UpdateMissingPackages := aBool.!

Item was added:
+ ----- Method: MCMcmUpdater class>>useLatestPackagesFrom: (in category 'private') -----
+ useLatestPackagesFrom: repo
+ 	"for overriding on a per repository basis"
+ 	^true!




More information about the Squeak-dev mailing list