Skip to content

Commit

Permalink
Use DirtyReason::Forced for cargo install Freshness
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbln committed Dec 29, 2022
1 parent c63b8c0 commit 6913486
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/cargo/core/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub use self::compile_kind::{CompileKind, CompileTarget};
pub use self::context::{Context, Metadata};
pub use self::crate_type::CrateType;
pub use self::custom_build::{BuildOutput, BuildScriptOutputs, BuildScripts};
pub(crate) use self::fingerprint::DirtyReason;
pub use self::job::Freshness;
use self::job::{Job, Work};
use self::job_queue::{JobQueue, JobState};
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/ops/common_for_install_and_uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ops::FilterRule;
use serde::{Deserialize, Serialize};
use toml_edit::easy as toml;

use crate::core::compiler::Freshness;
use crate::core::compiler::{DirtyReason, Freshness};
use crate::core::Target;
use crate::core::{Dependency, FeatureValue, Package, PackageId, QueryKind, Source, SourceId};
use crate::ops::{self, CompileFilter, CompileOptions};
Expand Down Expand Up @@ -170,7 +170,7 @@ impl InstallTracker {
// Check if any tracked exe's are already installed.
let duplicates = self.find_duplicates(dst, &exes);
if force || duplicates.is_empty() {
return Ok((Freshness::Dirty(None), duplicates));
return Ok((Freshness::Dirty(Some(DirtyReason::Forced)), duplicates));
}
// Check if all duplicates come from packages of the same name. If
// there are duplicates from other packages, then --force will be
Expand Down Expand Up @@ -200,7 +200,7 @@ impl InstallTracker {
let source_id = pkg.package_id().source_id();
if source_id.is_path() {
// `cargo install --path ...` is always rebuilt.
return Ok((Freshness::Dirty(None), duplicates));
return Ok((Freshness::Dirty(Some(DirtyReason::Forced)), duplicates));
}
let is_up_to_date = |dupe_pkg_id| {
let info = self
Expand All @@ -224,7 +224,7 @@ impl InstallTracker {
if matching_duplicates.iter().all(is_up_to_date) {
Ok((Freshness::Fresh, duplicates))
} else {
Ok((Freshness::Dirty(None), duplicates))
Ok((Freshness::Dirty(Some(DirtyReason::Forced)), duplicates))
}
} else {
// Format the error message.
Expand Down

0 comments on commit 6913486

Please sign in to comment.