Add a minimal flatpak backend
This commit is contained in:
@@ -33,3 +33,4 @@ strip = true
|
||||
default = []
|
||||
debian = ["pacdef_core/debian"]
|
||||
arch = ["pacdef_core/arch"]
|
||||
flatpak = ["pacdef_core/flatpak"]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,4 +18,6 @@ pub enum Backends {
|
||||
Debian,
|
||||
Python,
|
||||
Rust,
|
||||
#[cfg(feature = "flatpak")]
|
||||
Flatpak,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user