From: Ian Jackson Date: Sat, 14 May 2022 18:18:59 +0000 (+0100) Subject: support: Move childio and debugmutex X-Git-Tag: otter-1.1.0~171 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=89ab9fcc94013c7ce82583d69e0fbf963f6db438;p=otter.git support: Move childio and debugmutex Signed-off-by: Ian Jackson --- diff --git a/Cargo.lock b/Cargo.lock index 4a8488c5..939464ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2673,7 +2673,6 @@ name = "otter" version = "1.0.0" dependencies = [ "ambassador", - "anyhow", "async-condvar-fair", "backtrace", "base64 0.13.0", @@ -2706,7 +2705,6 @@ dependencies = [ "lazy_static", "libc", "mio 0.8.2", - "nix 0.23.1", "num", "num-derive", "num-traits", @@ -2832,10 +2830,12 @@ dependencies = [ name = "otter-support" version = "1.0.0" dependencies = [ + "anyhow", "chrono", "chrono-tz", "fehler", "log", + "nix 0.23.1", "otter-base", "parking_lot", "serde", diff --git a/Cargo.toml b/Cargo.toml index e696f42f..3e66be3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ bundle-sources="0.0.1" otter-support.path="support" otter-support.version="=1.0.0" -anyhow="1" backtrace="0.3" base64="0.13" boolinator="2" @@ -56,7 +55,6 @@ lazy-init="0.5" lazy-regex="2" lazy_static="1" libc="0.2" -nix="0.23" num="0.4" num-derive="0.3" num-traits="0.2" diff --git a/apitest/apitest.rs b/apitest/apitest.rs index ead6ff0d..3a1979c0 100644 --- a/apitest/apitest.rs +++ b/apitest/apitest.rs @@ -345,6 +345,7 @@ impl Result { pub mod cleanup_notify { use super::crates::*; + use otter_support::crates::*; use super::AE; pub use super::Void; // TODO remove the need for this diff --git a/src/crates.rs b/src/crates.rs index 75a98c1c..03ef76d1 100644 --- a/src/crates.rs +++ b/src/crates.rs @@ -6,7 +6,6 @@ pub use otter_support; -pub use anyhow; pub use async_condvar_fair; pub use base64; pub use boolinator; @@ -25,7 +24,6 @@ pub use lazy_init; pub use lazy_static; pub use inventory; pub use libc; -pub use nix; pub use once_cell; pub use ordered_float; pub use pwd; diff --git a/src/imports.rs b/src/imports.rs index 356609ba..69475c37 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -13,9 +13,6 @@ use otter_base::imports::*; pub use std::any::Any; pub use std::borrow::Cow; pub use std::cmp::{self, max, min, Ordering}; -pub use std::collections::VecDeque; -pub use std::collections::{btree_map, BTreeMap}; -pub use std::collections::{btree_set, BTreeSet}; pub use std::convert::{Infallible, TryFrom, TryInto}; pub use std::env; pub use std::error::Error; @@ -23,26 +20,13 @@ pub use std::ffi::OsStr; pub use std::fmt::Formatter; pub use std::fmt::Write as _; pub use std::fmt::{self, Debug, Display}; -pub use std::fs; -pub use std::fs::File; pub use std::hash::Hash; -pub use std::io; -pub use std::io::ErrorKind; -pub use std::io::{BufRead, BufReader, BufWriter, Read, Write}; pub use std::iter; pub use std::iter::{repeat_with}; pub use std::marker::PhantomData; pub use std::num::{NonZeroUsize, TryFromIntError, Wrapping}; -pub use std::os::linux::fs::MetadataExt as _; // todo why linux for st_mode?? -pub use std::os::unix; -pub use std::os::unix::ffi::OsStrExt; -pub use std::os::unix::fs::{MetadataExt, OpenOptionsExt}; -pub use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd}; -pub use std::os::unix::net::UnixStream; -pub use std::os::unix::process::{CommandExt, ExitStatusExt}; pub use std::net::{IpAddr, SocketAddr, ToSocketAddrs, Ipv6Addr, Ipv4Addr}; pub use std::path::PathBuf; -pub use std::process::{exit, Child, Command, Stdio}; pub use std::str; pub use std::str::FromStr; pub use std::string::ParseError; @@ -51,7 +35,6 @@ pub use std::sync::mpsc; pub use std::thread::{self, sleep}; pub use std::time::{self, Duration, Instant}; -pub use anyhow::{anyhow, ensure, Context}; pub use async_condvar_fair::{Condvar, BatonExt as _}; pub use boolinator::Boolinator as _; pub use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt}; @@ -72,9 +55,6 @@ pub use index_vec::{define_index_type, index_vec, IndexSlice, IndexVec}; pub use lazy_regex::regex; pub use lazy_static::lazy_static; pub use log::{log, log_enabled}; -pub use nix::unistd::{self, Uid}; -pub use nix::sys::time::TimeSpec; -pub use nix::time::clock_gettime; pub use num_derive::{ToPrimitive, FromPrimitive}; pub use num_traits::{Bounded, FromPrimitive, ToPrimitive}; pub use ordered_float::OrderedFloat; @@ -129,14 +109,12 @@ pub use crate::authproofs::{self, Authorisation, Unauthorised}; pub use crate::authproofs::AuthorisationSuperuser; pub use crate::asseturl::*; pub use crate::bundles::{self, InstanceBundles, MgmtBundleListExt}; -pub use crate::childio; pub use crate::commands::{AccessTokenInfo, AccessTokenReport, MgmtError}; pub use crate::commands::{MgmtCommand, MgmtResponse}; pub use crate::commands::{MgmtGameInstruction, MgmtGameResponse}; pub use crate::commands::{MgmtBundleList, MgmtGameUpdateMode}; pub use crate::commands::{ProgressUpdateMode}; pub use crate::config::*; -pub use crate::debugmutex::DebugIdentify; pub use crate::debugreader::DebugReader; pub use crate::digestrw::{self, *}; pub use crate::error::*; @@ -183,8 +161,6 @@ pub const MS: time::Duration = time::Duration::from_millis(1); // ---------- type abbreviations ---------- -pub type AE = anyhow::Error; - // accounts.rs pub type AS = AccountScope; diff --git a/src/lib.rs b/src/lib.rs index d8eaa5df..a7236bea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,6 @@ pub mod accounts; pub mod asseturl; pub mod authproofs; pub mod bundles; -pub mod childio; pub mod clock; pub mod commands; pub mod config; @@ -34,7 +33,6 @@ pub mod currency; pub mod deck; pub mod dice; pub mod digestrw; -pub mod debugmutex; pub mod debugreader; pub mod error; pub mod fastsplit; diff --git a/support/Cargo.toml b/support/Cargo.toml index d748536d..4faca4c3 100644 --- a/support/Cargo.toml +++ b/support/Cargo.toml @@ -26,10 +26,12 @@ path="lib.rs" otter-base.path="../base" otter-base.version="=1.0.0" +anyhow="1" chrono="0.4" chrono-tz="0.6" fehler="1" log="0.4" +nix="0.23" parking_lot="0.12" serde_with="1" diff --git a/src/childio.rs b/support/childio.rs similarity index 100% rename from src/childio.rs rename to support/childio.rs diff --git a/support/crates.rs b/support/crates.rs index ee60990c..f2a74b42 100644 --- a/support/crates.rs +++ b/support/crates.rs @@ -6,7 +6,9 @@ pub use otter_base; +pub use anyhow; pub use chrono; pub use chrono_tz; pub use log; +pub use nix; pub use parking_lot; diff --git a/src/debugmutex.rs b/support/debugmutex.rs similarity index 100% rename from src/debugmutex.rs rename to support/debugmutex.rs diff --git a/support/imports.rs b/support/imports.rs index 5b7eae4c..7da91605 100644 --- a/support/imports.rs +++ b/support/imports.rs @@ -5,9 +5,29 @@ // See Import Structure Doctrine in src/prelude.rs pub use std::collections::{hash_map, HashMap, HashSet}; +pub use std::collections::VecDeque; +pub use std::collections::{btree_map, BTreeMap}; +pub use std::collections::{btree_set, BTreeSet}; +pub use std::fs; +pub use std::fs::File; +pub use std::io; +pub use std::io::ErrorKind; +pub use std::io::{BufRead, BufReader, BufWriter, Read, Write}; +pub use std::os::linux::fs::MetadataExt as _; // todo why linux for st_mode?? +pub use std::os::unix; +pub use std::os::unix::ffi::OsStrExt; +pub use std::os::unix::fs::{MetadataExt, OpenOptionsExt}; +pub use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd}; +pub use std::os::unix::net::UnixStream; +pub use std::os::unix::process::{CommandExt, ExitStatusExt}; +pub use std::process::{exit, Child, Command, Stdio}; pub use std::sync::Arc; +pub use anyhow::{anyhow, ensure, Context}; pub use log::{debug, error, info, trace, warn}; +pub use nix::unistd::{self, Uid}; +pub use nix::sys::time::TimeSpec; +pub use nix::time::clock_gettime; pub use serde::ser::SerializeTuple; pub use serde::{de::DeserializeOwned, Deserialize, Serialize}; pub use serde::de::Error as _; @@ -22,6 +42,11 @@ pub use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; pub use parking_lot::{Mutex, MutexGuard}; //pub use crate::debugmutex::{Mutex, MutexGuard}; +pub use crate::childio; +pub use crate::debugmutex::DebugIdentify; pub use crate::support::*; pub use crate::tz::*; +// ---------- type abbreviations ---------- + +pub type AE = anyhow::Error; diff --git a/support/lib.rs b/support/lib.rs index 1fff09c5..6b467cd9 100644 --- a/support/lib.rs +++ b/support/lib.rs @@ -6,5 +6,7 @@ pub mod crates; pub mod imports; pub mod prelude; +pub mod childio; +pub mod debugmutex; pub mod support; pub mod tz;