aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlibreboot49
-rwxr-xr-xlibs/project10
-rwxr-xr-xlibs/tool8
3 files changed, 48 insertions, 19 deletions
diff --git a/libreboot b/libreboot
index bb6e4141..59795d09 100755
--- a/libreboot
+++ b/libreboot
@@ -81,17 +81,17 @@ libreboot_project() {
(
set +e
- project_action_arguments "extract" "${project}" "$@" && return 0
- project_action_arguments "download" "${project}" "$@" && return 0
+ project_action_arguments 'extract' "${project}" "$@" && return 0
+ project_action_arguments 'download' "${project}" "$@" && return 0
)
;;
'produce')
- for action in "build" "install" "release"; do
+ for action in 'build' 'install' 'release'; do
project_action_arguments "${action}" "${project}" "$@"
done
;;
'test')
- for action in ${PROJECT_ACTIONS}; do
+ for action in "${PROJECT_ACTIONS[@]}"; do
project_action_arguments "${action}" "${project}" "$@"
done
;;
@@ -129,6 +129,8 @@ libreboot_setup() {
executable="$(basename "$0")"
libreboot_setup_include
+ libreboot_setup_tool_actions
+ libreboot_setup_project_actions
requirements 'tar' 'sed' 'gpg' 'sha256sum' 'git'
@@ -151,11 +153,43 @@ libreboot_setup_include() {
fi
}
+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]}" == !(${ignore// /|}) ]]; 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 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]}" == !(${ignore// /|}) ]]; then
+ project_actions+=("${PROJECT_ACTIONS_GENERIC[i]/%/_check}")
+ fi
+ done
+
+ PROJECT_ACTIONS=("${PROJECT_ACTIONS_HELPERS[@]}" "${project_actions[@]}")
+}
+
libreboot_setup_variables() {
local vboot_tools_path="$(project_install_path 'vboot' 'tools')"
local version_path="${root}/${DOTVERSION}"
- local epoch_path="${root}/${DOTEPOCH}"
- local rnd_seed_path="${root}/${DOTRNDSEED}"
if [[ -z "${VERSION}" ]]; then
if git_check "${root}"; then
@@ -175,6 +209,9 @@ libreboot_setup_variables() {
}
libreboot_setup_reproducible_builds_variables() {
+ local epoch_path="${root}/${DOTEPOCH}"
+ local rnd_seed_path="${root}/${DOTRNDSEED}"
+
# Used by GCC, e.g., -frandom-seed="${RANDOM_SEED}"
if [[ -z "${RANDOM_SEED}" ]]; then
if [[ -f "${rnd_seed_path}" ]]; then
diff --git a/libs/project b/libs/project
index bcb73f16..8eaf0d2d 100755
--- a/libs/project
+++ b/libs/project
@@ -16,12 +16,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean)
+PROJECT_ACTIONS_GENERIC_IGNORE_CHECK=(usage clean)
PROJECT_ACTIONS_HELPERS=(arguments)
-PROJECT_ACTIONS_FUNCTIONS=(
- "${PROJECT_ACTIONS_GENERIC[@]}"
- "${PROJECT_ACTIONS_GENERIC[@]/%/_check}"
- "${PROJECT_ACTIONS_HELPERS[@]}"
-)
INSTALL_REGEX='\([^:]*\):\(.*\)'
@@ -30,7 +26,7 @@ project_include() {
local project_path=$( project_path "$project" )
- unset -f "${PROJECT_ACTIONS_FUNCTIONS[@]}"
+ unset -f "${PROJECT_ACTIONS[@]}"
source "$project_path/$project"
@@ -732,7 +728,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.
diff --git a/libs/tool b/libs/tool
index 0f9fb063..03d2d508 100755
--- a/libs/tool
+++ b/libs/tool
@@ -16,19 +16,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TOOL_ACTIONS_GENERIC=(usage update execute)
+TOOL_ACTIONS_GENERIC_IGNORE_CHECK=(usage update)
TOOL_ACTIONS_HELPERS=(arguments)
-TOOL_ACTIONS_FUNCTIONS=(
- "${TOOL_ACTIONS_GENERIC[@]}"
- "${TOOL_ACTIONS_GENERIC[@]/%/_check}"
- "${TOOL_ACTIONS_HELPERS[@]}"
-)
tool_include() {
local tool=$1
local tool_path=$( tool_path "$tool" )
- unset -f "${TOOL_ACTIONS_FUNCTIONS[@]}"
+ unset -f "${TOOL_ACTIONS[@]}"
. "$tool_path/$tool"