|
|
@ -1,6 +1,6 @@
|
|
|
|
use git2::Repository;
|
|
|
|
use git2::Repository;
|
|
|
|
use std::{env, fs, path::Path, process::Command};
|
|
|
|
use std::{env, fs, path::Path, process::Command};
|
|
|
|
use crate::{err_unrec, inf, inssort};
|
|
|
|
use crate::{err_unrec, inf, inssort, mods::strs::succ, mods::strs::sec};
|
|
|
|
|
|
|
|
|
|
|
|
pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
let cachedir = format!("{}/.cache/ame", std::env::var("HOME").unwrap());
|
|
|
|
let cachedir = format!("{}/.cache/ame", std::env::var("HOME").unwrap());
|
|
|
@ -56,7 +56,11 @@ pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
err_unrec(format!("Could not enter package directory"))
|
|
|
|
err_unrec(format!("Could not enter package directory"))
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
let aurpkgname = results[0].name.to_string();
|
|
|
|
sec(format!("Installing AUR package depends"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// you can use this to get the makedepends too - just use the make_depends field instead of the depends field
|
|
|
|
|
|
|
|
// | riiiiight
|
|
|
|
|
|
|
|
let aurpkgname = results[0].name.to_string(); // v here
|
|
|
|
let depends = raur::info(&[&aurpkgname]).unwrap()[0].depends.clone();
|
|
|
|
let depends = raur::info(&[&aurpkgname]).unwrap()[0].depends.clone();
|
|
|
|
if noconfirm == true {
|
|
|
|
if noconfirm == true {
|
|
|
|
inssort(true, depends);
|
|
|
|
inssort(true, depends);
|
|
|
@ -67,28 +71,32 @@ pub fn clone(noconfirm: bool, pkg: &str) {
|
|
|
|
Repository::clone(&url, Path::new(&pkgdir)).unwrap();
|
|
|
|
Repository::clone(&url, Path::new(&pkgdir)).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
if noconfirm == true {
|
|
|
|
if noconfirm == true {
|
|
|
|
inf(format!("Installing {} ...", pkg));
|
|
|
|
sec(format!("Installing {} ...", pkg));
|
|
|
|
let install_result = Command::new("makepkg")
|
|
|
|
let install_result = Command::new("makepkg")
|
|
|
|
.arg("-si")
|
|
|
|
.arg("-si")
|
|
|
|
.arg("--noconfirm")
|
|
|
|
.arg("--noconfirm")
|
|
|
|
.status();
|
|
|
|
.status();
|
|
|
|
match install_result {
|
|
|
|
match install_result {
|
|
|
|
Ok(_) => {
|
|
|
|
Ok(_) => {
|
|
|
|
inf(format!("Succesfully installed {}", pkg));
|
|
|
|
succ(format!("Succesfully installed {}", pkg));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(_) => {
|
|
|
|
Err(_) => {
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
inf(format!("Installing {} ...", pkg));
|
|
|
|
sec(format!("Installing {} ...", pkg));
|
|
|
|
let install_result = Command::new("makepkg")
|
|
|
|
let install_result = Command::new("makepkg")
|
|
|
|
.arg("-si")
|
|
|
|
.arg("-si")
|
|
|
|
.status();
|
|
|
|
.status()
|
|
|
|
match install_result {
|
|
|
|
.expect("Couldn't call makepkg");
|
|
|
|
Ok(_) => {
|
|
|
|
match install_result.code() {
|
|
|
|
inf(format!("Succesfully installed {}", pkg));
|
|
|
|
Some(0) => {
|
|
|
|
|
|
|
|
succ(format!("Succesfully installed {}", pkg));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(_) => {
|
|
|
|
Some(_) => {
|
|
|
|
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
None => {
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
err_unrec(format!("Couldn't install {}", pkg));
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
}
|
|
|
|
}
|
|
|
|