From 25fcebfeb0e63ce395bdbbf710d4c79888e57130 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 26 Aug 2021 21:42:21 -0400 Subject: [PATCH] extensions: support enabling/installing modules Fix that gap now since RHCOS does use modular packages in its extensions. This ended up being easier than I thought because we're just converting to a treefile underneath. --- docs/extensions.md | 11 +++++++++++ rust/src/extensions.rs | 3 +++ rust/src/treefile.rs | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/extensions.md b/docs/extensions.md index a754b185..9dbc6230 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -30,6 +30,17 @@ extension packages and places them in an output directory. The format of the `extensions.yaml` file is as follow: ```yaml +# Any additional repos to enable on top of treefile repos +repos: + - myrepo + +# Any modules to enable/install +modules: + enable: + - foo:bar + install: + - baz:boo/default + # The top-level object is a dict. The only supported key # right now is `extensions`, which is a dict of extension # names to extension objects. diff --git a/rust/src/extensions.rs b/rust/src/extensions.rs index ad2fe19b..6cb1a3a6 100644 --- a/rust/src/extensions.rs +++ b/rust/src/extensions.rs @@ -25,6 +25,8 @@ pub struct Extensions { extensions: HashMap, #[serde(skip_serializing_if = "Option::is_none")] repos: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + modules: Option, } #[derive(Serialize, Deserialize, Debug)] @@ -162,6 +164,7 @@ impl Extensions { repos: Some(repos), packages: Some(self.get_os_extension_packages()), releasever: src.parsed.releasever.clone(), + modules: self.modules.clone(), ..Default::default() }; Ok(Box::new(Treefile::new_from_config(ret, None)?)) diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 421f2b6c..eeb21a50 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -1290,7 +1290,7 @@ pub(crate) struct RepoPackage { pub(crate) packages: Vec, } -#[derive(Serialize, Deserialize, Debug, Default, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Debug, Default, PartialEq, Eq, Clone)] pub(crate) struct ModulesConfig { #[serde(skip_serializing_if = "Option::is_none")] pub(crate) enable: Option>, -- 2.31.1