Enhancement to www-based code updating

Stephen Travis Pope stp at limbo.create.ucsb.edu
Thu May 21 02:13:44 UTC 1998


Hello all,

TedK's methods in class Utilities that make it possible to easily up-load
updates from centralized servers are GREAT! I've made a few enhancements to
better support having more than one package to update, and allowing these
packages to have different versions. Specifically, the code below changes the
data structure used for update URLs to include a package-specific version
number as in:
		#( ('Squeak Update Servers'  'Sqk20Beta'  #('url1' 'url2'))
   			 ('Siren 2.0 Update Server'  'Siren20'  #('url3' 'url4')))"

i.e., for each "package" that is to be updated, there's a name, a version
number, and an array of URLs to check. I've also added methods for adding
packages, and for updating their versions, so that, e.g., a file-in could
tell the image that it's the base-line version X.

My next step will be th make a "package" object with this info and a
prerequisite list...

....enjoy...

stp

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

'From Squeak 2.0 BETA of May 8, 1998 on 21 May 1998 at 1:52:43 pm'!

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 13:32'!
addServerUrlFor: package version: vString at: locations
	"Add an item to the list of server URLs. Format of UpdateUrlLists is 
		#( ('squeak updates' 'version1' #('url1' 'url2'))
   			 ('some other updates' 'versionX' #('url3' 'url4')))"

	"UpdateUrlLists _ OrderedCollection new.
	Utilities addServerUrlFor: 'Squeak Update Servers' 
		version: EToySystem version
		at: #('squeak.cs.uiuc.edu/Squeak2.0/' 'www.webpage.com/~kaehler2/Squeak2.0/')"
	"Utilities addServerUrlFor: 'Siren 2.0 Update Server' 
		version: EToySystem version
		at: #('www.create.ucsb.edu/Siren/')"

	^UpdateUrlLists addLast: (Array with: package with: vString with: locations)! !

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 13:31'!
changeVersionOf: pack to: vers
	"Update the version number of the given package."
	"Utilities changeVersionOf: 'Siren' to: 'Sqk20Beta' "

	| pupd |
	pupd := UpdateUrlLists detect: [ :u | u first includesSubString: pack]
		ifNone: [self error: 'No such package update list as ', pack].
	pupd at: 2 put: vers! !

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 12:35'!
chooseUpdateList
	"When there is more than one set of update servers, let the user choose which we will update from.  Put it at the front of the list."
	"Utilities chooseUpdateList"

	| index him |
	UpdateUrlLists size > 1 ifTrue: [
		index _ (PopUpMenu labelArray: (UpdateUrlLists collect: [:each | each first]) lines: #()) 
			startUpWithCaption: 'Choose a group of servers
from which to fetch updates.'.
		index > 0 ifTrue: [
			him _ UpdateUrlLists at: index.
			UpdateUrlLists removeAt: index.
			UpdateUrlLists addFirst: him]]! !

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 13:25'!
extractThisVersion: list
	"Pull out the part of the list that applies to this version."

	| delims lines ii out |
	delims _ String with: Character cr with: Character linefeed.
	lines _ list findTokens: delims.
	ii _ lines indexOf: '#', UpdateUrlLists first second.
	ii = 0 ifTrue: [^ #()].
	out _ OrderedCollection new.
	[(ii _ ii + 1) <= lines size] whileTrue:
		[(lines at: ii) first == $# ifTrue: [^ out "next version"].
		(lines at: ii) first == $* ifFalse: [out addLast: (lines at: ii)]].	"keep, except comments"
	^out! !

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 13:52'!
resetUpdateUrlLists

	UpdateUrlLists _ OrderedCollection new! !

!Utilities class methodsFor: 'fetching updates' stamp: 'stp 5/21/1998 13:45'!
serverUrls
	"Return the current list of server URLs.  For code updates.
	Format of UpdateUrlLists is 
		#( ('squeak updates' 'versionX' #('url1' 'url2'))
   			 ('some other updates' 'versionY' #('url3' 'url4')))"

	^UpdateUrlLists first last! !


"Do this when done..."

Utilities resetUpdateUrlLists.
Utilities addServerUrlFor: 'Squeak Update Servers' 
	version: EToySystem version
	at: #('squeak.cs.uiuc.edu/Squeak2.0/' 'www.webpage.com/~kaehler2/Squeak2.0/')!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


_ Stephen Travis Pope
_ Center for Research in Electronic Art Technology (CREATE)
_ Dept. of Music, Univ. of California, Santa Barbara (UCSB)
_ stp at create.ucsb.edu,  http://www.create.ucsb.edu/~stp/





More information about the Squeak-dev mailing list