From a2f5f4fffdde59c70a4d41ce33c7562cbbec4359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20von=20G=C3=B6wels?= Date: Wed, 24 Jan 2024 10:13:56 +0100 Subject: [PATCH] Replace dependency on `dirs` with `home` The `dirs` crate recently started depending on the `options-ext` crate which uses copyleft license (MPL). This (unnecessary) dependency causes licensing issues for various users by possibly poisoning the dependency tree of their projects[1]. This change replaces the `dirs` crate with `home`. The `home` crate is maintained by the cargo team and offers the same functionality. As a bonus, this change also results in a slightly smaller dependency tree. [1]: - https://github.com/artichoke/artichoke/pull/2564 - https://github.com/pyrossh/rust-embed/issues/231 - https://github.com/juhaku/utoipa/issues/834 - https://github.com/harryfei/which-rs/pull/78 --- Cargo.lock | 60 +++++++-------------------------------- pgrx-pg-config/Cargo.toml | 2 +- pgrx-pg-config/src/lib.rs | 2 +- 3 files changed, 12 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50ce48778e..3ebf57e1f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -712,27 +712,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "doc-comment" version = "0.3.3" @@ -1055,6 +1034,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "idna" version = "0.5.0" @@ -1183,17 +1171,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.1", - "libc", - "redox_syscall", -] - [[package]] name = "line-wrap" version = "0.1.1" @@ -1453,12 +1430,6 @@ dependencies = [ "serde", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "overload" version = "0.1.1" @@ -1579,8 +1550,8 @@ name = "pgrx-pg-config" version = "0.11.2" dependencies = [ "cargo_toml", - "dirs", "eyre", + "home", "owo-colors", "pathsearch", "serde", @@ -1919,17 +1890,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" version = "1.10.2" diff --git a/pgrx-pg-config/Cargo.toml b/pgrx-pg-config/Cargo.toml index e7fc75b385..e6885fa915 100644 --- a/pgrx-pg-config/Cargo.toml +++ b/pgrx-pg-config/Cargo.toml @@ -23,7 +23,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -dirs = "5.0.1" +home = "0.5.9" eyre = "0.6.8" pathsearch = "0.2.0" owo-colors = "3.5.0" diff --git a/pgrx-pg-config/src/lib.rs b/pgrx-pg-config/src/lib.rs index 221ca3c558..ced458fae8 100644 --- a/pgrx-pg-config/src/lib.rs +++ b/pgrx-pg-config/src/lib.rs @@ -633,7 +633,7 @@ impl Pgrx { pub fn home() -> Result { let pgrx_home = std::env::var("PGRX_HOME").map_or_else( |_| { - let mut pgrx_home = match dirs::home_dir() { + let mut pgrx_home = match home::home_dir() { Some(home) => home, None => return Err(PgrxHomeError::NoHomeDirectory), };