From 67f1b9cfbe6f26d3b57ae6463a76d4a1253f0339 Mon Sep 17 00:00:00 2001 From: Michal Date: Mon, 25 Jul 2022 01:12:59 +0100 Subject: [PATCH] Fixed issue with removing dirs (hngh fakeroot) --- Cargo.lock | 32 ++++++++++++++++++++++++++++++++ Cargo.toml | 1 + examples/repository/mlc.toml | 4 ++-- src/operations/build.rs | 4 ++-- src/operations/clean.rs | 5 +++-- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd575cc..a71351b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,6 +12,7 @@ dependencies = [ "libc", "mimalloc", "regex", + "rm_rf", "serde", "serde_derive", "spinoff", @@ -366,6 +367,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f446d0a6efba22928558c4fb4ce0b3fd6c89b0061343e390bf01a703742b8125" +dependencies = [ + "cc", +] + [[package]] name = "quote" version = "1.0.20" @@ -399,6 +409,15 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +[[package]] +name = "rm_rf" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3443b7a35aa12ed2e99edfc0ecbefe6a53b4848305cc83e29981dfa1aea1f71e" +dependencies = [ + "stacker", +] + [[package]] name = "rustversion" version = "1.0.8" @@ -476,6 +495,19 @@ dependencies = [ "yansi", ] +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + [[package]] name = "strip-ansi-escapes" version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index 14e4281..8582322 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ tabled = { version = "0.8.0", default-features = false, features = ["derive", "c crossterm = { version = "0.24.0", default-features = false } regex = { version = "1.6.0", default-features = false, features = ["std"] } spinoff = { version = "0.4.0", default-features = false } +rm_rf = { version = "0.6.2", default-features = false } [target.'cfg(target_os = "linux")'.dependencies] mimalloc = { version = "0.1.29" } diff --git a/examples/repository/mlc.toml b/examples/repository/mlc.toml index 3b9a0f4..bf7510e 100644 --- a/examples/repository/mlc.toml +++ b/examples/repository/mlc.toml @@ -13,8 +13,8 @@ on_gen = true [repositories] repos = [ - "crs:malachite/development:0a5bdc9", - "mic:apod:v.1.1.2", + "crs:malachite/development:0a5bdc9", # Note, in this example, these two + "mic:apod:v.1.1.2", # will fail to build. "pkg:pfetch!", ] diff --git a/src/operations/build.rs b/src/operations/build.rs index a42d3b9..bdf00ce 100644 --- a/src/operations/build.rs +++ b/src/operations/build.rs @@ -120,8 +120,8 @@ pub fn build(packages: &[String], exclude: Vec, no_regen: bool, verbose: if !errored.is_empty() { log!(verbose, "Errored packages: \n{:?}", error_strings); info!( - "The following packages build jobs returned a non-zero exit code: {}", - error_strings.join("\n") + "The following packages build jobs returned a non-zero exit code: \n {}", + error_strings.join("\n ") ); } } diff --git a/src/operations/clean.rs b/src/operations/clean.rs index c92c984..3a6433c 100644 --- a/src/operations/clean.rs +++ b/src/operations/clean.rs @@ -39,7 +39,7 @@ pub fn clean(verbose: bool, force: bool) { log!(verbose, "Current directory: {}", root_dir.display()); } - if !unclean_dirs.is_empty() && !force { + if !unclean_dirs.is_empty() && !force && crate::parse_cfg(verbose).base.mode == "workspace" { crash!( AppExitCode::NotClean, "The following directories are not clean: \n {}\n\ @@ -50,7 +50,8 @@ pub fn clean(verbose: bool, force: bool) { log!(verbose, "Paths with mlc.toml excluded: {:?}", dirs); for dir in &dirs { - std::fs::remove_dir_all(dir).unwrap(); + log!(verbose, "Deleting directory: {}", dir); + rm_rf::remove(dir).unwrap(); } info!( "Reset complete, dirs removed: \n \