diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-02-09 17:58:09 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-02-24 20:46:27 -0800 |
| commit | be9914625b0cbf5f305c5af3adbc6bc337ae760e (patch) | |
| tree | 5aa378002d30e654c2cdd281e86172ada8748c1b | |
| parent | 8e4c5d2d4d65253a527742ac9ef40a3f6ca5c3a0 (diff) | |
| download | rust-be9914625b0cbf5f305c5af3adbc6bc337ae760e.tar.gz rust-be9914625b0cbf5f305c5af3adbc6bc337ae760e.zip | |
allow snapshot to be specified in make command line
| -rw-r--r-- | mk/stage0.mk | 4 | ||||
| -rwxr-xr-x | src/etc/get-snapshot.py | 34 |
2 files changed, 24 insertions, 14 deletions
diff --git a/mk/stage0.mk b/mk/stage0.mk index 66dafc92be7..b790c2f9f2d 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -4,7 +4,9 @@ $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \ $(S)src/snapshots.txt \ $(S)src/etc/get-snapshot.py $(MKFILE_DEPS) @$(call E, fetch: $@) - $(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) +# Note: the variable "SNAPSHOT_FILE" is generally not set, and so +# we generally only pass one argument to this script. + $(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(SNAPSHOT_FILE) $(Q)touch $@ # Host libs will be extracted by the above rule diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py index 8c85e5b8e39..643cd0fcdd6 100755 --- a/src/etc/get-snapshot.py +++ b/src/etc/get-snapshot.py @@ -3,8 +3,7 @@ import os, tarfile, hashlib, re, shutil, sys from snapshot import * -def unpack_snapshot(triple, snap): - dl_path = os.path.join(download_dir_base, snap) +def unpack_snapshot(triple, dl_path): print("opening snapshot " + dl_path) tar = tarfile.open(dl_path) kernel = get_kernel(triple) @@ -60,18 +59,27 @@ def determine_curr_snapshot(triple): # Main +# this gets called with one or two arguments: +# The first is the O/S triple. +# The second is an optional path to the snapshot to use. + triple = sys.argv[1] -snap = determine_curr_snapshot(triple) -dl = os.path.join(download_dir_base, snap) -url = download_url_base + "/" + snap -print("determined most recent snapshot: " + snap) +if len(sys.argv) == 3: + dl_path = sys.argv[2] +else: + snap = determine_curr_snapshot(triple) + dl = os.path.join(download_dir_base, snap) + url = download_url_base + "/" + snap + print("determined most recent snapshot: " + snap) -if (not os.path.exists(dl)): - get_url_to_file(url, dl) + if (not os.path.exists(dl)): + get_url_to_file(url, dl) -if (snap_filename_hash_part(snap) == hash_file(dl)): - print("got download with ok hash") -else: - raise Exception("bad hash on download") + if (snap_filename_hash_part(snap) == hash_file(dl)): + print("got download with ok hash") + else: + raise Exception("bad hash on download") + + dl_path = os.path.join(download_dir_base, snap) -unpack_snapshot(triple, snap) +unpack_snapshot(triple, dl_path) |
