Add support for multiple arguments when testing packages.

Fix #5
This commit is contained in:
Eduard Tolosa 2019-05-16 13:54:17 -05:00
parent 74457ebd8d
commit 916e871fa5
4 changed files with 5 additions and 7 deletions

Binary file not shown.

View file

@ -37,8 +37,9 @@ args:
- executable: - executable:
short: e short: e
long: executable long: executable
help: Name of the binary file provided by the package that you're installing in the chroot environment. help: Execute the command to test the package in the chroot environment.
takes_value: true takes_value: true
multiple: true
requires: requires:
- test - test
- package - package

View file

@ -356,7 +356,7 @@ pub fn test_package(package: &str, executable: &str) {
) )
.unwrap(); .unwrap();
Command::new("sudo") Command::new("sudo")
.args(&[&devtools_nspawn, &chroot_blackarch, executable]) .args(&[&devtools_nspawn, &chroot_blackarch, "sh", "-c", &executable])
.status() .status()
.expect( .expect(
"Something went wrong while trying to execute the binary in the chroot environment.", "Something went wrong while trying to execute the binary in the chroot environment.",

View file

@ -20,11 +20,8 @@ fn main() {
.value_of("package") .value_of("package")
.expect("Failed to convert in a valid String") .expect("Failed to convert in a valid String")
.to_string(); .to_string();
let executable = matches let executable: Vec<&str> = matches.values_of("executable").unwrap().collect();
.value_of("executable") functions::test_package(&package, &executable.join(" "));
.expect("Failed to convert in a valid String")
.to_string();
functions::test_package(&package, &executable);
} else if matches.is_present("install-missing") { } else if matches.is_present("install-missing") {
let missing_deps: Vec<&str> = matches.values_of("install-missing").unwrap().collect(); let missing_deps: Vec<&str> = matches.values_of("install-missing").unwrap().collect();
functions::build_package_with_missing_deps(&missing_deps.as_slice()); functions::build_package_with_missing_deps(&missing_deps.as_slice());