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 /src | |
| parent | 8e4c5d2d4d65253a527742ac9ef40a3f6ca5c3a0 (diff) | |
allow snapshot to be specified in make command line
Diffstat (limited to 'src')
| -rwxr-xr-x | src/etc/get-snapshot.py | 34 |
1 files changed, 21 insertions, 13 deletions
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) |
