Rust's simple download script

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 20 09:43:12 PST 2015


On Thursday, 19 November 2015 at 07:58:52 UTC, Jacob Carlborg 
wrote:
> DVM already does all this. Why reinvent the wheel?

Because we already have the code for Travis-CI and Heroku.
Also an intransparent binary is yet another hurdle trying to 
convince someone to try out D.

BTW, I hust tried to use dvm.

The linux binary doesn't work for my distribution (Fedora).
./dvm: error while loading shared libraries: libbz2.so.1.0: 
cannot open shared object file: No such file or directory

Compiling dvm with the latest dmd fails.

../../.dub/packages/tango-1.0.1_2.067/tango/io/vfs/ZipFolder.d(302,27): Error: function tango.io.vfs.ZipFolder.ZipSubFolder.toString cannot have an in contract when overriden function object.Object.toString does not have an in contract
../../.dub/packages/tango-1.0.1_2.067/tango/io/vfs/ZipFolder.d(977,27): Error: function tango.io.vfs.ZipFolder.ZipFile.toString cannot have an in contract when overriden function object.Object.toString does not have an in contract

Not too surprising given the amount of code, the number of 
dependencies, and the lack of any CI testing.
I managed to build dvm using dmd-2.067.0 (as indicated by the 
tango dependency).
Apart from the fact that dvm --help offers weird choices (-t, 
--tango      Installs Tango as the standard library.), dvm 
install --help or dvm --help don't explain how to install a 
compiler.

dvm install dmd-2.068.2

tango.core.Exception.IOException at ../../.dub/packages/tango-1.0.1_2.067/tango/core/Exception.d(59): The resource with URL "http://ftp.digitalmars.com/dmd.dmd-2.068.2.zip" could not be found.

dvm install -l

An error occurred: 
dvm.dvm.Exceptions.DvmException at .dub/packages/dvm-0.4.4/dvm/commands/Fetch.d(270): Failed to get the latest DMD version.

dvm install -l -v # doesn't tell me either what fails
Looking at strace it seems you're trying to parse 
http://dlang.org/download.html, please just use 
http://ftp.digitalmars.com/LATEST instead.

After some trial and error it fails to install the selected 
compiler (and doesn't use the much smaller tar.xz downloads btw).

dvm install 2.068.2

Fetching: 
http://downloads.dlang.org/releases/2.x/2.068.2/dmd.2.068.2.linux.zip
[========================================>] 25969/25335 KB

Installing: dmd-2.068.2
An unknown error occurred:
tango.core.Exception.IOException at ../../.dub/packages/tango-1.0.1_2.067/tango/core/Exception.d(59): /home/dawg/.dvm/bin/dmd-2.068.2 :: No such file or directory

All of the above, plus the ability to install gdc/ldc and verify 
downloaded dmd binaries, are achieved by a ~500LOC bash script.

Of course downloading and installing dmd used to be a lot more 
chaotic when DVM was originally written. But making installations 
more scriptable is a direct outcome of writing such scripts, 
which works much better than building complex tools to deal with 
inconsistencies.


More information about the Digitalmars-d mailing list