stop using old tempdir crate

This commit is contained in:
Scott Lamb 2021-05-17 13:08:01 -07:00
parent 13b497e243
commit 603f02b686
7 changed files with 30 additions and 61 deletions

69
server/Cargo.lock generated
View File

@ -653,12 +653,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3958af68a31b1d1384d3f39b6aa33eb14b6009065b5ca305ddd9712a4237124f" checksum = "3958af68a31b1d1384d3f39b6aa33eb14b6009065b5ca305ddd9712a4237124f"
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]] [[package]]
name = "funty" name = "funty"
version = "1.1.0" version = "1.1.0"
@ -1224,7 +1218,7 @@ dependencies = [
"ring", "ring",
"rusqlite", "rusqlite",
"smallvec", "smallvec",
"tempdir", "tempfile",
"time", "time",
"uuid", "uuid",
] ]
@ -1282,7 +1276,7 @@ dependencies = [
"smallvec", "smallvec",
"structopt", "structopt",
"sync_wrapper", "sync_wrapper",
"tempdir", "tempfile",
"time", "time",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
@ -1521,7 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1a5d4e9c205d2c1ae73b84aab6240e98218c0e72e63b50422cfb2d1ca952282" checksum = "c1a5d4e9c205d2c1ae73b84aab6240e98218c0e72e63b50422cfb2d1ca952282"
dependencies = [ dependencies = [
"base64ct", "base64ct",
"rand_core 0.6.2", "rand_core",
"subtle", "subtle",
] ]
@ -1696,19 +1690,6 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.3" version = "0.8.3"
@ -1717,7 +1698,7 @@ checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha",
"rand_core 0.6.2", "rand_core",
"rand_hc", "rand_hc",
] ]
@ -1728,24 +1709,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.6.2", "rand_core",
] ]
[[package]]
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
dependencies = [
"rand_core 0.4.2",
]
[[package]]
name = "rand_core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.2" version = "0.6.2"
@ -1761,7 +1727,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core 0.6.2", "rand_core",
] ]
[[package]] [[package]]
@ -1779,15 +1745,6 @@ dependencies = [
"rawpointer", "rawpointer",
] ]
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
dependencies = [
"rand_core 0.3.1",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.57" version = "0.1.57"
@ -2227,13 +2184,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]] [[package]]
name = "tempdir" name = "tempfile"
version = "0.3.7" version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"rand 0.4.6", "cfg-if 1.0.0",
"libc",
"rand",
"redox_syscall 0.2.8",
"remove_dir_all", "remove_dir_all",
"winapi",
] ]
[[package]] [[package]]
@ -2435,7 +2396,7 @@ dependencies = [
"httparse", "httparse",
"input_buffer", "input_buffer",
"log", "log",
"rand 0.8.3", "rand",
"sha-1", "sha-1",
"thiserror", "thiserror",
"url", "url",

View File

@ -65,7 +65,7 @@ uuid = { version = "0.8", features = ["serde", "std", "v4"] }
[dev-dependencies] [dev-dependencies]
reqwest = { version = "0.11.0", default-features = false, features = ["json"] } reqwest = { version = "0.11.0", default-features = false, features = ["json"] }
tempdir = "0.3" tempfile = "3.2.0"
[profile.dev.package.scrypt] [profile.dev.package.scrypt]
# On an Intel i3-6100U @ 2.30 GHz, a single scrypt password hash takes 7.6 # On an Intel i3-6100U @ 2.30 GHz, a single scrypt password hash takes 7.6

View File

@ -36,7 +36,7 @@ protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
ring = "0.16.2" ring = "0.16.2"
rusqlite = "0.25.3" rusqlite = "0.25.3"
smallvec = "1.0" smallvec = "1.0"
tempdir = "0.3" tempfile = "3.2.0"
time = "0.1" time = "0.1"
uuid = { version = "0.8", features = ["std", "v4"] } uuid = { version = "0.8", features = ["std", "v4"] }
itertools = "0.10.0" itertools = "0.10.0"

View File

@ -2506,7 +2506,10 @@ mod tests {
testutil::init(); testutil::init();
let conn = setup_conn(); let conn = setup_conn();
let db = Database::new(clock::RealClocks {}, conn, true).unwrap(); let db = Database::new(clock::RealClocks {}, conn, true).unwrap();
let tmpdir = tempdir::TempDir::new("moonfire-nvr-test").unwrap(); let tmpdir = tempfile::Builder::new()
.prefix("moonfire-nvr-test")
.tempdir()
.unwrap();
let path = tmpdir.path().to_str().unwrap().to_owned(); let path = tmpdir.path().to_str().unwrap().to_owned();
let sample_file_dir_id = { db.lock() }.add_sample_file_dir(path).unwrap(); let sample_file_dir_id = { db.lock() }.add_sample_file_dir(path).unwrap();
let mut c = CameraChange { let mut c = CameraChange {

View File

@ -15,7 +15,7 @@ use rusqlite;
use std::env; use std::env;
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;
use tempdir::TempDir; use tempfile::TempDir;
use time; use time;
use uuid::Uuid; use uuid::Uuid;
@ -67,7 +67,10 @@ impl<C: Clocks + Clone> TestDb<C> {
} }
pub(crate) fn new_with_flush_if_sec(clocks: C, flush_if_sec: i64) -> Self { pub(crate) fn new_with_flush_if_sec(clocks: C, flush_if_sec: i64) -> Self {
let tmpdir = TempDir::new("moonfire-nvr-test").unwrap(); let tmpdir = tempfile::Builder::new()
.prefix("moonfire-nvr-test")
.tempdir()
.unwrap();
let mut conn = rusqlite::Connection::open_in_memory().unwrap(); let mut conn = rusqlite::Connection::open_in_memory().unwrap();
db::init(&mut conn).unwrap(); db::init(&mut conn).unwrap();

View File

@ -199,7 +199,9 @@ mod tests {
#[test] #[test]
fn upgrade_and_compare() -> Result<(), Error> { fn upgrade_and_compare() -> Result<(), Error> {
testutil::init(); testutil::init();
let tmpdir = tempdir::TempDir::new("moonfire-nvr-test")?; let tmpdir = tempfile::Builder::new()
.prefix("moonfire-nvr-test")
.tempdir()?;
//let path = tmpdir.path().to_str().ok_or_else(|| format_err!("invalid UTF-8"))?.to_owned(); //let path = tmpdir.path().to_str().ok_or_else(|| format_err!("invalid UTF-8"))?.to_owned();
let mut upgraded = new_conn()?; let mut upgraded = new_conn()?;
upgraded.execute_batch(include_str!("v0.sql"))?; upgraded.execute_batch(include_str!("v0.sql"))?;

View File

@ -1045,7 +1045,7 @@ mod tests {
struct Harness { struct Harness {
db: Arc<db::Database<SimulatedClocks>>, db: Arc<db::Database<SimulatedClocks>>,
dir_id: i32, dir_id: i32,
_tmpdir: ::tempdir::TempDir, _tmpdir: ::tempfile::TempDir,
dir: MockDir, dir: MockDir,
channel: super::SyncerChannel<MockFile>, channel: super::SyncerChannel<MockFile>,
syncer: super::Syncer<SimulatedClocks, MockDir>, syncer: super::Syncer<SimulatedClocks, MockDir>,