attempt to fix #3

main
jan Michal 3 years ago
parent 8eeb2aa841
commit cf1eb4a477
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -1,5 +1,5 @@
use crate::repository::generate; use crate::repository::generate;
use crate::{crash, repository, workspace}; use crate::{crash, info, repository, workspace};
use clap::ArgMatches; use clap::ArgMatches;
pub fn build(matches: &ArgMatches) { pub fn build(matches: &ArgMatches) {
@ -41,11 +41,16 @@ pub fn build(matches: &ArgMatches) {
} }
} }
let mut errored: Vec<String> = vec![];
for pkg in packages { for pkg in packages {
if !repos.contains(&pkg) { if !repos.contains(&pkg) {
crash(format!("Package {} not found in repos in mlc.toml", pkg), 3); crash(format!("Package {} not found in repos in mlc.toml", pkg), 3);
} else { } else {
repository::build(pkg); let code = repository::build(&pkg);
if code != 0 {
errored.push(pkg);
}
} }
} }
@ -55,7 +60,10 @@ pub fn build(matches: &ArgMatches) {
.is_present("all") .is_present("all")
{ {
for pkg in repos { for pkg in repos {
repository::build(pkg); let code = repository::build(&pkg);
if code != 0 {
errored.push(pkg);
}
} }
generate(); generate();
} }
@ -67,4 +75,8 @@ pub fn build(matches: &ArgMatches) {
{ {
repository::generate(); repository::generate();
} }
}
if !errored.is_empty() {
info(format!("The following packages build jobs returned a non-zero exit code: {}", errored.join(" ")))
}
}

@ -2,8 +2,8 @@ mod config;
mod package; mod package;
mod repo; mod repo;
pub fn build(pkg: String) { pub fn build(pkg: &str) -> i32 {
package::build(pkg); package::build(pkg)
} }
pub fn generate() { pub fn generate() {
@ -12,4 +12,4 @@ pub fn generate() {
pub fn create_config() { pub fn create_config() {
config::create_config(); config::create_config();
} }

@ -3,7 +3,7 @@ use std::path::Path;
use std::process::Command; use std::process::Command;
use std::{env, fs}; use std::{env, fs};
pub fn build(pkg: String) { pub fn build(pkg: &str) -> i32 {
let dir = env::current_dir().unwrap(); let dir = env::current_dir().unwrap();
if !Path::exists("out".as_ref()) { if !Path::exists("out".as_ref()) {
fs::create_dir_all("out").unwrap(); fs::create_dir_all("out").unwrap();
@ -14,7 +14,7 @@ pub fn build(pkg: String) {
env::set_current_dir(pkg).unwrap(); env::set_current_dir(pkg).unwrap();
Command::new("makepkg") let a = Command::new("makepkg")
.args(&["-sf", "--skippgpcheck", "--sign", "--noconfirm"]) .args(&["-sf", "--skippgpcheck", "--sign", "--noconfirm"])
.spawn() .spawn()
.unwrap() .unwrap()
@ -29,4 +29,6 @@ pub fn build(pkg: String) {
.unwrap(); .unwrap();
env::set_current_dir(dir).unwrap(); env::set_current_dir(dir).unwrap();
}
a.code().unwrap()
}
Loading…
Cancel
Save