diff options
| author | Palmer Cox <p@lmercox.com> | 2013-10-22 23:16:12 -0400 |
|---|---|---|
| committer | Palmer Cox <p@lmercox.com> | 2013-10-27 21:25:19 -0400 |
| commit | c5f10b47f33f8765aa538c6fca936745e8cf8519 (patch) | |
| tree | cee1a0fc34e22b3fea8e5d17b381cdf03a7f8318 | |
| parent | 2c30fcea82f51271c9e93e27d9442da41cd55c5e (diff) | |
| download | rust-c5f10b47f33f8765aa538c6fca936745e8cf8519.tar.gz rust-c5f10b47f33f8765aa538c6fca936745e8cf8519.zip | |
Update workcache to no longer use Sha1.
| -rw-r--r-- | src/libextra/workcache.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs index 30efecde37f..bdc8b95ad41 100644 --- a/src/libextra/workcache.rs +++ b/src/libextra/workcache.rs @@ -10,10 +10,8 @@ #[allow(missing_doc)]; -use digest::Digest; use json; use json::ToJson; -use sha1::Sha1; use serialize::{Encoder, Encodable, Decoder, Decodable}; use arc::{Arc,RWArc}; use treemap::TreeMap; @@ -23,7 +21,6 @@ use std::{os, str, task}; use std::rt::io; use std::rt::io::Writer; use std::rt::io::Decorator; -use std::rt::io::extensions::ReaderUtil; use std::rt::io::mem::MemWriter; use std::rt::io::file::FileInfo; @@ -276,19 +273,6 @@ fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T { Decodable::decode(&mut decoder) } -fn digest<T:Encodable<json::Encoder>>(t: &T) -> ~str { - let mut sha = ~Sha1::new(); - (*sha).input_str(json_encode(t)); - (*sha).result_str() -} - -fn digest_file(path: &Path) -> ~str { - let mut sha = ~Sha1::new(); - let s = path.open_reader(io::Open).read_to_end(); - (*sha).input(s); - (*sha).result_str() -} - impl Context { pub fn new(db: RWArc<Database>, @@ -497,6 +481,8 @@ impl<'self, T:Send + #[test] fn test() { use std::{os, run}; + use std::rt::io::ReaderUtil; + use std::str::from_utf8_owned; // Create a path to a new file 'filename' in the directory in which // this test is running. @@ -524,8 +510,10 @@ fn test() { let subcx = cx.clone(); let pth = pth.clone(); + let file_content = from_utf8_owned(pth.open_reader(io::Open).read_to_end()); + // FIXME (#9639): This needs to handle non-utf8 paths - prep.declare_input("file", pth.as_str().unwrap(), digest_file(&pth)); + prep.declare_input("file", pth.as_str().unwrap(), file_content); do prep.exec |_exe| { let out = make_path(~"foo.o"); // FIXME (#9639): This needs to handle non-utf8 paths |
