From 4bc4adf7b0afb0a7afac8aa8338a062d4ee77391 Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Sat, 11 Feb 2023 11:07:05 +0800 Subject: [PATCH] dep: remove dependency on ansi-term The ansi-term crate is deprecated, so upgrade flexi-logger to get rid of dependency on ansi-term crate. Fixes: https://github.com/dragonflyoss/image-service/issues/1064 Signed-off-by: Jiang Liu --- Cargo.lock | 176 ++++++++++++++++++++++++++++++++++++++++++------- app/Cargo.toml | 2 +- app/src/lib.rs | 4 +- 3 files changed, 157 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4078af0948e..88e88c8ec8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,12 +27,12 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "android_system_properties" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "winapi", + "libc", ] [[package]] @@ -175,6 +175,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + [[package]] name = "clap" version = "4.0.18" @@ -221,6 +233,16 @@ dependencies = [ "cc", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -280,6 +302,50 @@ dependencies = [ "typenum", ] +[[package]] +name = "cxx" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dbs-uhttp" version = "0.3.2" @@ -344,20 +410,19 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.23.3" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a12e3b5a8775259ee83ac38aea8cdf9c3a1667c02178d207378c0837808fa9" +checksum = "010b5c83ec9d37d9636aa37132b777ef0818949b217109de9b88784e923bbf3a" dependencies = [ - "ansi_term", "atty", + "chrono", "flate2", "glob", "lazy_static", "log", + "nu-ansi-term", "regex", - "rustversion", "thiserror", - "time", ] [[package]] @@ -686,6 +751,30 @@ dependencies = [ "tokio", ] +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.2.3" @@ -792,6 +881,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "lock_api" version = "0.4.7" @@ -919,6 +1017,35 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.13.1" @@ -1218,6 +1345,12 @@ version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1433,12 +1566,6 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" -[[package]] -name = "rustversion" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" - [[package]] name = "ryu" version = "1.0.10" @@ -1466,6 +1593,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + [[package]] name = "security-framework" version = "2.6.1" @@ -1672,15 +1805,8 @@ dependencies = [ "libc", "num_threads", "serde", - "time-macros", ] -[[package]] -name = "time-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" - [[package]] name = "tinyvec" version = "1.6.0" @@ -1843,6 +1969,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "url" version = "2.2.2" diff --git a/app/Cargo.toml b/app/Cargo.toml index cffe4e69ec7..8c00005cc62 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -14,7 +14,7 @@ time = { version = "0.3.14", features = ["formatting"] } [dependencies] regex = "1.5.5" -flexi_logger = { version = "0.23", features = ["compress"] } +flexi_logger = { version = "0.25", features = ["compress"] } libc = "0.2" log = "0.4" nix = "0.24" diff --git a/app/src/lib.rs b/app/src/lib.rs index 63f792b0abc..d1387668545 100644 --- a/app/src/lib.rs +++ b/app/src/lib.rs @@ -162,7 +162,7 @@ fn colored_opt_format( write!( w, "[{}] {} {}", - style(level).paint(now.format(TS_DASHES_BLANK_COLONS_DOT_BLANK)), + style(level).paint(now.format(TS_DASHES_BLANK_COLONS_DOT_BLANK).to_string()), style(level).paint(level.to_string()), style(level).paint(&record.args().to_string()) ) @@ -170,7 +170,7 @@ fn colored_opt_format( write!( w, "[{}] {} [{}:{}] {}", - style(level).paint(now.format(TS_DASHES_BLANK_COLONS_DOT_BLANK)), + style(level).paint(now.format(TS_DASHES_BLANK_COLONS_DOT_BLANK).to_string()), style(level).paint(level.to_string()), get_file_name(record).unwrap_or(""), record.line().unwrap_or(0),