Add a minimal flatpak backend

This commit is contained in:
teackot
2023-05-16 12:11:23 +03:00
parent 2ef3d7c36f
commit 26352160be
5 changed files with 56 additions and 0 deletions
+1
View File
@@ -35,3 +35,4 @@ rust-apt = { version = "0.5", optional = true }
default = []
arch = ["dep:alpm"]
debian = ["dep:rust-apt"]
flatpak = []
@@ -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<Package>,
}
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<HashSet<Package>> {
Ok(HashSet::new())
}
fn get_explicitly_installed_packages(&self) -> Result<HashSet<Package>> {
Ok(HashSet::new())
}
fn make_dependency(&self, _: &[Package]) -> Result<ExitStatus> {
panic!("not supported by {}", BINARY)
}
}
impl Flatpak {
pub(crate) fn new() -> Self {
Self {
packages: HashSet::new(),
}
}
}
@@ -4,3 +4,5 @@ pub mod arch;
pub mod debian;
pub mod python;
pub mod rust;
#[cfg(feature = "flatpak")]
pub mod flatpak;
+2
View File
@@ -18,4 +18,6 @@ pub enum Backends {
Debian,
Python,
Rust,
#[cfg(feature = "flatpak")]
Flatpak,
}