[Modules][ENH?][Experimental] The modular major shrink

danielv at netvision.net.il danielv at netvision.net.il
Sat May 18 23:10:00 UTC 2002


One of the promised benefits of modules is a clean nice shrink that
doesn't leave broken references. 

The script below should do just that - it brings a 4857 image + Henriks
modules updates + my CarefulModules from ~275 to 231 modules. So we're
well on our way, but with lots of modules yet to go...

One anomaly I know of but I can't explain is that it leaves 
#(Squeak EToy Scripting References) and #(Squeak Media Speech Support)
untouched, despite being apparently good candidates for removal (after
the script is run, anyway).

Of course, this will fill up your RepositoryCache, and probably make a
mess of your image.

Daniel

"Very Important! Don't access online repositories!"
Preferences disable: #accessOnlineModuleRepositories.

"Some things should not be removed, no matter what"
coreModules _ {Module root}, Module root submodules.

"Find the initial candidates. This is very inefficient and takes quite a
while"
candidates _ Module root deepSubmodules reversed select: [:e | (e
deepIncomingRefsFromOutside: e) size = 0].

"Shake modules off iteratively"
[toRemove _ candidates copyWithoutAll: coreModules. toRemove notEmpty]
whileTrue: [
toRemove do: [:e | e deepDeclareExternalRefs].
nextRound _ (toRemove inject: OrderedCollection new into: [:s :e | e
importedModules, s, {e parentModule}]) asSet.
toRemove do: [:e | e repository beStandalone].
toRemove do: [:e | ModuleInstaller upload: e].
toRemove do: [:e | Transcript show: e; cr].
toRemove do: [:e | ModuleInstaller unload: e].
candidates _ nextRound select: [:e | e valid and: [(e
deepIncomingRefsFromOutside: e) size = 0]]]



More information about the Squeak-dev mailing list