From b9e07c9a8cfd2471e1e3e6b88b3390a3d71bf526 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 15:45:38 -0400 Subject: Rename PROJECT_ACTIONS_FUNCTIONS to PROJECT_ACTIONS Original naming did not have the '_FUNCTIONS' suffix, which made it more clear as to the variable's purpose. This change reverts a previous rename of mine made erroneously. --- libs/project | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/project b/libs/project index bcb73f16..c2f0f764 100755 --- a/libs/project +++ b/libs/project @@ -17,7 +17,7 @@ PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean) PROJECT_ACTIONS_HELPERS=(arguments) -PROJECT_ACTIONS_FUNCTIONS=( +PROJECT_ACTIONS=( "${PROJECT_ACTIONS_GENERIC[@]}" "${PROJECT_ACTIONS_GENERIC[@]/%/_check}" "${PROJECT_ACTIONS_HELPERS[@]}" @@ -30,7 +30,7 @@ project_include() { local project_path=$( project_path "$project" ) - unset -f "${PROJECT_ACTIONS_FUNCTIONS[@]}" + unset -f "${PROJECT_ACTIONS[@]}" source "$project_path/$project" -- cgit v1.2.3-70-g09d2 From 15d5ee9e71fca2df938c5692d070f66733ab69ab Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 16:06:07 -0400 Subject: Add libreboot_setup_project_actions() The added function is called after all files in libs/ have been sourced and provides the correct action sequence for 'test'. Importantly, this function avoids providing undefined 'usage_check' and 'clean_check' actions. --- libreboot | 16 ++++++++++++++++ libs/project | 5 ----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'libs') diff --git a/libreboot b/libreboot index 9c58618e..fac84e8f 100755 --- a/libreboot +++ b/libreboot @@ -129,12 +129,28 @@ libreboot_setup() { executable="$(basename "$0")" libreboot_setup_include + libreboot_setup_project_actions requirements 'tar' 'sed' 'gpg' 'sha256sum' 'git' libreboot_setup_variables } +libreboot_setup_project_actions() { + local -i project_actions_count="${#PROJECT_ACTIONS_GENERIC[@]}" + local -a project_actions + + for ((i=0; i<"${project_actions_count}"; i++)); do + project_actions+=("${PROJECT_ACTIONS_GENERIC[i]}") + + if [[ "${PROJECT_ACTIONS_GENERIC[i]}" == !(usage|clean) ]]; then + project_actions+=("${PROJECT_ACTIONS_GENERIC[i]/%/_check}") + fi + done + + PROJECT_ACTIONS=("${PROJECT_ACTIONS_HELPERS[@]}" "${project_actions[@]}") +} + libreboot_setup_include() { local libs_path="${root}/libs" local conf_path diff --git a/libs/project b/libs/project index c2f0f764..6df2f714 100755 --- a/libs/project +++ b/libs/project @@ -17,11 +17,6 @@ PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean) PROJECT_ACTIONS_HELPERS=(arguments) -PROJECT_ACTIONS=( - "${PROJECT_ACTIONS_GENERIC[@]}" - "${PROJECT_ACTIONS_GENERIC[@]/%/_check}" - "${PROJECT_ACTIONS_HELPERS[@]}" -) INSTALL_REGEX='\([^:]*\):\(.*\)' -- cgit v1.2.3-70-g09d2 From f092e798d8300f20690da77ff034f75dd0c42a29 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 16:53:30 -0400 Subject: Fix action 'update_check' erroring out erroneously --- libs/project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/project b/libs/project index 6df2f714..7729c485 100755 --- a/libs/project +++ b/libs/project @@ -727,7 +727,7 @@ project_update_check_git() { requirements "git" - if git_project_check "$repository" + if ! git_project_check "$repository" then # Git repository should always be updated (even if upstream didn't progress). # For instance, this is useful for testing new versions of patches without changing revision. -- cgit v1.2.3-70-g09d2 From 3dab153b0e0d978a064711ec2ed14f174fd215c2 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 17:04:02 -0400 Subject: Rename TOOL_ACTIONS_FUNCTIONS to TOOL_ACTIONS Original naming did not have the '_FUNCTIONS' suffix, which made it more clear as to the variable's purpose. This change reverts a previous rename of mine made erroneously. --- libs/tool | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/tool b/libs/tool index 0f9fb063..1ee050c4 100755 --- a/libs/tool +++ b/libs/tool @@ -17,7 +17,7 @@ TOOL_ACTIONS_GENERIC=(usage update execute) TOOL_ACTIONS_HELPERS=(arguments) -TOOL_ACTIONS_FUNCTIONS=( +TOOL_ACTIONS=( "${TOOL_ACTIONS_GENERIC[@]}" "${TOOL_ACTIONS_GENERIC[@]/%/_check}" "${TOOL_ACTIONS_HELPERS[@]}" @@ -28,7 +28,7 @@ tool_include() { local tool_path=$( tool_path "$tool" ) - unset -f "${TOOL_ACTIONS_FUNCTIONS[@]}" + unset -f "${TOOL_ACTIONS[@]}" . "$tool_path/$tool" -- cgit v1.2.3-70-g09d2 From 274b669e1a1f45d592f4765b609afb37e2e66e43 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 22:39:16 -0400 Subject: Add libreboot_setup_tool_actions() The added function is a complement to libreboot_setup_project_actions() which moves generation of the TOOL_ACTIONS array out of libs/tool and into the main script for greater malleability. Notably, the proper elements are now included in the array. --- libreboot | 16 ++++++++++++++++ libs/tool | 5 ----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'libs') diff --git a/libreboot b/libreboot index fac84e8f..45d2fb86 100755 --- a/libreboot +++ b/libreboot @@ -129,6 +129,7 @@ libreboot_setup() { executable="$(basename "$0")" libreboot_setup_include + libreboot_setup_tool_actions libreboot_setup_project_actions requirements 'tar' 'sed' 'gpg' 'sha256sum' 'git' @@ -136,6 +137,21 @@ libreboot_setup() { libreboot_setup_variables } +libreboot_setup_tool_actions() { + local -i tool_actions_count="${#TOOL_ACTIONS_GENERIC[@]}" + local -a tool_actions + + for ((i=0; i<"${tool_actions_count}"; i++)); do + tool_actions+=("${TOOL_ACTIONS_GENERIC[i]}") + + if [[ "${TOOL_ACTIONS_GENERIC[i]}" == @(extract) ]]; then + tool_actions+=("${TOOL_ACTIONS_GENERIC[i]/%/_check}") + fi + done + + TOOL_ACTIONS=("${TOOL_ACTIONS_HELPERS[@]}" "${tool_actions[@]}") +} + libreboot_setup_project_actions() { local -i project_actions_count="${#PROJECT_ACTIONS_GENERIC[@]}" local -a project_actions diff --git a/libs/tool b/libs/tool index 1ee050c4..0fb09a96 100755 --- a/libs/tool +++ b/libs/tool @@ -17,11 +17,6 @@ TOOL_ACTIONS_GENERIC=(usage update execute) TOOL_ACTIONS_HELPERS=(arguments) -TOOL_ACTIONS=( - "${TOOL_ACTIONS_GENERIC[@]}" - "${TOOL_ACTIONS_GENERIC[@]/%/_check}" - "${TOOL_ACTIONS_HELPERS[@]}" -) tool_include() { local tool=$1 -- cgit v1.2.3-70-g09d2 From 656823d295a2740118428490099a33e09f76fe68 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 23:12:55 -0400 Subject: Create array TOOL_ACTIONS_GENERIC_IGNORE_CHECK Located in libs/tool, this array's elements are compared with actions in TOOLS_ACTIONS_GENERIC when libreboot_setup_tool_actions() is called. This makes it simpler to add/remove actions which should/shouldn't have a corresponding check function in TOOL_ACTIONS. --- libreboot | 4 +++- libs/tool | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libreboot b/libreboot index 1363e880..94eba109 100755 --- a/libreboot +++ b/libreboot @@ -155,12 +155,14 @@ libreboot_setup_include() { libreboot_setup_tool_actions() { local -i tool_actions_count="${#TOOL_ACTIONS_GENERIC[@]}" + local ignore="${TOOL_ACTIONS_GENERIC_IGNORE_CHECK[*]}" + local -a tool_actions for ((i=0; i<"${tool_actions_count}"; i++)); do tool_actions+=("${TOOL_ACTIONS_GENERIC[i]}") - if [[ "${TOOL_ACTIONS_GENERIC[i]}" == @(extract) ]]; then + if [[ "${TOOL_ACTIONS_GENERIC[i]}" == !(${ignore// /|}) ]]; then tool_actions+=("${TOOL_ACTIONS_GENERIC[i]/%/_check}") fi done diff --git a/libs/tool b/libs/tool index 0fb09a96..03d2d508 100755 --- a/libs/tool +++ b/libs/tool @@ -16,6 +16,7 @@ # along with this program. If not, see . TOOL_ACTIONS_GENERIC=(usage update execute) +TOOL_ACTIONS_GENERIC_IGNORE_CHECK=(usage update) TOOL_ACTIONS_HELPERS=(arguments) tool_include() { -- cgit v1.2.3-70-g09d2 From 38472cfdca9f6c61c84cbd84d5206e02716becfd Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 20 Jul 2017 23:30:42 -0400 Subject: Create array PROJECT_ACTIONS_GENERIC_IGNORE_CHECK Located in libs/project, this array's elements are compared with actions in PROJECTS_ACTIONS_GENERIC when libreboot_setup_project_actions() is called. This makes it simpler to add/remove actions which should/shouldn't have a corresponding check function in PROJECT_ACTIONS. --- libreboot | 4 +++- libs/project | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libreboot b/libreboot index 94eba109..59795d09 100755 --- a/libreboot +++ b/libreboot @@ -172,12 +172,14 @@ libreboot_setup_tool_actions() { libreboot_setup_project_actions() { local -i project_actions_count="${#PROJECT_ACTIONS_GENERIC[@]}" + local ignore="${PROJECT_ACTIONS_GENERIC_IGNORE_CHECK[*]}" + local -a project_actions for ((i=0; i<"${project_actions_count}"; i++)); do project_actions+=("${PROJECT_ACTIONS_GENERIC[i]}") - if [[ "${PROJECT_ACTIONS_GENERIC[i]}" == !(usage|clean) ]]; then + if [[ "${PROJECT_ACTIONS_GENERIC[i]}" == !(${ignore// /|}) ]]; then project_actions+=("${PROJECT_ACTIONS_GENERIC[i]/%/_check}") fi done diff --git a/libs/project b/libs/project index 7729c485..8eaf0d2d 100755 --- a/libs/project +++ b/libs/project @@ -16,6 +16,7 @@ # along with this program. If not, see . PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean) +PROJECT_ACTIONS_GENERIC_IGNORE_CHECK=(usage clean) PROJECT_ACTIONS_HELPERS=(arguments) INSTALL_REGEX='\([^:]*\):\(.*\)' -- cgit v1.2.3-70-g09d2