[squeak-dev] The Trunk: UpdateStream-mt.15.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 4 16:06:15 UTC 2020


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

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

Name: UpdateStream-mt.15
Author: mt
Time: 4 March 2020, 5:06:14.872827 pm
UUID: 167f4a6a-e41e-ab4d-9eea-1cfcd2d23dfb
Ancestors: UpdateStream-mt.14

Removes more deprecated message sends.

=============== Diff against UpdateStream-mt.14 ===============

Item was changed:
  ----- Method: ServerDirectory>>copyUpdatesNumbered:toVersion: (in category '*UpdateStream-updating') -----
  copyUpdatesNumbered: selectList toVersion: otherVersion
  	"Into the section of updates.list corresponding to otherVersion,
  	copy all the fileNames from this version matching the selectList."
  "
  		(ServerDirectory serverInGroupNamed: 'Disney Internal Updates*')
  			copyUpdatesNumbered: #(4411 4412) to version: 'Squeak3.1beta'.
  "
  	| myServers updateStrm indexPrefix version versIndex lastNum otherVersIndex additions outOfOrder listContents |
  	self openGroup.
  	indexPrefix := (self groupName includes: $*) 
  		ifTrue: [(self groupName findTokens: ' ') first]	"special for internal updates"
  		ifFalse: ['']. 	"normal"
  	myServers := self checkServersWithPrefix: indexPrefix
  					andParseListInto: [:x | listContents := x].
  	myServers size = 0 ifTrue: [self closeGroup.  ^ self].
  
  	version := SystemVersion current version.
  	versIndex := (listContents collect: [:pair | pair first]) indexOf: version.
  	versIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for your version'.
  		self closeGroup.  ^ nil].	"abort"
  	otherVersIndex := (listContents collect: [:pair | pair first]) indexOf: otherVersion.
  	otherVersIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for the target version'.
  		self closeGroup.  ^ nil].	"abort"
  	versIndex < listContents size ifTrue:
  		[(self confirm: 'This system, ', version ,
  				' is not the latest version.\OK to copy updates from that old version?' withCRs)
  			ifFalse: [self closeGroup.  ^ nil]].	"abort"
  
  	"Append all fileNames in my list that are not in the export list"
  	additions := OrderedCollection new.
  	outOfOrder := OrderedCollection new.
  	lastNum := (listContents at: otherVersIndex) last isEmpty
  		ifTrue: [0]  "no checking if the current list is empty"
  		ifFalse: [(listContents at: otherVersIndex) last last initialIntegerOrNil].
  	(listContents at: versIndex) last do:
  		[:fileName | | seq | seq := fileName initialIntegerOrNil.
  		(selectList includes: seq) ifTrue:
  			[seq > lastNum
  				ifTrue: [additions addLast: fileName]
  				ifFalse: [outOfOrder addLast: seq]]].
  	outOfOrder isEmpty ifFalse:
  		[UIManager default inform: 'Updates numbered ' , outOfOrder asArray printString,
  		' are out of order.\ The last update in ' withCRs,
  		otherVersion, ' is ', lastNum printString,
  		'.\No update will take place.' withCRs.
  		self closeGroup.  ^ nil].	"abort"
  
  	"Save old copy of updates.list on local disk"
  	FileDirectory default deleteFileNamed: indexPrefix , 'updates.list.bk'.
  	UpdateStreamDownloader default writeList: listContents toStream: (FileStream fileNamed: indexPrefix , 'updates.list.bk').
  
  	"Write a new copy of updates.list on all servers..."
  	listContents at: otherVersIndex put:
  		{otherVersion. (listContents at: otherVersIndex) last , additions}.
  	updateStrm := ReadStream on:
+ 		(String streamContents: [:s | UpdateStreamDownloader default writeList: listContents toStream: s]).
- 		(String streamContents: [:s | Utilities writeList: listContents toStream: s]).
  	myServers do:
  		[:aServer |
  		updateStrm reset.
  		aServer putFile: updateStrm named: indexPrefix , 'updates.list' retry: true.
  		Transcript show: 'Update succeeded on server ', aServer moniker; cr].
  	self closeGroup.
  		
  	Transcript cr; show: 'Be sure to test your new update!!'; cr.
  !

Item was changed:
  ----- Method: ServerDirectory>>exportUpdatesExcept: (in category '*UpdateStream-updating') -----
  exportUpdatesExcept: skipList
  	"Into the section of updates.list corresponding to this version,
  	copy all the fileNames in the named updates.list for this group
  	that are more recently numbered."
  "
  		(ServerDirectory serverInGroupNamed: 'Disney Internal Updates*')
  			exportUpdatesExcept: #(3959).
  "
  	| myServers updateStrm response indexPrefix version versIndex lastNum expContents expVersIndex additions listContents |
  	self openGroup.
  	indexPrefix := (self groupName includes: $*) 
  		ifTrue: [(self groupName findTokens: ' ') first]	"special for internal updates"
  		ifFalse: ['']. 	"normal"
  	myServers := self checkServersWithPrefix: indexPrefix
  					andParseListInto: [:x | listContents := x].
  	myServers size = 0 ifTrue: [self closeGroup.  ^ self].
  
  	version := SystemVersion current version.
  	versIndex := (listContents collect: [:pair | pair first]) indexOf: version.
  	versIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for your version'.
  		self closeGroup.  ^ nil].	"abort"
  	versIndex < listContents size ifTrue:
  		[response := UIManager default 
  			chooseFrom: #('Make update from an older version' 'Cancel update')
  			title: 'This system, ', SystemVersion current version,
  				' is not the latest version'.
  		response = 1 ifFalse: [self closeGroup.  ^ nil]].	"abort"
  
  	"Get the old export updates.list."
  	expContents :=  UpdateStreamDownloader default parseListContents: 
  			(myServers first getFileNamed: 'updates.list').
  	expVersIndex := (expContents collect: [:pair | pair first]) indexOf: version.
  	expVersIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for your version'.
  		self closeGroup.  ^ nil].	"abort"
  	lastNum := (expContents at: expVersIndex) last isEmpty
  		ifTrue: [0]  "no checking if the current list is empty"
  		ifFalse: [(expContents at: expVersIndex) last last initialIntegerOrNil].
  
  	"Save old copy of updates.list on local disk"
  	FileDirectory default deleteFileNamed: 'updates.list.bk'.
  	UpdateStreamDownloader default writeList: expContents toStream: (FileStream fileNamed: 'updates.list.bk').
  
  	"Append all fileNames in my list that are not in the export list"
  	additions := OrderedCollection new.
  	(listContents at: versIndex) last do:
  		[:fileName | | seq | seq := fileName initialIntegerOrNil.
  		(seq > lastNum and: [(skipList includes: seq) not]) ifTrue:
  			[additions addLast: fileName]].
  	expContents at: expVersIndex put:
  		{version. (expContents at: expVersIndex) last , additions}.
  	(self confirm: 'Do you really want to export ' , additions size printString , ' recent updates?')
  		ifFalse: [self closeGroup.  ^ nil].	"abort"
  
  	"Write a new copy of updates.list on all servers..."
  	updateStrm := ReadStream on:
+ 		(String streamContents: [:s | UpdateStreamDownloader default writeList: expContents toStream: s]).
- 		(String streamContents: [:s | Utilities writeList: expContents toStream: s]).
  	myServers do:
  		[:aServer |
  		updateStrm reset.
  		aServer putFile: updateStrm named: 'updates.list' retry: true.
  		Transcript show: 'Update succeeded on server ', aServer moniker; cr].
  	self closeGroup.
  		
  	Transcript cr; show: 'Be sure to test your new update!!'; cr.
  !

Item was changed:
  ----- Method: ServerDirectory>>putUpdate: (in category '*UpdateStream-updating') -----
  putUpdate: fileStrm
  	"Put this file out as an Update on the servers of my group.  Each version of the system may have its own set of update files, or they may all share the same files.  'updates.list' holds the master list.  Each update is a fileIn whose name begins with a number.  See Utilities class readServerUpdatesThrough:saveLocally:updateImage:.
  	When two sets of updates are stored on the same directory, one of them has a * in its 
  serverUrls description.  When that is true, the first word of the description is put on
  the front of 'updates.list', and that index file is used."
  
  	| myServers updateStrm newName response localName seq indexPrefix listContents version versIndex lastNum stripped |
  	localName := fileStrm localName.
  	fileStrm size = 0 ifTrue:
  		[^ self inform: 'That file has zero bytes!!  May have a new name.'].
  	(fileStrm contentsOfEntireFile includes: Character linefeed)
  		ifTrue: [self notify:  'That file contains linefeeds.  Proceed if...
  you know that this is okay (e.g. the file contains raw binary data).'].
  	fileStrm reset.
  	(self checkNames: {localName}) ifFalse: [^ nil].	"illegal characters"
  	response := UIManager default chooseFrom: #('Install update' 'Cancel update')
  		title: 'Do you really want to broadcast the file ', localName, 
  			'\to every Squeak user who updates from ' withCRs, self groupName, '?'.
  	response = 1 ifFalse: [^ nil].	"abort"
  
  	self openGroup.
  	indexPrefix := (self groupName includes: $*) 
  		ifTrue: [(self groupName findTokens: ' ') first]	"special for internal updates"
  		ifFalse: ['']. 	"normal"
  	myServers := self checkServersWithPrefix: indexPrefix
  					andParseListInto: [:x | listContents := x].
  	myServers size = 0 ifTrue: [self closeGroup.  ^ self].
  
  	version := SystemVersion current version.
  	versIndex := (listContents collect: [:pair | pair first]) indexOf: version.
  	versIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for your version'.
  		self closeGroup.  ^ nil].	"abort"
  
  	"A few affirmations..."
  	versIndex < listContents size ifTrue:
  		[(self confirm: 'This system, ', version ,
  				' is not the latest version.\Make update for an older version?' withCRs)
  			ifFalse: [self closeGroup.  ^ nil]].	"abort"
  	(listContents at: versIndex) last isEmpty ifTrue:
  		[(self confirm: 'Please confirm that you mean to issue the first update for ' ,
  						version , '\(otherwise something is wrong).' withCRs)
  			ifFalse: [self closeGroup.  ^ nil]].
  
  	"We now determine next update number to be max of entire index"
  	lastNum := listContents inject: 0 into:
  		[:max :pair | pair last isEmpty
  					ifTrue: [max]
  					ifFalse: [max max: pair last last initialIntegerOrNil]].
  
  	"Save old copy of updates.list on local disk"
  	FileDirectory default deleteFileNamed: indexPrefix , 'updates.list.bk'.
  	UpdateStreamDownloader default writeList: listContents toStream: (FileStream fileNamed: indexPrefix , 'updates.list.bk').
  
  	"append name to updates with new sequence number"
  	seq := (lastNum + 1) printString padded: #left to: 4 with: $0.
  	"strip off any old seq number"
  	stripped := localName copyFrom: (localName  findFirst: [:c | c isDigit not]) to: localName size.
  	newName := seq , stripped.
  	listContents at: versIndex put:
  		{version. (listContents at: versIndex) last copyWith: newName}.
  
  	"Write a new copy on all servers..."
  	updateStrm := ReadStream on:
+ 		(String streamContents: [:s | UpdateStreamDownloader default writeList: listContents toStream: s]).
- 		(String streamContents: [:s | Utilities writeList: listContents toStream: s]).
  	myServers do:
  		[:aServer |
  		fileStrm reset.	"reopen"
  		aServer putFile: fileStrm named: newName retry: true.
  		updateStrm reset.
  		aServer putFile: updateStrm named: indexPrefix , 'updates.list' retry: true.
  		Transcript show: 'Update succeeded on server ', aServer moniker; cr].
  	self closeGroup.
  		
  	Transcript cr; show: 'Be sure to test your new update!!'; cr.
  	"rename the file locally (may fail)"
  	fileStrm directory rename: localName toBe: newName.
  !

Item was changed:
  ----- Method: ServerDirectory>>putUpdateMulti:fromDirectory: (in category '*UpdateStream-updating') -----
  putUpdateMulti: list fromDirectory: updateDirectory 
  	"Put these files out as an Update on the servers of my group.  List is an array of local file names with or without number prefixes.  Each version of the system has its own set of update files.  'updates.list' holds the master list.  Each update is a fileIn whose name begins with a number.  See Utilities class absorbUpdatesFromServer."
  
  	| myServers updateStrm lastNum response newNames numStr indexPrefix version versIndex listContents |
  	(self checkNames: (list collect: "Check the names without their numbers"
  		[:each | each copyFrom: (each findFirst: [:c | c isDigit not]) to: each size]))
  		ifFalse: [^ nil].
  	response := UIManager default chooseFrom: #('Install update' 'Cancel update')
  		title: 'Do you really want to broadcast ', list size printString, ' updates',
  			'\to every Squeak user who updates from ' withCRs, self groupName, '?'.
  	response = 1 ifFalse: [^ nil].	"abort"
  
  	self openGroup.
  	indexPrefix := (self groupName includes: $*) 
  		ifTrue: [(self groupName findTokens: ' ') first]	"special for internal updates"
  		ifFalse: ['']. 	"normal"
  	myServers := self checkServersWithPrefix: indexPrefix
  					andParseListInto: [:x | listContents := x].
  	myServers size = 0 ifTrue: [self closeGroup.  ^ self].
  
  	version := SystemVersion current version.
  	versIndex := (listContents collect: [:pair | pair first]) indexOf: version.
  	versIndex = 0 ifTrue:
  		[self inform: 'There is no section in updates.list for your version'.
  		self closeGroup.  ^ nil].	"abort"
  	lastNum := (listContents at: versIndex) last last initialIntegerOrNil.
  	versIndex < listContents size ifTrue:
  		[response := UIManager default chooseFrom: #('Make update for an older version' 'Cancel update')
  			title: 'This system, ', SystemVersion current version,
  				' is not the latest version'.
  		response = 1 ifFalse: [self closeGroup.  ^ nil].
  		numStr := UIManager default 
  			request: 'Please confirm or change the starting update number' 
  			initialAnswer: (lastNum+1) printString.
  		lastNum := numStr asNumber - 1].	"abort"
  	"Save old copy of updates.list on local disk"
  	FileDirectory default deleteFileNamed: indexPrefix , 'updates.list.bk'.
  	UpdateStreamDownloader default writeList: listContents toStream: (FileStream fileNamed: indexPrefix , 'updates.list.bk').
  
  	"Append names to updates with new sequence numbers"
  	newNames := list with: (lastNum+1 to: lastNum+list size) collect:
  		[:each :num | | stripped seq | seq := num printString padded: #left to: 4 with: $0.
  		"strip off any old seq number"
  		stripped := each copyFrom: (each  findFirst: [:c | c isDigit not]) to: each size.
  		seq , stripped].
  	listContents at: versIndex put:
  		{version. (listContents at: versIndex) second , newNames}.
  
  	"Write a new copy on all servers..."
  	updateStrm := ReadStream on:
+ 		(String streamContents: [:s | UpdateStreamDownloader default writeList: listContents toStream: s]).
- 		(String streamContents: [:s | Utilities writeList: listContents toStream: s]).
  	myServers do:
  		[:aServer |
  		list doWithIndex: [:local :ind | | file |
  			file := updateDirectory oldFileNamed: local.
  			aServer putFile: file named: (newNames at: ind) retry: true.
  			file close].
  		updateStrm reset.
  		aServer putFile: updateStrm named: indexPrefix , 'updates.list' retry: true.
  		Transcript show: 'Update succeeded on server ', aServer moniker; cr].
  	self closeGroup.
  
  	Transcript cr; show: 'Be sure to test your new update!!'; cr.
  	"rename the file locally"
  	list with: newNames do:
  		[:local :newName | updateDirectory rename: local toBe: newName].
  !



More information about the Squeak-dev mailing list