allow snapshot to be specified in make command line
This commit is contained in:
parent
8e4c5d2d4d
commit
be9914625b
|
@ -4,7 +4,9 @@ $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \
|
||||||
$(S)src/snapshots.txt \
|
$(S)src/snapshots.txt \
|
||||||
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS)
|
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS)
|
||||||
@$(call E, fetch: $@)
|
@$(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 $@
|
$(Q)touch $@
|
||||||
|
|
||||||
# Host libs will be extracted by the above rule
|
# Host libs will be extracted by the above rule
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
import os, tarfile, hashlib, re, shutil, sys
|
import os, tarfile, hashlib, re, shutil, sys
|
||||||
from snapshot import *
|
from snapshot import *
|
||||||
|
|
||||||
def unpack_snapshot(triple, snap):
|
def unpack_snapshot(triple, dl_path):
|
||||||
dl_path = os.path.join(download_dir_base, snap)
|
|
||||||
print("opening snapshot " + dl_path)
|
print("opening snapshot " + dl_path)
|
||||||
tar = tarfile.open(dl_path)
|
tar = tarfile.open(dl_path)
|
||||||
kernel = get_kernel(triple)
|
kernel = get_kernel(triple)
|
||||||
|
@ -60,18 +59,27 @@ def determine_curr_snapshot(triple):
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
|
|
||||||
triple = sys.argv[1]
|
# this gets called with one or two arguments:
|
||||||
snap = determine_curr_snapshot(triple)
|
# The first is the O/S triple.
|
||||||
dl = os.path.join(download_dir_base, snap)
|
# The second is an optional path to the snapshot to use.
|
||||||
url = download_url_base + "/" + snap
|
|
||||||
print("determined most recent snapshot: " + snap)
|
|
||||||
|
|
||||||
if (not os.path.exists(dl)):
|
triple = sys.argv[1]
|
||||||
|
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)
|
get_url_to_file(url, dl)
|
||||||
|
|
||||||
if (snap_filename_hash_part(snap) == hash_file(dl)):
|
if (snap_filename_hash_part(snap) == hash_file(dl)):
|
||||||
print("got download with ok hash")
|
print("got download with ok hash")
|
||||||
else:
|
else:
|
||||||
raise Exception("bad hash on download")
|
raise Exception("bad hash on download")
|
||||||
|
|
||||||
unpack_snapshot(triple, snap)
|
dl_path = os.path.join(download_dir_base, snap)
|
||||||
|
|
||||||
|
unpack_snapshot(triple, dl_path)
|
||||||
|
|
Loading…
Reference in New Issue