about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-10 01:10:29 -0700
committerbors <bors@rust-lang.org>2013-07-10 01:10:29 -0700
commit8a7b636649db7601bbef90c525eea2a457ba3a8c (patch)
treedb2ed719f8e59cb89c89839f5054365665696a59 /src
parentb5e9194836cab666163cf97cfbea6a323edad882 (diff)
parentace49442a6aef323d42700da169ac3de32d64c2d (diff)
downloadrust-8a7b636649db7601bbef90c525eea2a457ba3a8c.tar.gz
rust-8a7b636649db7601bbef90c525eea2a457ba3a8c.zip
auto merge of #7637 : pnkfelix/rust/fsk-guard-against-stale-libraries-issue3225-safeguarded, r=graydon
When building Rust libraries (e.g. librustc, libstd, etc), checks for
and verbosely removes previous build products before invoking rustc.
(Also, when Make variable VERBOSE is defined, it will list all of the
libraries matching the object library's glob after the rustc
invocation has completed.)

When installing Rust libraries, checks for previous libraries in
target install directory, but does not remove them.

The thinking behind these two different modes of operation is that the
installation target, unlike the build tree, is not under the control
of this infrastructure and it is not up to this Makefile to decide if
the previous libraries should be removed.

Fixes #3225 (at least in terms of mitigating the multiple library
problem by proactively warning the user about it.)

Diffstat (limited to 'src')
-rwxr-xr-xsrc/etc/get-snapshot.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py
index 130ace64ce4..af1a6d6da7b 100755
--- a/src/etc/get-snapshot.py
+++ b/src/etc/get-snapshot.py
@@ -8,9 +8,20 @@ def unpack_snapshot(triple, dl_path):
   print("opening snapshot " + dl_path)
   tar = tarfile.open(dl_path)
   kernel = get_kernel(triple)
+
+  stagep = os.path.join(triple, "stage0")
+
+  # Remove files from prior unpackings, since snapshot rustc may not
+  # be able to disambiguate between multiple candidate libraries.
+  # (Leave dirs in place since extracting step still needs them.)
+  for root, _, files in os.walk(stagep):
+    for f in files:
+      print("removing " + os.path.join(root, f))
+      os.unlink(os.path.join(root, f))
+
   for p in tar.getnames():
     name = p.replace("rust-stage0/", "", 1);
-    stagep = os.path.join(triple, "stage0")
+
     fp = os.path.join(stagep, name)
     print("extracting " + p)
     tar.extract(p, download_unpack_base)