[squeak-dev] The Inbox: Installer-Core-lrnp.447.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 24 03:42:08 UTC 2022

A new version of Installer-Core was added to project The Inbox:

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

Name: Installer-Core-lrnp.447
Author: lrnp
Time: 23 May 2022, 9:42:06.780598 pm
UUID: 329797ae-a3e0-4567-a259-ab491943a3e5
Ancestors: Installer-Core-cmm.446

harden code to recover Metacello in case of error

In #ensureRecentMetacello, Metacello can become removed from the global dictionary if the process is aborted during load, such as by error or user interrupt.

This patch handles absent dictionary lookup exceptions to recover from this state.

=============== Diff against Installer-Core-cmm.446 ===============

Item was changed:
  ----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----
  	"Copied and adapted from https://github.com/Metacello/metacello/blob/master/README.md"
  	| metacello |
  	((Smalltalk classNamed: #WebClient)
  		ifNil: [ false ]
  		ifNotNil: [ :webClient | 
  			[ (webClient httpHead: 'https://github.com') isSuccess ] 
  				on: Error
  				do: [ false ] ])
  		ifFalse: [ ^self inform: 'Could not connect to "https://github.com".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs ].
  	self isMetacelloInstalled ifFalse: [
  		"Prepare a clean environment for it."
+ 		Smalltalk at: #Metacello ifPresent: [Smalltalk globals removeKey: #Metacello].
- 		Smalltalk globals removeKey: #Metacello.
  		"Get the Metacello configuration (for Squeak users)"
  		Installer gemsource
  			project: 'metacello';
  			addPackage: 'ConfigurationOfMetacello';
  		"Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
  		((Smalltalk classNamed: #ConfigurationOfMetacello) project 
  			version: #'previewBootstrap') load].
  	metacello := Smalltalk classNamed: #Metacello.
  	"Now load latest version of Metacello"
  	metacello new
  		baseline: 'Metacello';
  		repository: 'github://Metacello/metacello:master/repository';
  	metacello new
  		baseline: 'Metacello';
  		repository: 'github://Metacello/metacello:master/repository';
  		load: #('default' 'Metacello-Help').

Item was changed:
  ----- Method: Installer class>>isMetacelloInstalled (in category 'scripts') -----
  	"Squeak is shipped with the global #Metacello referring to lightweight MetacelloStub.  After the first message is sent, the latest Metacello is installed, replacing the stub."
+ 	^ (Smalltalk at: #Metacello ifAbsent: [^ false]) ~= MetacelloStub!
- 	^ (Smalltalk at: #Metacello) ~= MetacelloStub!

More information about the Squeak-dev mailing list