This commit is contained in:
parent
f51c5dc9d5
commit
f050daf035
12 changed files with 80 additions and 85 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue