Source Tree/Repository revision info for the VM [was Re: [Vm-dev] new Cog VMs available]

David T. Lewis lewis at mail.msen.com
Sat Jul 16 16:20:15 UTC 2011


On Fri, Jul 15, 2011 at 03:48:50PM -0700, Eliot Miranda wrote:
> 
> Hi All,
> 
>     I juts committed a workable scheme for including version info in
> the VM and the Mac .app, checked in on
> http://www.squeakvm.org/svn/squeak/branches/Cog.
> 
> - I've added a file platforms/Cross/vm/sqSCCSVersion.h which is
> included by the platform files that answer the Smalltalk
> getSystemAttribute: information (sqMacMain.c sqUnixMain.c &
> sqWin32Window.c).
> 
> - I've modified the getSystemAttribute: code to answer the revision
> and repository URL in response to getSystemAttribute: 1009.
> 
> - I've added a check-in script that makes sure sqSCCSVersion.h is
> updated (if the script is used) so sqSCCSVersion.h's revision number
> is up-to-date.
> 
> So now e.g. Smalltalk getSystemAttribute: 1009 answers 'r2461
> http://www.squeakvm.org/svn/squeak/branches/Cog'
> 
> The scheme in sqSCCSVersion.h is simple and I hope extensible to other
> repositories such that it is the only file that needs to fork between
> repositories, and then only by altering the following lines to choose
> the relevant repository:
> 
> #define SCCS 0
> #define RCS 0
> #define CVS 0
> #define SUBVERSION 1
> #define BAZAAR 0
> #define MERCURIAL 0
> #define GIT 0
> 
> e.g. choosing the repository on the command line via a Makefile means
> changing lots of makefiles.  So this approach, while not ideal, having
>  file different between different repositories does localise the fork
> to just one file.
> 
> Here's sqSCCSVersion.h in its entirety.  It computes char
> *sourceVersionString(), which is that above.  If this approach makes
> sense to people we can a) standardise on an attribute number (I chose
> 1009 as the next unused number but am open to change if there's a good
> reason), and b) extend sqSCCSVersion.h with the relevant sccs-specific
> code to collect revision and url information for each specific
> repository.  Thoughts, comments?

Hi Eliot,

As an additional suggestion, if you could wire this version information
into #primitiveInterpreterSourceVersion and #primitivePlatformSourceVersion,
it would give a more consistent interface from the image side. Currently
a Squeak image running on an up-to-date interpreter VM gives results
such as:

  Smalltalk vm interpreterSourceVersion ==> '4.7.0'
  Smalltalk vm platformSourceVersion ==> '2438'

This in turn is used by Help->About this System to report information about
the VM, so it would be good if Cog and the interpreter VM could both provide
these two primitives (or maybe just the #primitivePlatformSourceVersion?).

It looks like #primitivePlatformSourceVersion would just need to answer
the results of your new sourceVersionString(). I'm not sure how (or if)
you would want to do #primitiveInterpreterSourceVersion, so maybe that's
a different topic. 

Thanks,
Dave



More information about the Vm-dev mailing list