diff options
author | fxqnlr <[email protected]> | 2024-09-08 17:21:27 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-09-08 17:21:27 +0200 |
commit | a8d1be9536bce6d6be2cf1586c8bac049e820d31 (patch) | |
tree | 05c5c78c11f4506ba2eaa8a0751d3d896cfb81e9 /src/packages | |
parent | 695556c3441f5ffd40c35387a5b45e4459684c2c (diff) | |
download | arbs-a8d1be9536bce6d6be2cf1586c8bac049e820d31.tar arbs-a8d1be9536bce6d6be2cf1586c8bac049e820d31.tar.gz arbs-a8d1be9536bce6d6be2cf1586c8bac049e820d31.zip |
save files, real last modified check (doesn't work correctly)
Diffstat (limited to 'src/packages')
-rw-r--r-- | src/packages/pacman.rs | 14 | ||||
-rw-r--r-- | src/packages/portage.rs | 13 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/packages/pacman.rs b/src/packages/pacman.rs index 0a9e1ff..b5be4c0 100644 --- a/src/packages/pacman.rs +++ b/src/packages/pacman.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | use std::process::Command; | 1 | use std::process::Command; |
2 | 2 | ||
3 | use crate::packages::Package; | 3 | use super::{Package, PackageManager}; |
4 | 4 | ||
5 | use super::PackageManager; | 5 | use crate::error::{Error, Result}; |
6 | 6 | ||
7 | pub struct Pacman; | 7 | pub struct Pacman; |
8 | 8 | ||
9 | impl PackageManager for Pacman { | 9 | impl PackageManager for Pacman { |
10 | fn get_installed(&self) -> Vec<super::Package> { | 10 | fn get_installed(&self) -> Result<Vec<super::Package>> { |
11 | let pm_pkgs = Command::new("pacman").args(["-Q"]).output().unwrap(); | 11 | let pm_pkgs = Command::new("pacman").args(["-Q"]).output().unwrap(); |
12 | let pm_e_pkgs = Command::new("pacman") | 12 | let pm_e_pkgs = Command::new("pacman") |
13 | .args(["-Q", "--explicit"]) | 13 | .args(["-Q", "--explicit"]) |
@@ -25,7 +25,7 @@ impl PackageManager for Pacman { | |||
25 | }; | 25 | }; |
26 | let split: Vec<&str> = pkg.split_whitespace().collect(); | 26 | let split: Vec<&str> = pkg.split_whitespace().collect(); |
27 | if split.len() != 2 { | 27 | if split.len() != 2 { |
28 | panic!("Unknown Pacman Output"); | 28 | return Err(Error::UnknownOutput); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | let explicit = pm_e_pkgs_out.contains(pkg); | 31 | let explicit = pm_e_pkgs_out.contains(pkg); |
@@ -33,14 +33,14 @@ impl PackageManager for Pacman { | |||
33 | pkgs.push(Package { | 33 | pkgs.push(Package { |
34 | id: split[0].to_string(), | 34 | id: split[0].to_string(), |
35 | version: split[1].to_string(), | 35 | version: split[1].to_string(), |
36 | explicit | 36 | explicit, |
37 | }) | 37 | }) |
38 | } | 38 | } |
39 | 39 | ||
40 | pkgs | 40 | Ok(pkgs) |
41 | } | 41 | } |
42 | 42 | ||
43 | fn install(&self, pkgs: Vec<Package>) { | 43 | fn install(&self, _pkgs: Vec<super::Package>) { |
44 | todo!(); | 44 | todo!(); |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/src/packages/portage.rs b/src/packages/portage.rs new file mode 100644 index 0000000..6b9e508 --- /dev/null +++ b/src/packages/portage.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | use super::PackageManager; | ||
2 | |||
3 | pub struct Portage; | ||
4 | |||
5 | impl PackageManager for Portage { | ||
6 | fn get_installed(&self) -> crate::error::Result<Vec<super::Package>> { | ||
7 | todo!() | ||
8 | } | ||
9 | |||
10 | fn install(&self, pkgs: Vec<super::Package>) { | ||
11 | todo!() | ||
12 | } | ||
13 | } | ||