]> git.lizzy.rs Git - rust.git/commitdiff
update snapshot scripts
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 28 Nov 2011 14:06:32 +0000 (06:06 -0800)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 29 Nov 2011 20:51:10 +0000 (12:51 -0800)
mk/snap.mk
src/etc/get-snapshot.py
src/etc/make-snapshot.py
src/etc/snapshot.py

index 8fa0a43b3a77beed8753f9f9d8d86b3a4ad64f63..b718928d0b6725a5222a2d877c5c6028e9198dad 100644 (file)
@@ -1,9 +1,9 @@
 
 snap-stage1: $(HSREQ1_H_$(CFG_HOST_TRIPLE))
-       $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage1
+       $(S)src/etc/make-snapshot.py stage1 $(CFG_HOST_TRIPLE)
 
 snap-stage2: $(HSREQ2_H_$(CFG_HOST_TRIPLE)
-       $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage2
+       $(S)src/etc/make-snapshot.py stage2 $(CFG_HOST_TRIPLE)
 
 snap-stage3: $(HSREQ3_H_$(CFG_HOST_TRIPLE)
-       $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage3
+       $(S)src/etc/make-snapshot.py stage3 $(CFG_HOST_TRIPLE)
index 5c0dec8eb411f6a9c18d204e1fad6d07f5ae3bbb..0ec9cca6fd032069f10f55537d35d8f4a3a32582 100755 (executable)
@@ -20,10 +20,9 @@ def unpack_snapshot(snap):
   tar.close()
   shutil.rmtree(download_unpack_base)
 
-def determine_curr_snapshot_for_platform():
-
+def determine_curr_snapshot(triple):
   i = 0
-  platform = get_platform()
+  platform = get_platform(triple)
 
   found_file = False
   found_snap = False
index d46500cdf1191858354ca4d8902354fbae3ff2cd..40f42bd790a918b6519508a5d78eb2d86685fee3 100755 (executable)
@@ -1,4 +1,4 @@
 #!/usr/bin/env python
 
 import snapshot, sys
-print(snapshot.make_snapshot(sys.argv[1]))
+print(snapshot.make_snapshot(sys.argv[1], sys.argv[2]))
index c962e66dff431b8a32f3a7f698039b917d4a44f3..3ee3ca36e63be62d7049df358187b5a0873b1542 100644 (file)
@@ -54,22 +54,22 @@ def full_snapshot_name(date, rev, platform, hsh):
           % (date, rev, platform, hsh))
 
 
-def get_kernel():
-    if os.name == "nt" or scrub(os.getenv("CFG_ENABLE_MINGW_CROSS")):
+def get_kernel(triple):
+    os_name = triple.split('-')[-1]
+    if os_name == "nt" or scrub(os.getenv("CFG_ENABLE_MINGW_CROSS")):
         return "winnt"
-    kernel = os.uname()[0].lower()
-    if kernel == "darwin":
-        kernel = "macos"
-    return kernel
+    if os_name == "darwin":
+        return "macos"
+    return "linux"
 
+def get_cpu(triple):
+    arch = triple.split('-')[0]
+    if arch == "i686":
+      return "i386"
+    return arch
 
-def get_cpu():
-    # return os.uname()[-1].lower()
-    return "i386"
-
-
-def get_platform():
-  return "%s-%s" % (get_kernel(), get_cpu())
+def get_platform(triple):
+  return "%s-%s" % (get_kernel(triple), get_cpu(triple))
 
 
 def cmd_out(cmdline):
@@ -110,9 +110,9 @@ def hash_file(x):
     return scrub(h.hexdigest())
 
 
-def make_snapshot(stage):
-    kernel = get_kernel()
-    platform = get_platform()
+def make_snapshot(stage, triple):
+    kernel = get_kernel(triple)
+    platform = get_platform(triple)
     rev = local_rev_short_sha()
     date = local_rev_committer_date().split()[0]
 
@@ -123,7 +123,7 @@ def make_snapshot(stage):
       dir = stage
       if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
         dir = "stage0"
-      tar.add(os.path.join(dir, name),
+      tar.add(os.path.join(triple, os.path.join(dir, name)),
               "rust-stage0/" + name)
     tar.close()