From 947101eb07df71add6a050049853449d74d07fa4 Mon Sep 17 00:00:00 2001 From: steven-omaha <35634100+steven-omaha@users.noreply.github.com> Date: Wed, 15 Feb 2023 10:51:52 +0100 Subject: [PATCH] rename backend from pacman to arch --- README.md | 12 +++++++----- .../src/backend/actual/{pacman.rs => arch.rs} | 8 ++++---- crates/pacdef_core/src/backend/actual/mod.rs | 2 +- crates/pacdef_core/src/backend/mod.rs | 2 +- crates/pacdef_core/src/core.rs | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) rename crates/pacdef_core/src/backend/actual/{pacman.rs => arch.rs} (97%) diff --git a/README.md b/README.md index 5e98c32..306983b 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,12 @@ multi-backend declarative package manager for Linux ## Use-case `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. - -`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. +The group files are maintained outside of `pacdef` by any VCS, like git. 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 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` * 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 diff --git a/crates/pacdef_core/src/backend/actual/pacman.rs b/crates/pacdef_core/src/backend/actual/arch.rs similarity index 97% rename from crates/pacdef_core/src/backend/actual/pacman.rs rename to crates/pacdef_core/src/backend/actual/arch.rs index 1e0193c..35f2f50 100644 --- a/crates/pacdef_core/src/backend/actual/pacman.rs +++ b/crates/pacdef_core/src/backend/actual/arch.rs @@ -9,21 +9,21 @@ use crate::backend::backend_trait::{Backend, Switches, Text}; use crate::{impl_backend_constants, Group, Package}; #[derive(Debug)] -pub struct Pacman { +pub struct Arch { pub(crate) binary: String, pub(crate) aur_rm_args: Option>, pub(crate) packages: HashSet, } const BINARY: Text = "paru"; -const SECTION: Text = "pacman"; +const SECTION: Text = "arch"; const SWITCHES_INFO: Switches = &["--query", "--info"]; const SWITCHES_INSTALL: Switches = &["--sync"]; const SWITCHES_MAKE_DEPENDENCY: Switches = &["--database", "--asdeps"]; const SWITCHES_REMOVE: Switches = &["--remove", "--recursive"]; -impl Backend for Pacman { +impl Backend for Arch { impl_backend_constants!(); fn get_all_installed_packages(&self) -> Result> { @@ -104,7 +104,7 @@ fn get_db_handle() -> Result { Alpm::new("/", "/var/lib/pacman").context("connecting to DB using expected default values") } -impl Pacman { +impl Arch { pub(crate) fn new() -> Self { Self { binary: BINARY.to_string(), diff --git a/crates/pacdef_core/src/backend/actual/mod.rs b/crates/pacdef_core/src/backend/actual/mod.rs index fea2d97..1c24472 100644 --- a/crates/pacdef_core/src/backend/actual/mod.rs +++ b/crates/pacdef_core/src/backend/actual/mod.rs @@ -1,2 +1,2 @@ -pub mod pacman; +pub mod arch; pub mod rust; diff --git a/crates/pacdef_core/src/backend/mod.rs b/crates/pacdef_core/src/backend/mod.rs index f9f38a6..7589743 100644 --- a/crates/pacdef_core/src/backend/mod.rs +++ b/crates/pacdef_core/src/backend/mod.rs @@ -12,6 +12,6 @@ use pacdef_macros::Register; #[derive(Debug, Register)] pub enum Backends { - Pacman, + Arch, Rust, } diff --git a/crates/pacdef_core/src/core.rs b/crates/pacdef_core/src/core.rs index 4acdafc..ae3e9de 100644 --- a/crates/pacdef_core/src/core.rs +++ b/crates/pacdef_core/src/core.rs @@ -92,8 +92,8 @@ impl Pacdef { } fn overwrite_values_from_config(&mut self, backend: Box) -> Box { - if backend.get_section() == "pacman" { - Box::new(crate::backend::Pacman { + if backend.get_section() == "arch" { + Box::new(crate::backend::Arch { binary: self.config.aur_helper.clone(), aur_rm_args: self.config.aur_rm_args.take(), packages: HashSet::new(),