diff --git a/Cargo.toml b/Cargo.toml index 9c5abcc..4144687 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,3 +33,4 @@ strip = true default = [] debian = ["pacdef_core/debian"] arch = ["pacdef_core/arch"] +flatpak = ["pacdef_core/flatpak"] diff --git a/crates/pacdef_core/Cargo.toml b/crates/pacdef_core/Cargo.toml index 6609230..7eeb0e5 100644 --- a/crates/pacdef_core/Cargo.toml +++ b/crates/pacdef_core/Cargo.toml @@ -35,3 +35,4 @@ rust-apt = { version = "0.5", optional = true } default = [] arch = ["dep:alpm"] debian = ["dep:rust-apt"] +flatpak = [] diff --git a/crates/pacdef_core/src/backend/actual/flatpak.rs b/crates/pacdef_core/src/backend/actual/flatpak.rs new file mode 100644 index 0000000..705fff2 --- /dev/null +++ b/crates/pacdef_core/src/backend/actual/flatpak.rs @@ -0,0 +1,50 @@ +use std::collections::HashSet; +use std::fs::read_to_string; +use std::path::PathBuf; +use std::process::ExitStatus; + +use anyhow::{Context, Result}; +use serde_json::Value; + +use crate::backend::backend_trait::{Backend, Switches, Text}; +use crate::{impl_backend_constants, Group, Package}; + +#[derive(Debug, Clone)] +pub struct Flatpak { + pub(crate) packages: HashSet, +} + +const BINARY: Text = "flatpak"; +const SECTION: Text = "flatpak"; + +const SWITCHES_INSTALL: Switches = &["install"]; +const SWITCHES_INFO: Switches = &[]; +const SWITCHES_MAKE_DEPENDENCY: Switches = &[]; +const SWITCHES_NOCONFIRM: Switches = &[]; +const SWITCHES_REMOVE: Switches = &["uninstall"]; + +const SUPPORTS_AS_DEPENDENCY: bool = false; + +impl Backend for Flatpak { + impl_backend_constants!(); + + fn get_all_installed_packages(&self) -> Result> { + Ok(HashSet::new()) + } + + fn get_explicitly_installed_packages(&self) -> Result> { + Ok(HashSet::new()) + } + + fn make_dependency(&self, _: &[Package]) -> Result { + panic!("not supported by {}", BINARY) + } +} + +impl Flatpak { + pub(crate) fn new() -> Self { + Self { + packages: HashSet::new(), + } + } +} diff --git a/crates/pacdef_core/src/backend/actual/mod.rs b/crates/pacdef_core/src/backend/actual/mod.rs index c714208..c8f8ba6 100644 --- a/crates/pacdef_core/src/backend/actual/mod.rs +++ b/crates/pacdef_core/src/backend/actual/mod.rs @@ -4,3 +4,5 @@ pub mod arch; pub mod debian; pub mod python; pub mod rust; +#[cfg(feature = "flatpak")] +pub mod flatpak; diff --git a/crates/pacdef_core/src/backend/mod.rs b/crates/pacdef_core/src/backend/mod.rs index c8c10f1..19d6445 100644 --- a/crates/pacdef_core/src/backend/mod.rs +++ b/crates/pacdef_core/src/backend/mod.rs @@ -18,4 +18,6 @@ pub enum Backends { Debian, Python, Rust, + #[cfg(feature = "flatpak")] + Flatpak, }