format: fix formatting
All checks were successful
/ check (push) Successful in 38s

This commit is contained in:
Didier Slof 2023-07-17 21:23:59 +02:00
parent f51c5dc9d5
commit f050daf035
Signed by: didier
GPG key ID: 01E71F18AA4398E5
12 changed files with 80 additions and 85 deletions

View file

@ -15,7 +15,7 @@ impl Display for BinError {
#[derive(Debug)]
pub enum BuildError {
InvalidManifest
InvalidManifest,
}
impl Display for BuildError {
@ -30,7 +30,7 @@ impl Display for BuildError {
pub enum InstallError {
BuildError(BuildError),
BinError(BinError),
Generic
Generic,
}
impl ToString for InstallError {

View file

@ -1,23 +1,23 @@
use std::fmt::Display;
use log::{debug, trace};
use crate::tmpfs::TempDir;
use errors::{BinError, BuildError, InstallError};
use log::{debug, trace};
use manifest::Manifest;
use pkgfile::PKGFile;
use crate::tmpfs::TempDir;
use std::fmt::Display;
pub mod errors;
#[derive(Debug)]
pub enum InstallType {
Build,
Bin
Bin,
}
#[derive(Debug)]
pub struct PackageInstaller {
manifest: Manifest,
pkgfile: PKGFile,
install_type: InstallType
install_type: InstallType,
}
impl PackageInstaller {
@ -25,7 +25,7 @@ impl PackageInstaller {
PackageInstaller {
manifest: m,
pkgfile: p,
install_type: i
install_type: i,
}
}
@ -46,8 +46,8 @@ impl PackageInstaller {
tmpdir.push(&self.manifest.package.name);
trace!("extracting package into: {}", tmpdir.to_string());
match self.extract_to(tmpdir.to_string()) {
Ok(_) => {},
Err(e) => return Err(e)
Ok(_) => {}
Err(e) => return Err(e),
}
debug!("extracted package in: {}", tmpdir.to_string());
Ok(())
@ -60,14 +60,13 @@ impl PackageInstaller {
let build_manifest = self.manifest.build.clone().unwrap();
// TODO: Check dependencies
Ok(())
}
pub fn install(&self) -> Result<(), InstallError> {
match self.install_type {
InstallType::Bin => self.bin().map_err(|e| InstallError::BinError(e)),
InstallType::Build => self.build().map_err(|e| InstallError::BuildError(e))
InstallType::Build => self.build().map_err(|e| InstallError::BuildError(e)),
}
}
}