Skip to content

Commit 44ccc36

Browse files
committed
update snapshot scripts
1 parent 4b13fdb commit 44ccc36

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

mk/snap.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
snap-stage1: $(HSREQ1_H_$(CFG_HOST_TRIPLE))
3-
$(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage1
3+
$(S)src/etc/make-snapshot.py stage1 $(CFG_HOST_TRIPLE)
44

55
snap-stage2: $(HSREQ2_H_$(CFG_HOST_TRIPLE)
6-
$(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage2
6+
$(S)src/etc/make-snapshot.py stage2 $(CFG_HOST_TRIPLE)
77
88
snap-stage3: $(HSREQ3_H_$(CFG_HOST_TRIPLE)
9-
$(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage3
9+
$(S)src/etc/make-snapshot.py stage3 $(CFG_HOST_TRIPLE)

src/etc/get-snapshot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ def unpack_snapshot(snap):
2020
tar.close()
2121
shutil.rmtree(download_unpack_base)
2222

23-
def determine_curr_snapshot_for_platform():
24-
23+
def determine_curr_snapshot(triple):
2524
i = 0
26-
platform = get_platform()
25+
platform = get_platform(triple)
2726

2827
found_file = False
2928
found_snap = False

src/etc/make-snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env python
22

33
import snapshot, sys
4-
print(snapshot.make_snapshot(sys.argv[1]))
4+
print(snapshot.make_snapshot(sys.argv[1], sys.argv[2]))

src/etc/snapshot.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ def full_snapshot_name(date, rev, platform, hsh):
5454
% (date, rev, platform, hsh))
5555

5656

57-
def get_kernel():
58-
if os.name == "nt" or scrub(os.getenv("CFG_ENABLE_MINGW_CROSS")):
57+
def get_kernel(triple):
58+
os_name = triple.split('-')[-1]
59+
if os_name == "nt" or scrub(os.getenv("CFG_ENABLE_MINGW_CROSS")):
5960
return "winnt"
60-
kernel = os.uname()[0].lower()
61-
if kernel == "darwin":
62-
kernel = "macos"
63-
return kernel
61+
if os_name == "darwin":
62+
return "macos"
63+
return "linux"
6464

65+
def get_cpu(triple):
66+
arch = triple.split('-')[0]
67+
if arch == "i686":
68+
return "i386"
69+
return arch
6570

66-
def get_cpu():
67-
# return os.uname()[-1].lower()
68-
return "i386"
69-
70-
71-
def get_platform():
72-
return "%s-%s" % (get_kernel(), get_cpu())
71+
def get_platform(triple):
72+
return "%s-%s" % (get_kernel(triple), get_cpu(triple))
7373

7474

7575
def cmd_out(cmdline):
@@ -110,9 +110,9 @@ def hash_file(x):
110110
return scrub(h.hexdigest())
111111

112112

113-
def make_snapshot(stage):
114-
kernel = get_kernel()
115-
platform = get_platform()
113+
def make_snapshot(stage, triple):
114+
kernel = get_kernel(triple)
115+
platform = get_platform(triple)
116116
rev = local_rev_short_sha()
117117
date = local_rev_committer_date().split()[0]
118118

@@ -123,7 +123,7 @@ def make_snapshot(stage):
123123
dir = stage
124124
if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
125125
dir = "stage0"
126-
tar.add(os.path.join(dir, name),
126+
tar.add(os.path.join(triple, os.path.join(dir, name)),
127127
"rust-stage0/" + name)
128128
tar.close()
129129

0 commit comments

Comments
 (0)