mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
Move Sha256 to cargo-util.
This commit is contained in:
parent
1dae5acb7d
commit
4aa1ec2419
|
@ -25,7 +25,6 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
|
|||
cargo-util = { path = "crates/cargo-util", version = "0.1.0" }
|
||||
crates-io = { path = "crates/crates-io", version = "0.33.0" }
|
||||
crossbeam-utils = "0.8"
|
||||
crypto-hash = "0.3.1"
|
||||
curl = { version = "0.4.23", features = ["http2"] }
|
||||
curl-sys = "0.4.22"
|
||||
env_logger = "0.8.1"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::git::repo;
|
||||
use crate::paths;
|
||||
use cargo::sources::CRATES_IO_INDEX;
|
||||
use cargo::util::Sha256;
|
||||
use cargo_util::Sha256;
|
||||
use flate2::write::GzEncoder;
|
||||
use flate2::Compression;
|
||||
use std::collections::BTreeMap;
|
||||
|
|
|
@ -10,7 +10,9 @@ description = "Miscellaneous support code used by Cargo."
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0.34"
|
||||
crypto-hash = "0.3.1"
|
||||
filetime = "0.2.9"
|
||||
hex = "0.4.2"
|
||||
jobserver = "0.1.21"
|
||||
libc = "0.2.88"
|
||||
log = "0.4.6"
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
pub use self::read2::read2;
|
||||
pub use process_builder::ProcessBuilder;
|
||||
pub use process_error::{exit_status_to_string, is_simple_exit_code, ProcessError};
|
||||
pub use sha256::Sha256;
|
||||
|
||||
pub mod paths;
|
||||
mod process_builder;
|
||||
mod process_error;
|
||||
mod read2;
|
||||
mod sha256;
|
||||
|
||||
/// Whether or not this running in a Continuous Integration environment.
|
||||
pub fn is_ci() -> bool {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::util::{CargoResult, CargoResultExt};
|
||||
use cargo_util::paths;
|
||||
use super::paths;
|
||||
use anyhow::{Context, Result};
|
||||
use crypto_hash::{Algorithm, Hasher};
|
||||
use std::fs::File;
|
||||
use std::io::{self, Read, Write};
|
||||
|
@ -29,11 +29,11 @@ impl Sha256 {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update_path<P: AsRef<Path>>(&mut self, path: P) -> CargoResult<&mut Sha256> {
|
||||
pub fn update_path<P: AsRef<Path>>(&mut self, path: P) -> Result<&mut Sha256> {
|
||||
let path = path.as_ref();
|
||||
let file = paths::open(path)?;
|
||||
self.update_file(&file)
|
||||
.chain_err(|| format!("failed to read `{}`", path.display()))?;
|
||||
.with_context(|| format!("failed to read `{}`", path.display()))?;
|
||||
Ok(self)
|
||||
}
|
||||
|
|
@ -2,10 +2,9 @@ use crate::core::shell::Verbosity;
|
|||
use crate::core::{GitReference, Workspace};
|
||||
use crate::ops;
|
||||
use crate::sources::path::PathSource;
|
||||
use crate::util::Sha256;
|
||||
use crate::util::{CargoResult, CargoResultExt, Config};
|
||||
use anyhow::bail;
|
||||
use cargo_util::paths;
|
||||
use cargo_util::{paths, Sha256};
|
||||
use serde::Serialize;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
||||
|
|
|
@ -6,8 +6,8 @@ use crate::core::source::MaybePackage;
|
|||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{Config, Sha256};
|
||||
use cargo_util::paths;
|
||||
use crate::util::Config;
|
||||
use cargo_util::{paths, Sha256};
|
||||
use serde::Deserialize;
|
||||
|
||||
pub struct DirectorySource<'cfg> {
|
||||
|
|
|
@ -2,8 +2,8 @@ use crate::core::PackageId;
|
|||
use crate::sources::registry::{MaybeLock, RegistryConfig, RegistryData};
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::interning::InternedString;
|
||||
use crate::util::{Config, Filesystem, Sha256};
|
||||
use cargo_util::paths;
|
||||
use crate::util::{Config, Filesystem};
|
||||
use cargo_util::{paths, Sha256};
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::io::SeekFrom;
|
||||
|
|
|
@ -7,8 +7,8 @@ use crate::sources::registry::{
|
|||
};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::interning::InternedString;
|
||||
use crate::util::{Config, Filesystem, Sha256};
|
||||
use cargo_util::paths;
|
||||
use crate::util::{Config, Filesystem};
|
||||
use cargo_util::{paths, Sha256};
|
||||
use lazycell::LazyCell;
|
||||
use log::{debug, trace};
|
||||
use std::cell::{Cell, Ref, RefCell};
|
||||
|
|
|
@ -18,7 +18,6 @@ pub use self::progress::{Progress, ProgressStyle};
|
|||
pub use self::queue::Queue;
|
||||
pub use self::restricted_names::validate_package_name;
|
||||
pub use self::rustc::Rustc;
|
||||
pub use self::sha256::Sha256;
|
||||
pub use self::to_semver::ToSemver;
|
||||
pub use self::vcs::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
||||
pub use self::workspace::{
|
||||
|
@ -51,7 +50,6 @@ mod progress;
|
|||
mod queue;
|
||||
pub mod restricted_names;
|
||||
pub mod rustc;
|
||||
mod sha256;
|
||||
pub mod to_semver;
|
||||
pub mod toml;
|
||||
mod vcs;
|
||||
|
|
Loading…
Reference in a new issue