From 92de52e64d09c09f44753a70329403156388c640 Mon Sep 17 00:00:00 2001 From: cat_in_136 Date: Sun, 7 Jul 2024 16:48:23 +0900 Subject: [PATCH] introduce weak dependencies: recommends, supplements, suggests, and enhances --- README.md | 4 ++++ src/config/mod.rs | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index 31bbb49..48fd20c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,10 @@ from [the `Cargo.toml` file](https://doc.rust-lang.org/cargo/reference/manifest. * obsoletes: optional list of Obsoletes * conflicts: optional list of Conflicts * provides: optional list of Provides +* recommends: optional list of Recommends +* supplements: optional list of Supplements +* suggests: optional list of Suggests +* enhances: optional list of Enhances * vendor: optional string of Vendor Adding assets such as the binary file, ``.desktop`` file, or icons, shall be written in the following way. diff --git a/src/config/mod.rs b/src/config/mod.rs index d8de4cb..b57bb6a 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -319,6 +319,26 @@ impl Config { builder = builder.provides(dependency); } } + if let Some(recommends) = metadata.get_table("recommends")? { + for dependency in Self::table_to_dependencies(recommends)? { + builder = builder.recommends(dependency); + } + } + if let Some(supplements) = metadata.get_table("supplements")? { + for dependency in Self::table_to_dependencies(supplements)? { + builder = builder.supplements(dependency); + } + } + if let Some(suggests) = metadata.get_table("suggests")? { + for dependency in Self::table_to_dependencies(suggests)? { + builder = builder.suggests(dependency); + } + } + if let Some(enhances) = metadata.get_table("enhances")? { + for dependency in Self::table_to_dependencies(enhances)? { + builder = builder.enhances(dependency); + } + } Ok(builder) }