[squeak-dev] [ANN] Squeaker: Like Docker, but for Squeak. You know, for kids.

Dale Henrichs dale.henrichs at gemtalksystems.com
Thu Nov 18 18:10:12 UTC 2021


I've been working on a project off and on over the last year called
superDoit[1]. I'm headed towards a v2.0 release soonish, but here is an
example script[2].

I think the cool features are that you can declare script args and embed
the help text in the script. No funky handling of $' when you try to write
help in a smalltalk method:). You can have script methods and script
instance variables (here's my kitchen sink example script[2]) ... the
supporting code simple mashes the different sections together and creates a
class that is executed in the image.

The script can be imported into an image where you can work on the class in
a Browser and then export the script back in superDoit format ...

I'm even using superDoit to drive github actions for Rowan-based
projects[3] ... As an aside I intend to add Rowan support to SmalltalkCI,
but I was able to get the superDoit-based github actions written in a week
:)

Here's an example of the simplest superDoit script:

> rogue:~>cat simplest.solo
> #!/usr/bin/env superdoit_solo
> usage
> -----
> USAGE $basename [--help | -h] [--debug | -D]
> %
> doit
> ^ 3 + 4
> %
> rogue:~>./simplest.solo -h
> -----
> USAGE simplest.solo [--help | -h] [--debug | -D]
> rogue:~>./simplest.solo
> 7
>
and here's an example of using the debugger with a "simplest script" (topaz
is the GemStone command line debugger, but it would be relatively
straightforward to arrange the a Squeak image debugger to be invoked):

>  rogue:~>cat debug.solo
> #!/usr/bin/env superdoit_solo
> usage
> -----
> USAGE $basename [--help | -h] [--debug | -D]
> %
> doit
> ^ 3 foo
> %
> rogue:~>./debug.solo -D
> -----------------------------------------------------
>  Near line 62 of file
> /home/dhenrich/rogue/_homes/rogue/_home/shared/repos/superDoit/gemstone/superdoit.tpz
> GemStone: Error         Nonfatal
> a MessageNotUnderstood occurred (error 2010), a SmallInteger does not
> understand  #'foo'
> Error Category: 231169 [GemStone] Number: 2010  Arg Count: 4 Context : 20
> exception : 104267265
> Arg 1: [104268801 size:3 primitiveSize:3 cls: 110849 Symbol] foo
> Arg 2: [2 size:0 primitiveSize:0 cls: 74241 SmallInteger] 0 == 0x0
> Arg 3: [26 size:0 primitiveSize:0 cls: 74241 SmallInteger] 3 == 0x3
> Arg 4: [104266497 size:0 primitiveSize:0 cls: 66817 Array] anArray
> Stopping at line 62 of
> /home/dhenrich/rogue/_homes/rogue/_home/shared/repos/superDoit/gemstone/superdoit.tpz
> topaz 1> where
> ==> 1 MessageNotUnderstood >> defaultAction         @2 line 3   [methId
> 5550337]
> 2 MessageNotUnderstood (AbstractException) >> _signalWith: @5 line 25
> [methId 3805953]
> 3 MessageNotUnderstood (AbstractException) >> signal @2 line 47   [methId
> 3818753]
> 4 SmallInteger (Object) >> doesNotUnderstand:   @9 line 10   [methId
> 6465537]
> 5 SmallInteger (Object) >> _doesNotUnderstand:args:envId:reason: @8 line
> 14   [methId 6430209]
> 6 Executed Code                                 @2 line 1   [methId
> 104259073]
> 7 GsNMethod >> _executeInContext:               @1 line 9   [methId
> 5777921]
> 8 String >> evaluateInContext:symbolList:       @3 line 10   [methId
> 6208001]
> 9 SuperDoitExecutionClass (SuperDoitExecutionMetadataClass) >> theDoit @4
> line 2   [methId 104255233]
> 10 [] in SuperDoitExecution >> doit              @12 line 7   [methId
> 104192769]
> 11 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44   [methId
> 5921281]
> 12 SuperDoitExecutionClass (SuperDoitExecution) >> doit @2 line 8
> [methId 104309761]
> 13 SuperDoitDoitCommand >> executeAgainst:       @27 line 19   [methId
> 104250625]
> 14 [] in SuperDoitCommandDefinition >> executeAgainst: @7 line 2   [methId
> 104191233]
> 15 OrderedCollection (Collection) >> do:         @5 line 10   [methId
> 3486465]
> 16 SuperDoitCommandDefinition >> executeAgainst: @3 line 2   [methId
> 104159745]
> 17 [] in SuperDoitCommandParser >> parseAndExecuteScriptFile: @22 line 15
>   [methId 104158465]
> 18 [] in AbstractFileReference >> readStreamDo:  @8 line 4   [methId
> 47039745]
> 19 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12   [methId
> 5912577]
> 20 FileReference (AbstractFileReference) >> readStreamDo: @4 line 5
> [methId 42107137]
> 21 SuperDoitCommandParser >> parseAndExecuteScriptFile: @2 line 3
> [methId 104154113]
> 22 SuperDoitCommandParser class >> processInputFile @31 line 22   [methId
> 104165889]
> 23 Executed Code                                 @2 line 6   [methId
> 104189185]
> 24 GsNMethod class >> _gsReturnToC               @1 line 11   [methId
> 5750785]
>   [GsProcess 104313089]
> topaz 1>


The project was aimed at GemStone, but there are chunks of code that are
definitely platform independent and I'd be willing to collaborate with
someone from the Squeak community to add Squeak support, if anyone wanted
to build a Squeak variant of superDoit ...

The shebang script (#!/usr/bin/env superdoit_solo[4]) is pretty simple and
would probably be even simpler for Squeak :)

Dale

[1] https://github.com/dalehenrich/superDoit/tree/v2.0#superdoit\
[2]
https://github.com/dalehenrich/superDoit/blob/v2.0/examples/kitchenSink/commonCommandExample.stone
[3]
https://github.com/GsDevKit/OrderedDictionary/blob/rowanize/.github/workflows/ci.yml#L24-L36
[4] https://github.com/dalehenrich/superDoit/blob/v2.0/bin/superdoit_solo

On Thu, Nov 18, 2021 at 9:27 AM Eliot Miranda <eliot.miranda at gmail.com>
wrote:

>
>
> > On Nov 18, 2021, at 2:50 AM, Tony Garnock-Jones <
> tonyg at leastfixedpoint.com> wrote:
> >
> > Heh! Yeah, it could be done from a Squeak with OSProcess loaded. (Part
> of why I picked chunks as the Squeakerfile format...)
> >
> > The utility of docker containers is that they can be wired together. We
> don't have a good story for wiring together Smalltalk images yet. Weird,
> huh?
> >
> > So yeah, not until there's some way of *talking* to a running image that
> doesn't involve *being inside it* will there be much use to an image
> library, or a squeaker-compose-like thing...
>
> There are already a few ways:
> - command-line arguments
> - reading from stdin
> - drop events/launch events
> - reading (eg an ini) file(s)
> - a socket server
>
> And it would be easy to build a Squeak scripting engine scheme that would
> treat #!squeak appropriately
>
> > Cheers,
> >  Tony
> >
> >> On 11/18/21 10:47 AM, Thiede, Christoph wrote:
> >> Nice idea! One could call it a bit pity that you had to write this in
> Python rather than in Squeak itself, but it is the result tthat counts. :-)
> >> Next up: Squeaker Hub, squeaker-compose, and integrated CI support for
> Squeaker images? :D
> >> Best,
> >> Christoph
> >> ------------------------------------------------------------------------
> >> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von Tony Garnock-Jones <tonyg at leastfixedpoint.com>
> >> *Gesendet:* Donnerstag, 18. November 2021 09:42:23
> >> *An:* The general-purpose Squeak developers list
> >> *Betreff:* [squeak-dev] [ANN] Squeaker: Like Docker, but for Squeak.
> You know, for kids.
> >> I found myself in need of a way to script the production of clean images
> >> customised by some sequence of Smalltalk commands. ("Cattle, not pets.")
> >> Presto,
> >> https://github.com/tonyg/squeaker <https://github.com/tonyg/squeaker>
> >>  From the README (https://github.com/tonyg/squeaker#readme <
> https://github.com/tonyg/squeaker#readme>):
> >> ====
> >> It's a small program that helps in automated derivation of configured
> >> Smalltalk images from some fixed base image and a collection of
> >> Smalltalk commands. It's about 500 lines of Python, so far.
> >>   - Squeakerfile.st is like Dockerfile, except it contains locations to
> >> fetch images from plus Smalltalk expressions to derive new images.
> >>   - squeaker build is like docker build. It manages a cache (in
> >> $XDG_CACHE_HOME/squeaker, usually $HOME/.cache/squeaker on Unix) of
> >> downloaded artifacts, derived images, and the stages in each derivation.
> >>   - squeaker run is like docker run. It starts a previously-downloaded
> >> or -derived image in a temporary directory. (Future: support persistent
> >> image instances, like docker does! Easy enough.)
> >>   - squeaker gc is like docker system prune, roughly. It cleans out the
> >> Squeaker cache directory, treating tags as GC roots.
> >> ====
> >> Please try it out and let me know what you think!
> >> Cheers,
> >>    Tony
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211118/a2a7141a/attachment.html>


More information about the Squeak-dev mailing list