clippy and formatting
This commit is contained in:
@@ -33,4 +33,3 @@ strip = true
|
|||||||
default = []
|
default = []
|
||||||
debian = ["pacdef_core/debian"]
|
debian = ["pacdef_core/debian"]
|
||||||
arch = ["pacdef_core/arch"]
|
arch = ["pacdef_core/arch"]
|
||||||
void = ["pacdef_core/void"]
|
|
||||||
|
|||||||
@@ -88,11 +88,11 @@ Pull requests for additional backends are welcome!
|
|||||||
| ----------- | --------------- | ----------- | ------------ | ---------------------------------------------------------------------------------------- |
|
| ----------- | --------------- | ----------- | ------------ | ---------------------------------------------------------------------------------------- |
|
||||||
| Arch Linux | `pacman` | `[arch]` | `arch` | includes pacman-wrapping AUR helpers (configurable) |
|
| Arch Linux | `pacman` | `[arch]` | `arch` | includes pacman-wrapping AUR helpers (configurable) |
|
||||||
| Debian | `apt` | `[debian]` | `debian` | minimum supported apt-version 2.0.2 ([see upstream](https://gitlab.com/volian/rust-apt)) |
|
| Debian | `apt` | `[debian]` | `debian` | minimum supported apt-version 2.0.2 ([see upstream](https://gitlab.com/volian/rust-apt)) |
|
||||||
| Void Linux | `xbps` | `[void]` | `void` | |
|
|
||||||
| Flatpak | `flatpak` | `[flatpak]` | built-in | can manage either system-wide or per-user installation (configurable) |
|
| Flatpak | `flatpak` | `[flatpak]` | built-in | can manage either system-wide or per-user installation (configurable) |
|
||||||
| Python | `pip` | `[python]` | built-in | |
|
| Python | `pip` | `[python]` | built-in | |
|
||||||
| Rust | `cargo` | `[rust]` | built-in | |
|
| Rust | `cargo` | `[rust]` | built-in | |
|
||||||
| Rustup | `rustup` | `[rustup]` | built-in | See the comments [below](#rustup) about the syntax of the packages in the group file. |
|
| Rustup | `rustup` | `[rustup]` | built-in | See the comments [below](#rustup) about the syntax of the packages in the group file. |
|
||||||
|
| Void Linux | `xbps` | `[void]` | built-in | |
|
||||||
|
|
||||||
Backends that have a `feature flag` require setting the respective flag for the build process.
|
Backends that have a `feature flag` require setting the respective flag for the build process.
|
||||||
The appropriate system libraries and their header files must be present on the machine and be detectable by `pkg-config`.
|
The appropriate system libraries and their header files must be present on the machine and be detectable by `pkg-config`.
|
||||||
|
|||||||
@@ -38,4 +38,3 @@ rstest = "0.18"
|
|||||||
default = []
|
default = []
|
||||||
arch = ["dep:alpm"]
|
arch = ["dep:alpm"]
|
||||||
debian = ["dep:rust-apt", "dep:libc"]
|
debian = ["dep:rust-apt", "dep:libc"]
|
||||||
void = []
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
pub mod arch;
|
pub mod arch;
|
||||||
#[cfg(feature = "debian")]
|
#[cfg(feature = "debian")]
|
||||||
pub mod debian;
|
pub mod debian;
|
||||||
#[cfg(feature = "void")]
|
|
||||||
pub mod void;
|
|
||||||
pub mod flatpak;
|
pub mod flatpak;
|
||||||
pub mod python;
|
pub mod python;
|
||||||
pub mod rust;
|
pub mod rust;
|
||||||
pub mod rustup;
|
pub mod rustup;
|
||||||
|
pub mod void;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use core::panic;
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::process::{Command, ExitStatus};
|
use std::process::{Command, ExitStatus};
|
||||||
|
|
||||||
@@ -28,23 +27,6 @@ const SWITCHES_NOCONFIRM: Switches = &["-y"];
|
|||||||
const SWITCHES_REMOVE: Switches = &["-R"];
|
const SWITCHES_REMOVE: Switches = &["-R"];
|
||||||
|
|
||||||
const SUPPORTS_AS_DEPENDENCY: bool = true;
|
const SUPPORTS_AS_DEPENDENCY: bool = true;
|
||||||
impl Void {
|
|
||||||
fn get_binary_info(&self) -> Text {
|
|
||||||
QUERY_BINARY
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_binary_install(&self) -> Text {
|
|
||||||
INSTALL_BINARY
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_binary_remove(&self) -> Text {
|
|
||||||
REMOVE_BINARY
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_binary_make_dependency(&self) -> Text {
|
|
||||||
PKGDB_BINARY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Backend for Void {
|
impl Backend for Void {
|
||||||
impl_backend_constants!();
|
impl_backend_constants!();
|
||||||
@@ -56,8 +38,8 @@ impl Backend for Void {
|
|||||||
let re_str_2 = r"-[^-]*$";
|
let re_str_2 = r"-[^-]*$";
|
||||||
let re1 = Regex::new(re_str_1)?;
|
let re1 = Regex::new(re_str_1)?;
|
||||||
let re2 = Regex::new(re_str_2)?;
|
let re2 = Regex::new(re_str_2)?;
|
||||||
let mut cmd = Command::new(self.get_binary_info());
|
let mut cmd = Command::new(QUERY_BINARY);
|
||||||
cmd.args(&["-l"]);
|
cmd.args(["-l"]);
|
||||||
let output = String::from_utf8(cmd.output()?.stdout)?;
|
let output = String::from_utf8(cmd.output()?.stdout)?;
|
||||||
|
|
||||||
let packages: HashSet<Package> = output
|
let packages: HashSet<Package> = output
|
||||||
@@ -75,7 +57,7 @@ impl Backend for Void {
|
|||||||
// Removes the package version from output
|
// Removes the package version from output
|
||||||
let re_str = r"-[^-]*$";
|
let re_str = r"-[^-]*$";
|
||||||
let re = Regex::new(re_str)?;
|
let re = Regex::new(re_str)?;
|
||||||
let mut cmd = Command::new(self.get_binary_info());
|
let mut cmd = Command::new(QUERY_BINARY);
|
||||||
cmd.args(self.get_switches_info());
|
cmd.args(self.get_switches_info());
|
||||||
let output = String::from_utf8(cmd.output()?.stdout)?;
|
let output = String::from_utf8(cmd.output()?.stdout)?;
|
||||||
|
|
||||||
@@ -92,7 +74,7 @@ impl Backend for Void {
|
|||||||
/// Install the specified packages.
|
/// Install the specified packages.
|
||||||
fn install_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
fn install_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
||||||
let mut cmd = Command::new("sudo");
|
let mut cmd = Command::new("sudo");
|
||||||
cmd.arg(self.get_binary_install());
|
cmd.arg(INSTALL_BINARY);
|
||||||
cmd.args(self.get_switches_install());
|
cmd.args(self.get_switches_install());
|
||||||
|
|
||||||
if noconfirm {
|
if noconfirm {
|
||||||
@@ -109,7 +91,7 @@ impl Backend for Void {
|
|||||||
|
|
||||||
fn remove_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
fn remove_packages(&self, packages: &[Package], noconfirm: bool) -> Result<ExitStatus> {
|
||||||
let mut cmd = Command::new("sudo");
|
let mut cmd = Command::new("sudo");
|
||||||
cmd.arg(self.get_binary_remove());
|
cmd.arg(REMOVE_BINARY);
|
||||||
cmd.args(self.get_switches_remove());
|
cmd.args(self.get_switches_remove());
|
||||||
|
|
||||||
if noconfirm {
|
if noconfirm {
|
||||||
@@ -126,7 +108,7 @@ impl Backend for Void {
|
|||||||
|
|
||||||
fn make_dependency(&self, packages: &[Package]) -> Result<ExitStatus> {
|
fn make_dependency(&self, packages: &[Package]) -> Result<ExitStatus> {
|
||||||
let mut cmd = Command::new("sudo");
|
let mut cmd = Command::new("sudo");
|
||||||
cmd.arg(self.get_binary_make_dependency());
|
cmd.arg(PKGDB_BINARY);
|
||||||
cmd.args(self.get_switches_make_dependency());
|
cmd.args(self.get_switches_make_dependency());
|
||||||
|
|
||||||
for p in packages {
|
for p in packages {
|
||||||
@@ -139,8 +121,8 @@ impl Backend for Void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Void {
|
impl Void {
|
||||||
pub fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Void {
|
Self {
|
||||||
packages: HashSet::new(),
|
packages: HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ pub enum Backends {
|
|||||||
Arch,
|
Arch,
|
||||||
#[cfg(feature = "debian")]
|
#[cfg(feature = "debian")]
|
||||||
Debian,
|
Debian,
|
||||||
#[cfg(feature = "void")]
|
|
||||||
Void,
|
|
||||||
Flatpak,
|
Flatpak,
|
||||||
Python,
|
Python,
|
||||||
Rust,
|
Rust,
|
||||||
Rustup,
|
Rustup,
|
||||||
|
Void,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user