Skip to content

Commit

Permalink
Don't check conflicts when chroot and not installing
Browse files Browse the repository at this point in the history
Fixes #1130 and #1121
  • Loading branch information
Morganamilo committed Nov 16, 2024
1 parent 2f5e6e1 commit 6527db3
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ impl Installer {
bail!(tr!("--downloadonly can't be used for AUR packages"));
}

let conflicts = check_actions(config, actions)?;
let conflicts = check_actions(config, actions, !config.chroot || self.install_targets)?;
let c = config.color;

print_warnings(config, cache, Some(actions));
Expand Down Expand Up @@ -1334,7 +1334,11 @@ fn fmt_stack(want: &DepMissing) -> String {
}
}

fn check_actions(config: &Config, actions: &mut Actions) -> Result<(Vec<Conflict>, Vec<Conflict>)> {
fn check_actions(
config: &Config,
actions: &mut Actions,
check_conflicts: bool,
) -> Result<(Vec<Conflict>, Vec<Conflict>)> {
let c = config.color;
let dups = actions.duplicate_targets();
ensure!(
Expand Down Expand Up @@ -1377,16 +1381,16 @@ fn check_actions(config: &Config, actions: &mut Actions) -> Result<(Vec<Conflict
return Ok((Vec::new(), Vec::new()));
}

if config.chroot && config.args.has_arg("w", "downloadonly") {
return Ok((Vec::new(), Vec::new()));
}

println!(
"{} {}",
c.action.paint("::"),
c.bold.paint(tr!("Calculating conflicts..."))
);
let conflicts = actions.calculate_conflicts(!config.chroot);
let conflicts = if check_conflicts {
println!(
"{} {}",
c.action.paint("::"),
c.bold.paint(tr!("Calculating conflicts..."))
);
actions.calculate_conflicts(!config.chroot)
} else {
Vec::new()
};
println!(
"{} {}",
c.action.paint("::"),
Expand Down

0 comments on commit 6527db3

Please sign in to comment.