diff --git a/docs/extensions.md b/docs/extensions.md index 8ed4a6e41e..b5831dc1d6 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -38,13 +38,6 @@ The format of the `extensions.yaml` file is as follow: 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. @@ -67,10 +60,6 @@ extensions: # on a particular architecture. repos: - sooper-repo - # Optional additional modules (this also affects global state) - modules: - enable: - - sooper:latest # Optional list of architectures on which this extension # is valid. These are RPM basearches. If omitted, # defaults to all architectures. diff --git a/docs/treefile.md b/docs/treefile.md index 7fba715f8a..7d47fb1c59 100644 --- a/docs/treefile.md +++ b/docs/treefile.md @@ -500,14 +500,6 @@ version of `rpm-ostree`. via lockfiles. This is useful when locked packages are kept separately from the primary repos and one wants to ensure that rpm-ostree will otherwise not select unlocked packages from them. - * `modules`: Object, optional: Describes RPM modules to enable or install. Two - keys are supported: - * `enable`: Array of strings, required: Set of RPM module specs to enable - (the same formats as dnf are supported, e.g. `NAME[:STREAM]`). - One can then cherry-pick specific packages from the enabled modules via - `packages`. - * `install`: Array of strings, required: Set of RPM module specs to install - (the same formats as dnf are supported, e.g. `NAME[:STREAM][/PROFILE]`). * `repovars`: object (`Map`), optional: yum repository variable names to use when substituting variables in yum repo files. The `releasever` variable name is invalid. Use the `releasever` key instead. The `basearch` diff --git a/rpmostree-cxxrs.cxx b/rpmostree-cxxrs.cxx index e25fcab249..7232159fdd 100644 --- a/rpmostree-cxxrs.cxx +++ b/rpmostree-cxxrs.cxx @@ -1759,11 +1759,6 @@ struct Treefile final : public ::rust::Opaque bool remove_package_override_remove (::rust::Str package) noexcept; bool has_packages_override_remove_name (::rust::Str name) const noexcept; bool remove_all_overrides () noexcept; - ::rust::Vec< ::rust::String> get_modules_enable () const noexcept; - bool has_modules_enable () const noexcept; - ::rust::Vec< ::rust::String> get_modules_install () const noexcept; - bool add_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept; - bool remove_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept; bool remove_all_packages () noexcept; ::rust::Vec< ::rust::String> get_exclude_packages () const noexcept; ::rust::String get_platform_module () const noexcept; @@ -2422,9 +2417,6 @@ extern "C" ::rpmostreecxx::HistoryEntry *return$) noexcept; ::rust::repr::PtrLen rpmostreecxx$cxxbridge1$history_prune () noexcept; - - ::rust::repr::PtrLen - rpmostreecxx$cxxbridge1$modularity_entrypoint (::rust::Vec< ::rust::String> const &args) noexcept; ::std::size_t rpmostreecxx$cxxbridge1$TokioHandle$operator$sizeof () noexcept; ::std::size_t rpmostreecxx$cxxbridge1$TokioHandle$operator$alignof () noexcept; ::std::size_t rpmostreecxx$cxxbridge1$TokioEnterGuard$operator$sizeof () noexcept; @@ -2571,23 +2563,6 @@ extern "C" bool rpmostreecxx$cxxbridge1$Treefile$remove_all_overrides (::rpmostreecxx::Treefile &self) noexcept; - void rpmostreecxx$cxxbridge1$Treefile$get_modules_enable ( - ::rpmostreecxx::Treefile const &self, ::rust::Vec< ::rust::String> *return$) noexcept; - - bool rpmostreecxx$cxxbridge1$Treefile$has_modules_enable ( - ::rpmostreecxx::Treefile const &self) noexcept; - - void rpmostreecxx$cxxbridge1$Treefile$get_modules_install ( - ::rpmostreecxx::Treefile const &self, ::rust::Vec< ::rust::String> *return$) noexcept; - - bool rpmostreecxx$cxxbridge1$Treefile$add_modules (::rpmostreecxx::Treefile &self, - ::rust::Vec< ::rust::String> *modules, - bool enable_only) noexcept; - - bool rpmostreecxx$cxxbridge1$Treefile$remove_modules (::rpmostreecxx::Treefile &self, - ::rust::Vec< ::rust::String> *modules, - bool enable_only) noexcept; - bool rpmostreecxx$cxxbridge1$Treefile$remove_all_packages (::rpmostreecxx::Treefile &self) noexcept; @@ -4617,16 +4592,6 @@ history_prune () } } -void -modularity_entrypoint (::rust::Vec< ::rust::String> const &args) -{ - ::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$modularity_entrypoint (args); - if (error$.ptr) - { - throw ::rust::impl< ::rust::Error>::error (error$); - } -} - ::std::size_t TokioHandle::layout::size () noexcept { @@ -5068,42 +5033,6 @@ Treefile::remove_all_overrides () noexcept return rpmostreecxx$cxxbridge1$Treefile$remove_all_overrides (*this); } -::rust::Vec< ::rust::String> -Treefile::get_modules_enable () const noexcept -{ - ::rust::MaybeUninit< ::rust::Vec< ::rust::String> > return$; - rpmostreecxx$cxxbridge1$Treefile$get_modules_enable (*this, &return$.value); - return ::std::move (return$.value); -} - -bool -Treefile::has_modules_enable () const noexcept -{ - return rpmostreecxx$cxxbridge1$Treefile$has_modules_enable (*this); -} - -::rust::Vec< ::rust::String> -Treefile::get_modules_install () const noexcept -{ - ::rust::MaybeUninit< ::rust::Vec< ::rust::String> > return$; - rpmostreecxx$cxxbridge1$Treefile$get_modules_install (*this, &return$.value); - return ::std::move (return$.value); -} - -bool -Treefile::add_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept -{ - ::rust::ManuallyDrop< ::rust::Vec< ::rust::String> > modules$ (::std::move (modules)); - return rpmostreecxx$cxxbridge1$Treefile$add_modules (*this, &modules$.value, enable_only); -} - -bool -Treefile::remove_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept -{ - ::rust::ManuallyDrop< ::rust::Vec< ::rust::String> > modules$ (::std::move (modules)); - return rpmostreecxx$cxxbridge1$Treefile$remove_modules (*this, &modules$.value, enable_only); -} - bool Treefile::remove_all_packages () noexcept { diff --git a/rpmostree-cxxrs.h b/rpmostree-cxxrs.h index d501bf47c1..aafc78d53e 100644 --- a/rpmostree-cxxrs.h +++ b/rpmostree-cxxrs.h @@ -1536,11 +1536,6 @@ struct Treefile final : public ::rust::Opaque bool remove_package_override_remove (::rust::Str package) noexcept; bool has_packages_override_remove_name (::rust::Str name) const noexcept; bool remove_all_overrides () noexcept; - ::rust::Vec< ::rust::String> get_modules_enable () const noexcept; - bool has_modules_enable () const noexcept; - ::rust::Vec< ::rust::String> get_modules_install () const noexcept; - bool add_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept; - bool remove_modules (::rust::Vec< ::rust::String> modules, bool enable_only) noexcept; bool remove_all_packages () noexcept; ::rust::Vec< ::rust::String> get_exclude_packages () const noexcept; ::rust::String get_platform_module () const noexcept; @@ -1973,8 +1968,6 @@ ::rust::Box< ::rpmostreecxx::HistoryCtx> history_ctx_new (); void history_prune (); -void modularity_entrypoint (::rust::Vec< ::rust::String> const &args); - ::rust::Box< ::rpmostreecxx::TokioHandle> tokio_handle_get () noexcept; bool script_is_ignored (::rust::Str pkg, ::rust::Str script) noexcept; diff --git a/rust/src/daemon.rs b/rust/src/daemon.rs index b89605b24b..dbb4d39eac 100644 --- a/rust/src/daemon.rs +++ b/rust/src/daemon.rs @@ -73,16 +73,6 @@ fn deployment_populate_variant_origin( // Package mappings. Note these are inserted unconditionally, even if empty. vdict_insert_optset(dict, "requested-packages", tf.packages.as_ref()); - vdict_insert_optset( - dict, - "requested-modules", - tf.modules.as_ref().and_then(|m| m.install.as_ref()), - ); - vdict_insert_optset( - dict, - "requested-modules-enabled", - tf.modules.as_ref().and_then(|m| m.enable.as_ref()), - ); vdict_insert_optmap( dict, "requested-local-packages", diff --git a/rust/src/extensions.rs b/rust/src/extensions.rs index c2a01cb94a..3b8bce9444 100644 --- a/rust/src/extensions.rs +++ b/rust/src/extensions.rs @@ -29,8 +29,6 @@ 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)] @@ -40,8 +38,6 @@ pub struct Extension { #[serde(skip_serializing_if = "Option::is_none")] repos: Option>, #[serde(skip_serializing_if = "Option::is_none")] - modules: Option, - #[serde(skip_serializing_if = "Option::is_none")] architectures: Option>, #[serde(skip_serializing_if = "Option::is_none")] match_base_evr: Option, @@ -89,7 +85,6 @@ fn extensions_load_stream( } else { parsed.repos = ext.repos.take(); } - crate::treefile::merge_modules(&mut parsed.modules, &mut ext.modules); if ext.kind == ExtensionKind::OsExtension { for pkg in &ext.packages { if base_pkgs.contains_key(pkg.as_str()) { @@ -195,7 +190,6 @@ impl Extensions { ..Default::default() }, packages: Some(self.get_os_extension_packages().into_iter().collect()), - modules: self.modules.clone(), ..Default::default() }; Ok(Box::new(Treefile { @@ -324,9 +318,6 @@ extensions: architectures: - s390x foo: - modules: - enable: - - foo:stable packages: - foo repos: @@ -339,9 +330,6 @@ extensions: assert!(extensions.get_os_extension_packages() == vec!["bazboo"]); assert_eq!(extensions.get_repos().len(), 2); assert_eq!(extensions.get_repos()[1], "bazboo-repo"); - let modules = extensions.modules.unwrap(); - assert!(modules.enable.unwrap().contains("virt:av")); - assert!(modules.install.is_none()); let mut input = std::io::BufReader::new(buf.as_bytes()); let extensions = extensions_load_stream(&mut input, "s390x", &base_rpmdb()).unwrap(); @@ -354,10 +342,6 @@ extensions: assert_eq!(extensions.get_os_extension_packages(), vec!["foo"]); assert_eq!(extensions.get_repos().len(), 2); assert_eq!(extensions.get_repos()[1], "foo-repo"); - let modules = extensions.modules.unwrap(); - assert!(modules.enable.as_ref().unwrap().contains("foo:stable")); - assert!(modules.enable.as_ref().unwrap().contains("virt:av")); - assert!(modules.install.is_none()); } #[test] diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 2fadfe117f..0df51360ca 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -501,11 +501,6 @@ pub mod ffi { fn history_prune() -> Result<()>; } - // modularity.rs - extern "Rust" { - fn modularity_entrypoint(args: &Vec) -> Result<()>; - } - // tokio_ffi.rs extern "Rust" { type TokioHandle; @@ -609,11 +604,6 @@ pub mod ffi { fn remove_package_override_remove(&mut self, package: &str) -> bool; fn has_packages_override_remove_name(&self, name: &str) -> bool; fn remove_all_overrides(&mut self) -> bool; - fn get_modules_enable(&self) -> Vec; - fn has_modules_enable(&self) -> bool; - fn get_modules_install(&self) -> Vec; - fn add_modules(&mut self, modules: Vec, enable_only: bool) -> bool; - fn remove_modules(&mut self, modules: Vec, enable_only: bool) -> bool; fn remove_all_packages(&mut self) -> bool; fn get_exclude_packages(&self) -> Vec; fn get_platform_module(&self) -> String; @@ -1003,8 +993,6 @@ mod lockfile; pub(crate) use self::lockfile::*; mod live; pub(crate) use self::live::*; -pub mod modularity; -pub(crate) use self::modularity::*; mod nameservice; mod normalization; mod origin; diff --git a/rust/src/modularity.rs b/rust/src/modularity.rs deleted file mode 100644 index f97fb65757..0000000000 --- a/rust/src/modularity.rs +++ /dev/null @@ -1,150 +0,0 @@ -//! Implementation of the client-side of "rpm-ostree module". - -// SPDX-License-Identifier: Apache-2.0 OR MIT - -use crate::ffi::SystemHostType; -use anyhow::{anyhow, bail, Result}; -use clap::{ArgAction, Parser}; -use gio::prelude::*; -use glib::Variant; -use ostree_ext::{gio, glib}; - -use crate::utils::print_treepkg_diff; - -#[derive(Debug, Parser)] -#[clap(name = "rpm-ostree module")] -#[clap(rename_all = "kebab-case")] -enum Opt { - /// Enable a module - Enable(InstallOpts), - /// Disable a module - Disable(InstallOpts), - /// Install a module - Install(InstallOpts), - /// Uninstall a module - Uninstall(InstallOpts), -} - -#[derive(Debug, Parser)] -struct InstallOpts { - #[clap(action(ArgAction::Append))] - modules: Vec, - #[clap(long)] - reboot: bool, - #[clap(long)] - lock_finalization: bool, - #[clap(long)] - dry_run: bool, -} - -const OPT_KEY_ENABLE_MODULES: &str = "enable-modules"; -const OPT_KEY_DISABLE_MODULES: &str = "disable-modules"; -const OPT_KEY_INSTALL_MODULES: &str = "install-modules"; -const OPT_KEY_UNINSTALL_MODULES: &str = "uninstall-modules"; - -pub(crate) fn modularity_entrypoint(args: &Vec) -> Result<()> { - match Opt::parse_from(args.iter()) { - Opt::Enable(ref opts) => enable(opts), - Opt::Disable(ref opts) => disable(opts), - Opt::Install(ref opts) => install(opts), - Opt::Uninstall(ref opts) => uninstall(opts), - } -} - -// XXX: Should split out a lot of the below into a more generic Rust wrapper around -// UpdateDeployment() like we have on the C side. - -fn get_modifiers_variant(key: &str, modules: &[String]) -> Result { - let r = glib::VariantDict::new(None); - r.insert_value(key, &modules.to_variant()); - Ok(r.end()) -} - -fn get_options_variant(opts: &InstallOpts) -> Result { - let r = glib::VariantDict::new(None); - r.insert("no-pull-base", &true); - r.insert("reboot", &opts.reboot); - r.insert("lock-finalization", &opts.lock_finalization); - r.insert("dry-run", &opts.dry_run); - Ok(r.end()) -} - -fn enable(opts: &InstallOpts) -> Result<()> { - modules_impl(OPT_KEY_ENABLE_MODULES, opts) -} - -fn disable(opts: &InstallOpts) -> Result<()> { - modules_impl(OPT_KEY_DISABLE_MODULES, opts) -} - -fn install(opts: &InstallOpts) -> Result<()> { - modules_impl(OPT_KEY_INSTALL_MODULES, opts) -} - -fn uninstall(opts: &InstallOpts) -> Result<()> { - modules_impl(OPT_KEY_UNINSTALL_MODULES, opts) -} - -fn modules_impl_container(key: &str, opts: &InstallOpts) -> Result<()> { - let mut tf = crate::treefile_new_empty()?; - let mut mcfg = crate::treefile::ModulesConfig::default(); - match key { - OPT_KEY_ENABLE_MODULES => { - mcfg.enable = Some(opts.modules.iter().cloned().collect()); - } - OPT_KEY_INSTALL_MODULES => { - mcfg.install = Some(opts.modules.iter().cloned().collect()); - } - _ => bail!("Support for this option is not yet implemented"), - } - tf.parsed.modules = Some(mcfg); - let tf = tf.get_json_string(); - crate::ffi::container_rebuild(tf.as_str())?; - Ok(()) -} - -fn modules_impl_host(key: &str, opts: &InstallOpts) -> Result<()> { - let client = &mut crate::client::ClientConnection::new()?; - let previous_deployment = client - .get_os_proxy() - .cached_property("DefaultDeployment") - .ok_or_else(|| anyhow!("Failed to find default-deployment property"))?; - let modifiers = get_modifiers_variant(key, &opts.modules)?; - let options = get_options_variant(opts)?; - let params = Variant::tuple_from_iter([modifiers, options]); - let reply = &client.get_os_proxy().call_sync( - "UpdateDeployment", - Some(¶ms), - gio::DBusCallFlags::NONE, - -1, - gio::Cancellable::NONE, - )?; - let reply = reply - .get::<(String,)>() - .ok_or_else(|| anyhow!("Invalid reply"))?; - client.transaction_connect_progress_sync(reply.0.as_str())?; - if opts.dry_run { - println!("Exiting because of '--dry-run' option"); - } else if !opts.reboot { - let new_deployment = client - .get_os_proxy() - .cached_property("DefaultDeployment") - .ok_or_else(|| anyhow!("Failed to find default-deployment property"))?; - if previous_deployment != new_deployment { - print_treepkg_diff("/"); - } - } - Ok(()) -} - -fn modules_impl(key: &str, opts: &InstallOpts) -> Result<()> { - if opts.modules.is_empty() { - bail!("At least one module must be specified"); - } - - match crate::client::get_system_host_type()? { - SystemHostType::OstreeContainer => modules_impl_container(key, opts), - SystemHostType::OstreeHost => modules_impl_host(key, opts), - o => bail!("Unsupported system type: {:?}", o), - } -} diff --git a/rust/src/origin.rs b/rust/src/origin.rs index 7e1f610106..bcc3c6d416 100644 --- a/rust/src/origin.rs +++ b/rust/src/origin.rs @@ -21,7 +21,6 @@ use ostree_ext::container::deploy::ORIGIN_CONTAINER; const ORIGIN: &str = "origin"; const RPMOSTREE: &str = "rpmostree"; const PACKAGES: &str = "packages"; -const MODULES: &str = "modules"; const OVERRIDES: &str = "overrides"; /// The set of keys that we parse as BTreeMap and need to ignore ordering changes. @@ -29,8 +28,6 @@ static UNORDERED_LIST_KEYS: phf::Set<&'static str> = phf::phf_set! { "packages/requested", "packages/local", "packages/local-fileoverride", - "modules/enable", - "modules/install", "overrides/remove", "overrides/replace-local" }; @@ -59,14 +56,6 @@ pub(crate) fn origin_to_treefile_inner(kf: &KeyFile) -> Result> { cfg.derive.packages_local = parse_localpkglist(kf, PACKAGES, "requested-local")?; cfg.derive.packages_local_fileoverride = parse_localpkglist(kf, PACKAGES, "requested-local-fileoverride")?; - let modules_enable = parse_stringlist(kf, MODULES, "enable")?; - let modules_install = parse_stringlist(kf, MODULES, "install")?; - if modules_enable.is_some() || modules_install.is_some() { - cfg.modules = Some(crate::treefile::ModulesConfig { - enable: modules_enable, - install: modules_install, - }); - } cfg.derive.override_remove = parse_stringlist(kf, OVERRIDES, "remove")?; cfg.derive.override_replace_local = parse_localpkglist(kf, OVERRIDES, "replace-local")?; cfg.derive.unconfigured_state = keyfile_get_optional_string(kf, ORIGIN, "unconfigured-state")?; @@ -221,17 +210,6 @@ fn treefile_to_origin_inner(tf: &Treefile) -> Result { kf_set_string_list_optional(&kf, OVERRIDES, "replace", pkgs); } - if let Some(ref modcfg) = tf.modules { - if let Some(modules) = modcfg.enable.as_ref() { - let modules = modules.iter().map(|s| s.as_str()); - kf_set_string_list_optional(&kf, MODULES, "enable", modules) - } - if let Some(modules) = modcfg.install.as_ref() { - let modules = modules.iter().map(|s| s.as_str()); - kf_set_string_list_optional(&kf, MODULES, "install", modules) - } - } - // Initramfs bits if let Some(initramfs) = tf.derive.initramfs.as_ref() { if initramfs.regenerate { @@ -425,10 +403,6 @@ pub(crate) mod test { requested=libvirt;fish; requested-local=4ed748ba060fce4571e7ef19f3f5ed6209f67dbac8327af0d38ea70b96d2f723:foo-1.2-3.x86_64; - [modules] - enable=foo:2.0;bar:rolling; - install=baz:next/development; - [overrides] remove=docker; replace-local=0c7072500af2758e7dc7d7700fed82c3c5f4da7453b4d416e79f75384eee96b0:rpm-ostree-devel-2021.1-2.fc33.x86_64;648ab3ff4d4b708ea180269297de5fa3e972f4481d47b7879c6329272e474d68:rpm-ostree-2021.1-2.fc33.x86_64;8b29b78d0ade6ec3aedb8e3846f036f6f28afe64635d83cb6a034f1004607678:rpm-ostree-libs-2021.1-2.fc33.x86_64; @@ -491,13 +465,6 @@ pub(crate) mod test { tf.parsed.derive.override_commit.unwrap(), "41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3" ); - assert_eq!( - tf.parsed.modules, - Some(crate::treefile::ModulesConfig { - enable: Some(maplit::btreeset!("foo:2.0".into(), "bar:rolling".into(),)), - install: Some(maplit::btreeset!("baz:next/development".into())), - }) - ); assert_eq!( tf.parsed.derive.override_replace, Some(vec![ diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index a8cadaf5be..d3676a6660 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -177,17 +177,6 @@ fn treefile_parse_stream( pkgs }; - // to be consistent, we also support whitespace-separated modules - if let Some(mut modules) = treefile.modules.take() { - if let Some(enable) = modules.enable.take() { - modules.enable = Some(whitespace_split_packages(&enable)?); - } - if let Some(install) = modules.install.take() { - modules.install = Some(whitespace_split_packages(&install)?); - } - treefile.modules = Some(modules); - } - // Whitespace split repo packages if let Some(repo_packages) = treefile.repo_packages.as_mut() { for rp in repo_packages { @@ -376,18 +365,6 @@ fn merge_hashset_field( } } -/// Merge modules fields. -pub(crate) fn merge_modules(dest: &mut Option, src: &mut Option) { - if let Some(mut srcv) = src.take() { - if let Some(mut destv) = dest.take() { - merge_hashset_field(&mut destv.enable, &mut srcv.enable); - merge_hashset_field(&mut destv.install, &mut srcv.install); - srcv = destv; - } - *dest = Some(srcv); - } -} - /// Given two configs, merge them. fn treefile_merge(dest: &mut TreeComposeConfig, src: &mut TreeComposeConfig) { macro_rules! merge_basics { @@ -465,7 +442,6 @@ fn treefile_merge(dest: &mut TreeComposeConfig, src: &mut TreeComposeConfig) { dest.handle_repo_packages_overrides(); merge_basic_field(&mut dest.cliwrap, &mut src.cliwrap); merge_vec_field(&mut dest.cliwrap_binaries, &mut src.cliwrap_binaries); - merge_modules(&mut dest.modules, &mut src.modules); merge_basic_field(&mut dest.derive.base_refspec, &mut src.derive.base_refspec); merge_basic_field( @@ -969,61 +945,6 @@ impl Treefile { Ok(changed) } - pub(crate) fn get_modules_enable(&self) -> Vec { - self.parsed - .modules - .as_ref() - .and_then(|m| m.enable.as_ref()) - .cloned() - .into_iter() - .flatten() - .collect() - } - - pub(crate) fn has_modules_enable(&self) -> bool { - self.parsed - .modules - .as_ref() - .map(|m| m.enable.as_ref().map(|e| !e.is_empty()).unwrap_or_default()) - .unwrap_or_default() - } - - pub(crate) fn get_modules_install(&self) -> Vec { - self.parsed - .modules - .as_ref() - .and_then(|m| m.install.as_ref()) - .cloned() - .into_iter() - .flatten() - .collect() - } - - pub(crate) fn add_modules(&mut self, modules: Vec, enable_only: bool) -> bool { - let modules_cfg = self.parsed.modules.ext_get_or_insert_default(); - let map = if enable_only { - modules_cfg.enable.ext_get_or_insert_default() - } else { - modules_cfg.install.ext_get_or_insert_default() - }; - let n = map.len(); - map.extend(modules); - n != map.len() - } - - pub(crate) fn remove_modules(&mut self, modules: Vec, enable_only: bool) -> bool { - let modules_to_remove: BTreeSet = modules.into_iter().collect(); - let modules_cfg = self.parsed.modules.ext_get_or_insert_default(); - let map = if enable_only { - modules_cfg.enable.ext_get_or_insert_default() - } else { - modules_cfg.install.ext_get_or_insert_default() - }; - let n = map.len(); - map.retain(|module| !modules_to_remove.contains(module)); - n != map.len() - } - pub(crate) fn get_packages_override_remove(&self) -> Vec { self.parsed .derive @@ -1226,16 +1147,6 @@ impl Treefile { .map(|x| !x.is_empty()) .unwrap_or_default() || changed; - changed = self - .parsed - .modules - .take() - .map(|mut x| { - x.enable.take().map(|y| !y.is_empty()).unwrap_or_default() - || x.install.take().map(|y| !y.is_empty()).unwrap_or_default() - }) - .unwrap_or_default() - || changed; changed } @@ -1551,7 +1462,6 @@ impl Treefile { /// Given a treefile, print notices about items which are experimental. pub(crate) fn print_experimental_notices(&self) { - print_experimental_notice(self.parsed.modules.is_some(), "modules"); print_experimental_notice(self.parsed.base.lockfile_repos.is_some(), "lockfile-repos"); } @@ -1852,15 +1762,10 @@ impl Treefile { /// false --> definitely does not require local assembly /// true --> maybe requires assembly, need to investigate further by doing work pub(crate) fn may_require_local_assembly(&self) -> bool { - self.parsed.cliwrap.unwrap_or_default() || - self.get_initramfs_regenerate() || - self.has_initramfs_etc_files() || - self.has_any_packages() || - // Technically, alone it doesn't require require assembly, but it still - // requires fetching repo metadata to validate (remember: modules are a - // pure rpmmd concept). This means we may pay the cost of an unneeded - // tree checkout, but it's not worth trying to optimize for it. - self.has_modules_enable() + self.parsed.cliwrap.unwrap_or_default() + || self.get_initramfs_regenerate() + || self.has_initramfs_etc_files() + || self.has_any_packages() } /// Returns true if this origin contains overlay or override packages. @@ -1902,12 +1807,6 @@ impl Treefile { .as_ref() .map(|m| !m.is_empty()) .unwrap_or_default() - || self - .parsed - .modules - .as_ref() - .and_then(|m| m.install.as_ref().map(|i| !i.is_empty())) - .unwrap_or_default() } /// Derive RPM importer flags for a given package and treefile settings. @@ -2458,8 +2357,6 @@ pub(crate) struct TreeComposeConfig { #[serde(skip_serializing_if = "Option::is_none")] pub(crate) repo_packages: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) modules: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub(crate) cliwrap: Option, #[serde(skip_serializing_if = "Option::is_none")] pub(crate) cliwrap_binaries: Option>, @@ -2642,14 +2539,6 @@ pub(crate) struct RepoPackage { pub(crate) packages: BTreeSet, } -#[derive(Clone, Serialize, Deserialize, Debug, Default, PartialEq, Eq)] -pub(crate) struct ModulesConfig { - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) enable: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) install: Option>, -} - #[derive(Clone, Serialize, Deserialize, Debug, Default, PartialEq, Eq)] pub(crate) struct LegacyTreeComposeConfigFields { #[serde(skip_serializing)] @@ -3001,12 +2890,6 @@ pub(crate) mod tests { - repo: baserepo packages: - blah bloo - modules: - enable: - - foobar:2.0 - install: - - nodejs:15 - - swig:3.0/complete sway:rolling "#}; // This one has "comments" (hence unknown keys) @@ -3439,11 +3322,6 @@ pub(crate) mod tests { - repo: foo2 packages: - qwert - modules: - enable: - - dodo - install: - - bazboo "}, )?; let mut buf = VALID_PRELUDE.to_string(); @@ -3465,18 +3343,6 @@ pub(crate) mod tests { } ]) ); - assert_eq!( - tf.parsed.modules, - Some(ModulesConfig { - enable: Some(maplit::btreeset!("dodo".into(), "foobar:2.0".into())), - install: Some(maplit::btreeset!( - "bazboo".into(), - "nodejs:15".into(), - "swig:3.0/complete".into(), - "sway:rolling".into(), - )) - },) - ); Ok(()) } @@ -4038,9 +3904,6 @@ conditional-include: - foobar override-remove: - glibc - modules: - enable: - - nodejs:latest custom: url: https://example.com description: Managed by Example, Inc. @@ -4066,20 +3929,6 @@ conditional-include: let mut treefile = Treefile::new_from_string(utils::InputFormat::YAML, buf).unwrap(); assert!(treefile.has_packages()); assert_eq!(treefile.get_packages(), &["foobar"]); - assert!(treefile.has_modules_enable()); - assert_eq!(treefile.get_modules_enable(), &["nodejs:latest"]); - assert!(treefile.add_modules(vec!["foo:bar".into()], true)); - assert!(!treefile.add_modules(vec!["foo:bar".into()], true)); - assert!(treefile.add_modules(vec!["baz:boo/minimal".into()], false)); - assert!(!treefile.add_modules(vec!["baz:boo/minimal".into()], false)); - assert_eq!(treefile.get_modules_enable(), &["foo:bar", "nodejs:latest"]); - assert_eq!(treefile.get_modules_install(), &["baz:boo/minimal"]); - assert!(treefile.remove_modules(vec!["foo:bar".into()], true)); - assert!(!treefile.remove_modules(vec!["foo:bar".into()], true)); - assert!(treefile.remove_modules(vec!["baz:boo/minimal".into()], false)); - assert!(!treefile.remove_modules(vec!["baz:boo/minimal".into()], false)); - assert_eq!(treefile.get_modules_enable(), &["nodejs:latest"]); - assert!(treefile.get_modules_install().is_empty()); assert!(treefile.remove_all_packages()); assert!(treefile.has_packages_override_remove_name("glibc")); assert!(!treefile.has_packages_override_remove_name("enoent")); @@ -4134,8 +3983,6 @@ conditional-include: assert!(treefile.get_packages().is_empty()); assert!(treefile.get_local_packages().is_empty()); assert!(treefile.get_local_fileoverride_packages().is_empty()); - assert!(treefile.get_modules_enable().is_empty()); - assert!(treefile.get_modules_install().is_empty()); assert!(!treefile.remove_all_packages()); assert_eq!( treefile.get_base_refspec(), @@ -4283,8 +4130,6 @@ conditional-include: let treefile = treefile_new_empty().unwrap(); assert!(!treefile.has_packages()); assert!(treefile.get_packages().is_empty()); - assert!(!treefile.has_modules_enable()); - assert!(treefile.get_modules_enable().is_empty()); assert_eq!(treefile.get_origin_custom_url(), ""); assert_eq!(treefile.get_origin_custom_description(), ""); assert_eq!(treefile.get_override_commit(), ""); diff --git a/src/app/rpmostree-builtin-ex.cxx b/src/app/rpmostree-builtin-ex.cxx index 37b291cd74..ed4f68a062 100644 --- a/src/app/rpmostree-builtin-ex.cxx +++ b/src/app/rpmostree-builtin-ex.cxx @@ -58,17 +58,6 @@ rpmostree_builtin_ex (int argc, char **argv, RpmOstreeCommandInvocation *invocat /* Commands that are pure Rust are proxied here. */ -gboolean -rpmostree_ex_builtin_module (int argc, char **argv, RpmOstreeCommandInvocation *invocation, - GCancellable *cancellable, GError **error) -{ - rust::Vec rustargv; - for (int i = 0; i < argc; i++) - rustargv.push_back (std::string (argv[i])); - ROSCXX_TRY (modularity_entrypoint (rustargv), error); - return TRUE; -} - gboolean rpmostree_ex_builtin_deploy_from_self (int argc, char **argv, RpmOstreeCommandInvocation *invocation, diff --git a/src/app/rpmostree-compose-builtin-tree.cxx b/src/app/rpmostree-compose-builtin-tree.cxx index ac0dcd409e..9271b5102c 100644 --- a/src/app/rpmostree-compose-builtin-tree.cxx +++ b/src/app/rpmostree-compose-builtin-tree.cxx @@ -906,12 +906,6 @@ impl_install_tree (RpmOstreeTreeComposeContext *self, gboolean *out_changed, return glnx_throw_errno_prefix (error, "fchdir"); } - /* We don't support installing modules in non-unified mode, because it relies - * on the core writing metadata to the commit metadata (obviously this could - * be supported, but meh...) */ - if (!opt_unified_core && json_object_has_member (self->treefile, "modules")) - return glnx_throw (error, "Composing with modules requires --unified-core"); - /* Read the previous commit. Note we don't actually *need* the full commit; really, only * if one uses `check-passwd: { "type": "previous" }`. There are a few other optimizations * too, e.g. using the previous SELinux policy in unified core. Also, we might need the diff --git a/src/daemon/rpmostree-sysroot-upgrader.cxx b/src/daemon/rpmostree-sysroot-upgrader.cxx index baa4f78e39..20de822b79 100644 --- a/src/daemon/rpmostree-sysroot-upgrader.cxx +++ b/src/daemon/rpmostree-sysroot-upgrader.cxx @@ -963,13 +963,6 @@ prep_local_assembly (RpmOstreeSysrootUpgrader *self, GCancellable *cancellable, } else { - /* We still want to prepare() even if there's only enabled modules to validate. - * See comment in rpmostree_origin_may_require_local_assembly(). */ - if (rpmostree_origin_has_modules_enable (self->computed_origin)) - { - if (!rpmostree_context_prepare (self->ctx, FALSE, cancellable, error)) - return FALSE; - } rpmostree_context_set_is_empty (self->ctx); self->layering_type = RPMOSTREE_SYSROOT_UPGRADER_LAYERING_LOCAL; } diff --git a/src/daemon/rpmostreed-deployment-utils.cxx b/src/daemon/rpmostreed-deployment-utils.cxx index 43229bc89b..2a987484bb 100644 --- a/src/daemon/rpmostreed-deployment-utils.cxx +++ b/src/daemon/rpmostreed-deployment-utils.cxx @@ -270,7 +270,6 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment } g_variant_dict_insert (dict, "packages", "^as", layered_pkgs); - g_variant_dict_insert (dict, "modules", "^as", layered_modules); g_variant_dict_insert_value (dict, "base-removals", removed_base_pkgs); g_variant_dict_insert_value (dict, "base-local-replacements", replaced_base_local_pkgs); g_variant_dict_insert_value (dict, "base-remote-replacements", replaced_base_remote_pkgs); diff --git a/src/daemon/rpmostreed-transaction-types.cxx b/src/daemon/rpmostreed-transaction-types.cxx index af35fa8457..dde4377002 100644 --- a/src/daemon/rpmostreed-transaction-types.cxx +++ b/src/daemon/rpmostreed-transaction-types.cxx @@ -1212,12 +1212,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca util::rust_stringvec_from_strv (uninstall_pkgs), idempotent_layering, &changed, error)) return FALSE; - if (rpmostree_origin_remove_modules (origin, util::rust_stringvec_from_strv (disable_modules), - TRUE)) - changed = TRUE; - if (rpmostree_origin_remove_modules ( - origin, util::rust_stringvec_from_strv (uninstall_modules), FALSE)) - changed = TRUE; } /* lazily loaded cache that's used in a few conditional blocks */ @@ -1261,12 +1255,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca return FALSE; } - if (rpmostree_origin_add_modules (origin, util::rust_stringvec_from_strv (enable_modules), TRUE)) - changed = TRUE; - if (rpmostree_origin_add_modules (origin, util::rust_stringvec_from_strv (install_modules), - FALSE)) - changed = TRUE; - if (install_local_pkgs != NULL) { g_autoptr (GPtrArray) pkgs = NULL; diff --git a/src/libpriv/rpmostree-core.cxx b/src/libpriv/rpmostree-core.cxx index e515099179..a2de7262f7 100644 --- a/src/libpriv/rpmostree-core.cxx +++ b/src/libpriv/rpmostree-core.cxx @@ -682,24 +682,13 @@ rpmostree_context_setup (RpmOstreeContext *self, const char *install_root, const if (!dnf_context_setup (self->dnfctx, cancellable, error)) return FALSE; - /* XXX: If we have modules to install, then we need libdnf to handle it, and - * we can't avoid not parsing repodata because modules are entirely a repodata - * concept. So for now, force off pkgcache-only. This means that e.g. client - * side operations that are normally cache-only like `rpm-ostree uninstall` - * will still try to fetch metadata, and might install newer versions of other - * packages... we can probably hack that in the future. - * And similarly for remote overrides; we need to reach the remote every time. + /* For remote overrides; we need to reach the remote every time. * We can probably do something fancier in the future where we know which pkg * from our cache to use based on which repo it was downloaded from. * */ if (self->pkgcache_only) { - gboolean disable_cacheonly = FALSE; - auto modules_enable = self->treefile_rs->get_modules_enable (); - disable_cacheonly = disable_cacheonly || !modules_enable.empty (); - auto modules_install = self->treefile_rs->get_modules_install (); - disable_cacheonly = disable_cacheonly || !modules_install.empty (); - disable_cacheonly = disable_cacheonly || self->treefile_rs->has_packages_override_replace (); + gboolean disable_cacheonly = self->treefile_rs->has_packages_override_replace (); if (disable_cacheonly) { self->pkgcache_only = FALSE; @@ -1750,8 +1739,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, gboolean enable_filelists, auto packages_override_replace_local = self->treefile_rs->get_packages_override_replace_local (); auto packages_override_remove = self->treefile_rs->get_packages_override_remove (); auto exclude_packages = self->treefile_rs->get_exclude_packages (); - auto modules_enable = self->treefile_rs->get_modules_enable (); - auto modules_install = self->treefile_rs->get_modules_install (); /* we only support pure installs for now (compose case) */ if (self->lockfile) @@ -2073,9 +2060,6 @@ rpmostree_context_prepare (RpmOstreeContext *self, gboolean enable_filelists, } } - if (!modules_enable.empty ()) - return glnx_throw (error, "Modularity is no longer supported"); - /* And finally, handle packages to install from all enabled repos */ g_autoptr (GPtrArray) missing_pkgs = NULL; for (auto &pkgname_v : packages) @@ -4668,14 +4652,6 @@ rpmostree_context_commit (RpmOstreeContext *self, const char *parent, g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.packages", g_variant_builder_end (pkgs_v)); - /* embed modules layered */ - auto modules = self->treefile_rs->get_modules_install (); - auto modules_v = g_variant_builder_new (G_VARIANT_TYPE ("as")); - for (auto &mod : modules) - g_variant_builder_add (modules_v, "s", mod.c_str ()); - g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.modules", - g_variant_builder_end (modules_v)); - /* embed packages removed */ /* we have to embed both the pkgname and the full nevra to make it easier to match * them up with origin directives. the full nevra is used for status -v */ diff --git a/src/libpriv/rpmostree-origin.cxx b/src/libpriv/rpmostree-origin.cxx index 645817883d..0c4b177918 100644 --- a/src/libpriv/rpmostree-origin.cxx +++ b/src/libpriv/rpmostree-origin.cxx @@ -125,13 +125,6 @@ rpmostree_origin_has_packages (RpmOstreeOrigin *origin) return (*origin->treefile)->has_packages (); } -/* Mutability: getter */ -bool -rpmostree_origin_has_modules_enable (RpmOstreeOrigin *origin) -{ - return (*origin->treefile)->has_modules_enable (); -} - /* Mutability: getter */ rust::Vec rpmostree_origin_get_local_packages (RpmOstreeOrigin *origin) @@ -356,24 +349,6 @@ rpmostree_origin_remove_packages (RpmOstreeOrigin *origin, rust::Vec modules, - gboolean enable_only) -{ - auto changed = (*origin->treefile)->add_modules (modules, enable_only); - return changed; -} - -/* Mutability: setter */ -gboolean -rpmostree_origin_remove_modules (RpmOstreeOrigin *origin, rust::Vec modules, - gboolean enable_only) -{ - auto changed = (*origin->treefile)->remove_modules (modules, enable_only); - return changed; -} - /* Mutability: setter */ gboolean rpmostree_origin_remove_all_packages (RpmOstreeOrigin *origin) diff --git a/src/libpriv/rpmostree-origin.h b/src/libpriv/rpmostree-origin.h index 3182f98778..09a3aab937 100644 --- a/src/libpriv/rpmostree-origin.h +++ b/src/libpriv/rpmostree-origin.h @@ -44,8 +44,6 @@ rust::Vec rpmostree_origin_get_packages (RpmOstreeOrigin *origin); bool rpmostree_origin_has_packages (RpmOstreeOrigin *origin); -bool rpmostree_origin_has_modules_enable (RpmOstreeOrigin *origin); - rust::Vec rpmostree_origin_get_local_packages (RpmOstreeOrigin *origin); rust::Vec rpmostree_origin_get_local_fileoverride_packages (RpmOstreeOrigin *origin); @@ -117,12 +115,6 @@ gboolean rpmostree_origin_remove_packages (RpmOstreeOrigin *origin, gboolean *out_changed, GError **error); gboolean rpmostree_origin_remove_all_packages (RpmOstreeOrigin *origin); -gboolean rpmostree_origin_add_modules (RpmOstreeOrigin *origin, rust::Vec modules, - gboolean enable_only); - -gboolean rpmostree_origin_remove_modules (RpmOstreeOrigin *origin, rust::Vec modules, - gboolean enable_only); - gboolean rpmostree_origin_add_override_remove (RpmOstreeOrigin *origin, rust::Vec packages, GError **error); gboolean rpmostree_origin_add_override_replace_local (RpmOstreeOrigin *origin, diff --git a/src/libpriv/rpmostree-util.cxx b/src/libpriv/rpmostree-util.cxx index ce64c8f09b..ce6e461351 100644 --- a/src/libpriv/rpmostree-util.cxx +++ b/src/libpriv/rpmostree-util.cxx @@ -505,11 +505,6 @@ rpmostree_deployment_get_layered_info (OstreeRepo *repo, OstreeDeployment *deplo g_assert (replaced_base_local_pkgs); } - if (layeredmeta.clientlayer_version >= 5) - { - g_assert (g_variant_dict_lookup (dict, "rpmostree.modules", "^as", &layered_modules)); - } - if (layeredmeta.clientlayer_version >= 6) { replaced_base_remote_pkgs = g_variant_dict_lookup_value (