[upforgrabs] tools/update

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Jun 10 07:14:46 PDT 2011


We need a script to update all of dmd's paraphernalia. By this I'm 
putting the task up for grabs and am describing it.

The script would require git to be installed, and would orchestrate git 
commands to freshen the installation. Either a tag can be given, or the 
script would automatically detect the latest "semistable" release, or 
even the script can be told to get the latest and greatest. The exact 
tagging convention is to be defined later.

The trick with such tools is they must "just work". That means wherever 
and however you installed dmd, the script should be able to detect 
everything it needs for a successful update. This means: dmd and rdmd 
binary locations, druntime and phobos library locations, and druntime 
and phobos import locations.

The way I'm thinking this all can be done is by running dmd -v against a 
small do-nothing program that imports one std module, for example 
std.stdio. The run will print (among other things):

binary    dmd
version   v2.054
config    /Users/john/dmd.conf
parse     test
importall test
import    object	(/Users/john/code/dmd/druntime/import/object.di)
import    std.stdio	(/Users/john/code/dmd/phobos/std/stdio.d)
...

Simple parsing reveals the location of the configuration file and the 
locations of druntime and std imports. Further simple parsing of the 
conf file reveals the location of libraries.

With this information in hand, the script goes and fetches the 
appropriate code in the appropriate places.

Also, the tool needs to do all of its work transactionally, i.e. first 
download everything next to the target with an added suffix (e.g. 
".tmp"). Only after a full successful download, the tool would rename 
everything .tmp to its final name (an operation that can't fail under 
most circumstances).

If anyone is willing to take up working on this, it would be great. D 
itself is a great candidate as the language to write the tool in, and 
has the advantage of being more portable than shell scripts.

We'll add the tool to the tools/ repository and offer it with the 
standard distribution.


Thanks,

Andrei



More information about the Digitalmars-d mailing list