From 69d7863ae69758393ace8fbed12102b8abef3af3 Mon Sep 17 00:00:00 2001 From: Eduard Toloza Date: Sun, 12 May 2019 21:06:09 -0500 Subject: [PATCH] Sync in every action and make update optional. --- src/cli.yml | 13 ++++--------- src/functions.rs | 1 - src/main.rs | 26 ++++---------------------- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/cli.yml b/src/cli.yml index bfe7eed..3a5277f 100644 --- a/src/cli.yml +++ b/src/cli.yml @@ -11,11 +11,6 @@ args: long: setup help: Setup the clean chroot environment (automatically setup blackarch keyring). takes_value: false - - update: - short: u - long: update - help: Update BlackArch Linux chroot environment. - takes_value: false - build: short: b long: build @@ -53,10 +48,10 @@ args: help: Build package files that aren't available in repos. You can specify it multiple times. multiple: true takes_value: true - - clean: - short: c - long: clean - help: Clean chroot environment before building. + - update: + short: u + long: update + help: Update chroot environment before building. takes_value: false - verbose: short: v diff --git a/src/functions.rs b/src/functions.rs index 73b3158..20325ed 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -178,7 +178,6 @@ pub fn update_chroot_packages() { pub fn build_package() { sync_chroot(); - update_chroot_packages(); let devtools_makechrootpkg = get_vars("makechrootpkg"); let chroot_dir = get_vars("chroot_dir"); let blackarch_instance = get_vars("blackarch_instance"); diff --git a/src/main.rs b/src/main.rs index a494641..c1c0f03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,7 @@ fn main() { if matches.is_present("setup") { functions::setup_chroot(); } else if matches.is_present("build") { - if matches.is_present("clean") { - functions::sync_chroot(); - functions::build_package(); - } else { - functions::build_package(); - } + functions::build_package(); } else if matches.is_present("update") { functions::update_chroot_packages(); } else if matches.is_present("test") { @@ -29,22 +24,9 @@ fn main() { .value_of("executable") .expect("Failed to convert in a valid String") .to_string(); - if matches.is_present("clean") { - functions::sync_chroot(); - functions::test_package(&package, &executable); - } else { - functions::test_package(&package, &executable); - } + functions::test_package(&package, &executable); } else if matches.is_present("install-missing") { - if matches.is_present("clean") { - functions::sync_chroot(); - let missing_deps: Vec<&str> = matches.values_of("install-missing").unwrap().collect(); - functions::build_package_with_missing_deps(&missing_deps.as_slice()); - } else { - let missing_deps: Vec<&str> = matches.values_of("install-missing").unwrap().collect(); - functions::build_package_with_missing_deps(&missing_deps.as_slice()); - } - } else if matches.is_present("clean") { - functions::sync_chroot(); + let missing_deps: Vec<&str> = matches.values_of("install-missing").unwrap().collect(); + functions::build_package_with_missing_deps(&missing_deps.as_slice()); } }