rename backend from pacman to arch

This commit is contained in:
steven-omaha
2023-02-15 10:51:52 +01:00
parent 83fbe765d8
commit 947101eb07
5 changed files with 15 additions and 13 deletions
+7 -5
View File
@@ -6,14 +6,12 @@ multi-backend declarative package manager for Linux
## Use-case ## Use-case
`pacdef` allows the user to have consistent packages among multiple Linux machines by managing packages in group files. `pacdef` allows the user to have consistent packages among multiple Linux machines by managing packages in group files.
The group files are maintained outside of `pacdef` by any VCS. The group files are maintained outside of `pacdef` by any VCS, like git.
`pacdef import`ing a package group file creates a symlink to that file in `pacdef`'s config dir, thereby letting `pacdef` know you want to have the packages in this file on your machine.
Then installing all packages from all groups is as simple as `pacdef sync`.
All package operations are executed by the respective package managers.
If you work with multiple Linux machines and have asked yourself "*Why do I have the program that I use every day on my other machine not installed here?*", then `pacdef` is the tool for you. If you work with multiple Linux machines and have asked yourself "*Why do I have the program that I use every day on my other machine not installed here?*", then `pacdef` is the tool for you.
## Supported backends ## Supported backends
At the moment, supported backends are limited to the following. At the moment, supported backends are limited to the following.
@@ -68,6 +66,10 @@ Usage on different machines:
* search for the group that contains a package: `pacdef search firefox` * search for the group that contains a package: `pacdef search firefox`
* show packages of a group: `pacdef show desktop` * show packages of a group: `pacdef show desktop`
`pacdef import`ing a package group file creates a symlink to that file in `pacdef`'s config dir, thereby letting `pacdef` know you want to have the packages in this file on your machine.
Then installing all packages from all groups is as simple as `pacdef sync`.
All package operations are executed by the respective package managers.
### Configuration ### Configuration
@@ -9,21 +9,21 @@ use crate::backend::backend_trait::{Backend, Switches, Text};
use crate::{impl_backend_constants, Group, Package}; use crate::{impl_backend_constants, Group, Package};
#[derive(Debug)] #[derive(Debug)]
pub struct Pacman { pub struct Arch {
pub(crate) binary: String, pub(crate) binary: String,
pub(crate) aur_rm_args: Option<Vec<String>>, pub(crate) aur_rm_args: Option<Vec<String>>,
pub(crate) packages: HashSet<Package>, pub(crate) packages: HashSet<Package>,
} }
const BINARY: Text = "paru"; const BINARY: Text = "paru";
const SECTION: Text = "pacman"; const SECTION: Text = "arch";
const SWITCHES_INFO: Switches = &["--query", "--info"]; const SWITCHES_INFO: Switches = &["--query", "--info"];
const SWITCHES_INSTALL: Switches = &["--sync"]; const SWITCHES_INSTALL: Switches = &["--sync"];
const SWITCHES_MAKE_DEPENDENCY: Switches = &["--database", "--asdeps"]; const SWITCHES_MAKE_DEPENDENCY: Switches = &["--database", "--asdeps"];
const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"]; const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"];
impl Backend for Pacman { impl Backend for Arch {
impl_backend_constants!(); impl_backend_constants!();
fn get_all_installed_packages(&self) -> Result<HashSet<Package>> { fn get_all_installed_packages(&self) -> Result<HashSet<Package>> {
@@ -104,7 +104,7 @@ fn get_db_handle() -> Result<Alpm> {
Alpm::new("/", "/var/lib/pacman").context("connecting to DB using expected default values") Alpm::new("/", "/var/lib/pacman").context("connecting to DB using expected default values")
} }
impl Pacman { impl Arch {
pub(crate) fn new() -> Self { pub(crate) fn new() -> Self {
Self { Self {
binary: BINARY.to_string(), binary: BINARY.to_string(),
+1 -1
View File
@@ -1,2 +1,2 @@
pub mod pacman; pub mod arch;
pub mod rust; pub mod rust;
+1 -1
View File
@@ -12,6 +12,6 @@ use pacdef_macros::Register;
#[derive(Debug, Register)] #[derive(Debug, Register)]
pub enum Backends { pub enum Backends {
Pacman, Arch,
Rust, Rust,
} }
+2 -2
View File
@@ -92,8 +92,8 @@ impl Pacdef {
} }
fn overwrite_values_from_config(&mut self, backend: Box<dyn Backend>) -> Box<dyn Backend> { fn overwrite_values_from_config(&mut self, backend: Box<dyn Backend>) -> Box<dyn Backend> {
if backend.get_section() == "pacman" { if backend.get_section() == "arch" {
Box::new(crate::backend::Pacman { Box::new(crate::backend::Arch {
binary: self.config.aur_helper.clone(), binary: self.config.aur_helper.clone(),
aur_rm_args: self.config.aur_rm_args.take(), aur_rm_args: self.config.aur_rm_args.take(),
packages: HashSet::new(), packages: HashSet::new(),