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/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
|
||||
|
@ -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 (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")
|
||||
if len(sys.argv) == 3:
|
||||
dl_path = sys.argv[2]
|
||||
else:
|
||||
raise Exception("bad hash on download")
|
||||
snap = determine_curr_snapshot(triple)
|
||||
dl = os.path.join(download_dir_base, snap)
|
||||
url = download_url_base + "/" + snap
|
||||
print("determined most recent snapshot: " + snap)
|
||||
|
||||
unpack_snapshot(triple, snap)
|
||||
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")
|
||||
|
||||
dl_path = os.path.join(download_dir_base, snap)
|
||||
|
||||
unpack_snapshot(triple, dl_path)
|
||||
|
Loading…
Reference in New Issue
Block a user