From 4e3505463eadffd9f1994f8ecaba9b1d693ec7bf Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Wed, 25 Oct 2017 23:11:15 -0400 Subject: Modify fd copying in printf calls for readability --- tools/boot-keys/boot-keys | 6 +++--- tools/boot-keys/boot-keys-helper | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/boot-keys/boot-keys b/tools/boot-keys/boot-keys index da56aca9..a556aa41 100755 --- a/tools/boot-keys/boot-keys +++ b/tools/boot-keys/boot-keys @@ -24,7 +24,7 @@ generate() { if [ -z "$type" ] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi @@ -47,7 +47,7 @@ sign() { if [ -z "$type" ] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi @@ -90,7 +90,7 @@ verify() { if [ -z "$type" ] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper index 31e2c16b..5d01916a 100755 --- a/tools/boot-keys/boot-keys-helper +++ b/tools/boot-keys/boot-keys-helper @@ -15,7 +15,7 @@ boot_keys_cros() { if ! [ -x "$cros_script_path" ] then - printf '%s' "$cros_script script missing from cros-scripts install" >&2 + printf 1>&2 '%s' "$cros_script script missing from cros-scripts install" return 1 fi -- cgit v1.2.3-70-g09d2 From 85934d62d767a484fa560066b6edb69a18145690 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 26 Oct 2017 02:32:54 -0400 Subject: Replace usage of the '[' Bash builtin with '[[' There's no benefit to using the POSIX-style '[' test builtin considering its '-a' and '-o' operators are unused in the Libreboot build system. Plus, '[[' is safer with respect to any containing file redirections (for example). Prior, both '[' and '[[' were used throughout the codebase--a disparity in usage which this change aims to eliminate. --- libs/common | 16 +++---- libs/git | 58 +++++++++++----------- libs/project | 96 ++++++++++++++++++------------------- libs/tool | 28 +++++------ projects/cros-ec/cros-ec | 6 +-- projects/crossgcc/crossgcc | 6 +-- projects/vboot/vboot | 12 ++--- tools/blobs-discover/blobs-discover | 18 +++---- tools/boot-keys/boot-keys | 8 ++-- tools/boot-keys/boot-keys-helper | 4 +- 10 files changed, 126 insertions(+), 126 deletions(-) (limited to 'tools') diff --git a/libs/common b/libs/common index 750886db..b7a7022e 100755 --- a/libs/common +++ b/libs/common @@ -155,7 +155,7 @@ file_checksum_check() { local name=$( basename "$path" ) local directory_path=$( dirname "$path" ) - if ! [ -f "$checksum_path" ] + if ! [[ -f "$checksum_path" ]] then printf 1>&2 '%s\n' 'Could not verify file checksum!' return 1 @@ -172,7 +172,7 @@ file_signature_create() { local signature_path="$path.$DSIG" - if [ -z "$RELEASE_KEY" ] + if [[ -z "$RELEASE_KEY" ]] then return 0 fi @@ -185,7 +185,7 @@ file_signature_check() { local signature_path="$path.$DSIG" - if ! [ -f "$signature_path" ] + if ! [[ -f "$signature_path" ]] then printf 1>&2 '%s\n' 'Could not verify file signature!' return 1 @@ -217,7 +217,7 @@ file_exists_check() { directory_filled_check() { local path=$1 - if [ -z "$( ls -A "$path" 2> /dev/null )" ] + if [[ -z "$( ls -A "$path" 2> /dev/null )" ]] then return 1 else @@ -381,7 +381,7 @@ requirements() { do requirement_path=$( which "$requirement" || true ) - if [ -z "$requirement_path" ] + if [[ -z "$requirement_path" ]] then printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 @@ -398,7 +398,7 @@ requirements_root() { # We need to keep stdout output to show the command. requirement_path=$( execute_root which "$requirement" || true ) - if [ -z "$requirement_path" ] + if [[ -z "$requirement_path" ]] then printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 @@ -414,7 +414,7 @@ arguments_concat() { for argument in "$@" do - if ! [ -z "$concat" ] + if ! [[ -z "$concat" ]] then concat="$concat""$delimiter""$argument" else @@ -432,7 +432,7 @@ execute_root() { printf 1>&2 '%s' 'Running command as root: ' printf 1>&2 '%b\n' "$*" - if ! [ -z "$sudo" ] + if ! [[ -z "$sudo" ]] then sudo "$@" else diff --git a/libs/git b/libs/git index decdfe01..fdf4d753 100755 --- a/libs/git +++ b/libs/git @@ -63,7 +63,7 @@ git_branch_create() { cd "$repository_path" git checkout -B "$branch" - if ! [ -z "$revision" ] + if ! [[ -z "$revision" ]] then git reset --hard "$revision" fi @@ -96,13 +96,13 @@ git_branch_check() { ( cd "$repository_path" 2> /dev/null > /dev/null - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then return 1 fi git rev-parse --verify "$branch" 2> /dev/null > /dev/null - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then return 1 fi @@ -123,13 +123,13 @@ git_fetch_check() { ( cd "$repository_path" 2> /dev/null > /dev/null - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then return 1 fi local output=$( git fetch --dry-run origin 2>&1 ) - if ! [ -z "$output" ] + if ! [[ -z "$output" ]] then return 1 fi @@ -270,7 +270,7 @@ git_project_clone() { do git_clone "$repository_path" "$url" - if [ $? -eq 0 ] + if [[ $? -eq 0 ]] then return 0 fi @@ -301,7 +301,7 @@ git_project_prepare_blobs() { local blobs_path=$( project_blobs_path "$project" "$@" ) local blob - if ! [ -f "$blobs_path" ] + if ! [[ -f "$blobs_path" ]] then return fi @@ -330,9 +330,9 @@ git_project_prepare_patch() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -344,7 +344,7 @@ git_project_prepare_patch() { local revision_path="$configs_path/$path/$REVISION" - if ! [ -f "$revision_path" ] + if ! [[ -f "$revision_path" ]] then continue fi @@ -353,7 +353,7 @@ git_project_prepare_patch() { prepare_path=$path done - if ! [ -z "$prepare_branch" ] + if ! [[ -z "$prepare_branch" ]] then git_project_patch_recursive "$project" "$repository" "$prepare_branch" "$prepare_path" fi @@ -376,9 +376,9 @@ git_project_prepare_revision() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -390,7 +390,7 @@ git_project_prepare_revision() { local revision_path="$configs_path/$path/$REVISION" - if ! [ -f "$revision_path" ] + if ! [[ -f "$revision_path" ]] then continue fi @@ -399,7 +399,7 @@ git_project_prepare_revision() { prepare_revision=$( cat "$revision_path" ) done - if ! [ -z "$prepare_branch" ] + if ! [[ -z "$prepare_branch" ]] then git_branch_create "$repository_path" "$prepare_branch" "$prepare_revision" fi @@ -421,9 +421,9 @@ git_project_prepare_check() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -435,7 +435,7 @@ git_project_prepare_check() { local revision_path="$configs_path/$path/$REVISION" - if ! [ -f "$revision_path" ] + if ! [[ -f "$revision_path" ]] then continue fi @@ -443,7 +443,7 @@ git_project_prepare_check() { prepare_branch=$branch done - if ! [ -z "$prepare_branch" ] + if ! [[ -z "$prepare_branch" ]] then git_branch_check "$repository_path" "$prepare_branch" fi @@ -462,7 +462,7 @@ git_project_prepare_clean() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then branch="$branch-$argument" fi @@ -475,7 +475,7 @@ git_project_prepare_clean() { prepare_branch=$branch done - if ! [ -z "$prepare_branch" ] + if ! [[ -z "$prepare_branch" ]] then # Let's not worry about missing branches. ( @@ -483,7 +483,7 @@ git_project_prepare_clean() { git_branch_delete "$repository_path" "$prepare_branch" - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then return 0 fi @@ -504,7 +504,7 @@ git_project_checkout() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then branch="$branch-$argument" fi @@ -517,7 +517,7 @@ git_project_checkout() { checkout_branch=$branch done - if ! [ -z "$checkout_branch" ] + if ! [[ -z "$checkout_branch" ]] then git_branch_checkout "$repository_path" "$checkout_branch" git_submodule_update "$repository_path" @@ -564,7 +564,7 @@ git_project_release() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then branch="$branch-$argument" fi @@ -577,7 +577,7 @@ git_project_release() { release_branch=$branch done - if ! [ -z "$release_branch" ] + if ! [[ -z "$release_branch" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE" local sources_path="$root/$SOURCES/$repository" @@ -605,7 +605,7 @@ git_project_release_check() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then branch="$branch-$argument" fi @@ -618,13 +618,13 @@ git_project_release_check() { release_branch=$branch done - if ! [ -z "$release_branch" ] + if ! [[ -z "$release_branch" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE" file_exists_check "$archive_path" - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then return 1 else diff --git a/libs/project b/libs/project index 524e6222..72bd647a 100755 --- a/libs/project +++ b/libs/project @@ -39,7 +39,7 @@ project_helper_include() { local project_path=$( project_path "$project" ) local include="$project_path/$project-helper" - if [ -f "$include" ] + if [[ -f "$include" ]] then source "$include" fi @@ -254,7 +254,7 @@ project_sources_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path-$argument" fi @@ -267,7 +267,7 @@ project_sources_path() { sources_path=$path done - if ! [ -z "$sources_path" ] + if ! [[ -z "$sources_path" ]] then printf '%s\n' "$sources_path" return @@ -287,7 +287,7 @@ project_sources_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi @@ -300,7 +300,7 @@ project_sources_path() { sources_path=$path done - if ! [ -z "$sources_path" ] + if ! [[ -z "$sources_path" ]] then printf '%s\n' "$sources_path" return @@ -323,7 +323,7 @@ project_sources_directory_filled_error() { local sources_path=$( project_sources_path "$project" "$@" ) - if ! [ -z "$sources_path" ] + if ! [[ -z "$sources_path" ]] then printf 1>&2 '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" return 1 @@ -339,7 +339,7 @@ project_sources_directory_missing_empty_error() { local sources_path=$( project_sources_path "$project" "$@" ) - if [ -z "$sources_path" ] + if [[ -z "$sources_path" ]] then printf 1>&2 '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) missing or empty" return 1 @@ -358,14 +358,14 @@ project_sources_archive() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path-$argument" fi local archive="$path.$ARCHIVE" - if ! [ -f "$archive" ] + if ! [[ -f "$archive" ]] then continue fi @@ -373,7 +373,7 @@ project_sources_archive() { sources_archive=$archive done - if ! [ -z "$sources_archive" ] + if ! [[ -z "$sources_archive" ]] then printf '%s\n' "$sources_archive" fi @@ -403,7 +403,7 @@ project_sources_archive_update() { local archive=$( project_sources_archive "$project" "$@" ) local destination=$( dirname "$archive" ) - if [ -d "$sources_path" ] + if [[ -d "$sources_path" ]] then rm -rf "$sources_path" fi @@ -420,7 +420,7 @@ project_sources_archive_missing_error() { local arguments="$*" local archive=$( project_sources_archive "$project" "$@" ) - if [ -z "$archive" ] || ! [ -f "$archive" ] + if [[ -z "$archive" ]] || ! [[ -f "$archive" ]] then printf 1>&2 '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" return 1 @@ -434,7 +434,7 @@ project_sources_archive_missing_check() { shift local archive=$( project_sources_archive "$project" "$@" ) - if [ -z "$archive" ] || ! [ -f "$archive" ] + if [[ -z "$archive" ]] || ! [[ -f "$archive" ]] then return 0 else @@ -474,9 +474,9 @@ project_blobs_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -486,7 +486,7 @@ project_blobs_path() { local blobs_path="$configs_path/$path/$BLOBS" - if [ -f "$blobs_path" ] + if [[ -f "$blobs_path" ]] then printf '%s\n' "$blobs_path" return @@ -507,9 +507,9 @@ project_blobs_ignore_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -519,7 +519,7 @@ project_blobs_ignore_path() { blobs_ignore_path="$configs_path/$path/$BLOBS_IGNORE" - if [ -f "$blobs_ignore_path" ] + if [[ -f "$blobs_ignore_path" ]] then printf '%s\n' "$blobs_ignore_path" return @@ -542,7 +542,7 @@ project_arguments_targets() { targets_path="$targets_path/$TARGETS" - if [ -f "$targets_path" ] + if [[ -f "$targets_path" ]] then cat "$targets_path" fi @@ -746,9 +746,9 @@ project_build_check() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -758,7 +758,7 @@ project_build_check() { configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" - if ! [ -f "$configs_install_path" ] + if ! [[ -f "$configs_install_path" ]] then continue fi @@ -771,7 +771,7 @@ project_build_check() { # Source may contain a wildcard. path_wildcard_expand "$source_path" | while read -r source_file_path do - if ! [ -f "$source_file_path" ] && ! [ -d "$source_file_path" ] + if ! [[ -f "$source_file_path" ]] && ! [[ -d "$source_file_path" ]] then false fi @@ -826,9 +826,9 @@ project_install() { # Install built files first. for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -838,7 +838,7 @@ project_install() { configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" - if ! [ -f "$configs_install_path" ] + if ! [[ -f "$configs_install_path" ]] then continue fi @@ -869,9 +869,9 @@ project_install() { # Install install files then. for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -881,7 +881,7 @@ project_install() { install_install_path="$project_path/$INSTALL/$path/$INSTALL" - if ! [ -f "$install_install_path" ] + if ! [[ -f "$install_install_path" ]] then continue fi @@ -920,9 +920,9 @@ project_install_check() { # Install built files first. for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -932,7 +932,7 @@ project_install_check() { configs_install_path="$project_path/$CONFIGS/$path/$INSTALL" - if ! [ -f "$configs_install_path" ] + if ! [[ -f "$configs_install_path" ]] then continue fi @@ -944,7 +944,7 @@ project_install_check() { destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) destination_path="$install_path/$destination" - if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] + if ! [[ -f "$destination_path" ]] && ! [[ -d "$destination_path" ]] then false fi @@ -956,9 +956,9 @@ project_install_check() { # Install install files then. for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then - if [ -z "$path" ] + if [[ -z "$path" ]] then path="$argument" else @@ -968,7 +968,7 @@ project_install_check() { install_install_path="$project_path/$INSTALL/$path/$INSTALL" - if ! [ -f "$install_install_path" ] + if ! [[ -f "$install_install_path" ]] then continue fi @@ -978,7 +978,7 @@ project_install_check() { destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) destination_path="$install_path/$destination" - if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] + if ! [[ -f "$destination_path" ]] && ! [[ -d "$destination_path" ]] then false fi @@ -1025,7 +1025,7 @@ project_release_path() { local release_path="$root/$RELEASE/$prefix" # Special care for tools and systems, that depend on the host arch. - if [ "$prefix" = "$SYSTEMS" ] || [ "$prefix" = "$TOOLS" ] + if [[ "$prefix" = "$SYSTEMS" ]] || [[ "$prefix" = "$TOOLS" ]] then local machine=$( uname -m ) @@ -1088,7 +1088,7 @@ project_release_sources_archive_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path-$argument" fi @@ -1103,7 +1103,7 @@ project_release_sources_archive_path() { release_path=$path done - if ! [ -z "$release_path" ] + if ! [[ -z "$release_path" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_path.$ARCHIVE" @@ -1131,7 +1131,7 @@ project_release_sources_archive_exists_check() { shift local archive_path=$( project_release_sources_archive_path "$project" "$@" ) - if [ -z "$archive_path" ] || ! [ -f "$archive_path" ] + if [[ -z "$archive_path" ]] || ! [[ -f "$archive_path" ]] then return 1 else @@ -1399,12 +1399,12 @@ project_file_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi - if ! [ -f "$path/$file" ] + if ! [[ -f "$path/$file" ]] then continue fi @@ -1412,7 +1412,7 @@ project_file_path() { file_path="$path/$file" done - if [ -z "$file_path" ] + if [[ -z "$file_path" ]] then return 1 fi @@ -1429,7 +1429,7 @@ project_file_test() { project_file_contents() { local file_path=$( project_file_path "$@" ) - if [ -f "$file_path" ] + if [[ -f "$file_path" ]] then cat "$file_path" fi @@ -1450,14 +1450,14 @@ project_file_contents_herit() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi file_path="$path/$file" - if ! [ -f "$file_path" ] + if ! [[ -f "$file_path" ]] then continue fi diff --git a/libs/tool b/libs/tool index f469d0ef..c18ded8b 100755 --- a/libs/tool +++ b/libs/tool @@ -37,7 +37,7 @@ tool_helper_include() { local tool_path=$( tool_path "$tool" ) local include="$tool_path/$tool-helper" - if [ -f "$include" ] + if [[ -f "$include" ]] then source "$include" fi @@ -85,7 +85,7 @@ tool_action() { tool_action_check "$action" "$tool" "$@" - if [ $? -eq 0 ] + if [[ $? -eq 0 ]] then return 0 fi @@ -104,7 +104,7 @@ tool_action() { "$action" "$@" ) - if [ $? -ne 0 ] + if [[ $? -ne 0 ]] then printf 1>&2 '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) failed" return 1 @@ -138,7 +138,7 @@ tool_action_check() { for tool_force in $TOOLS_FORCE do - if [ "$tool_force" = "$tool" ] + if [[ "$tool_force" = "$tool" ]] then return 1 fi @@ -189,7 +189,7 @@ tool_action_arguments_recursive() { local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) local argument - if [ $? -ne 0 ] || [ -z "$action_helper_arguments" ] + if [[ $? -ne 0 ]] || [[ -z "$action_helper_arguments" ]] then tool_action "$action" "$tool" "$@" else @@ -236,7 +236,7 @@ tool_sources_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi @@ -263,7 +263,7 @@ tool_usage_actions() { fi done - if [ $# -gt 0 ] + if [[ $# -gt 0 ]] then printf '\n%s\n' 'Specific actions:' @@ -292,7 +292,7 @@ tool_usage_arguments_recursive() { local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) local argument - if ! [ -z "$action_helper_arguments" ] + if ! [[ -z "$action_helper_arguments" ]] then printf '%s\n' "$action_helper_arguments" | while read argument do @@ -317,12 +317,12 @@ tool_file_path() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi - if ! [ -f "$path/$file" ] + if ! [[ -f "$path/$file" ]] then continue fi @@ -330,7 +330,7 @@ tool_file_path() { file_path="$path/$file" done - if [ -z "$file_path" ] + if [[ -z "$file_path" ]] then return 1 fi @@ -347,7 +347,7 @@ tool_file_test() { tool_file_contents() { local file_path=$( tool_file_path "$@" ) - if [ -f "$file_path" ] + if [[ -f "$file_path" ]] then cat "$file_path" fi @@ -368,14 +368,14 @@ tool_file_contents_herit() { for argument in "" "$@" do - if ! [ -z "$argument" ] + if ! [[ -z "$argument" ]] then path="$path/$argument" fi file_path="$path/$file" - if ! [ -f "$file_path" ] + if ! [[ -f "$file_path" ]] then continue fi diff --git a/projects/cros-ec/cros-ec b/projects/cros-ec/cros-ec index 8fb75003..be7aa62b 100755 --- a/projects/cros-ec/cros-ec +++ b/projects/cros-ec/cros-ec @@ -73,7 +73,7 @@ build() { mkdir -p "$build_path" - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then make -C "$sources_path" out="$build_path" HOST_CROSS_COMPILE= -j$TASKS "utils" else @@ -104,7 +104,7 @@ release() { local repository=$project - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_release_install_archive "$project" "$TOOLS" "$@" else @@ -119,7 +119,7 @@ release_check() { local repository=$project - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_release_install_archive_check "$project" "$TOOLS" "$@" else diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc index f0d7a5d1..92a46860 100755 --- a/projects/crossgcc/crossgcc +++ b/projects/crossgcc/crossgcc @@ -50,7 +50,7 @@ extract() { local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) local tarball_install_directory_path=$( dirname "$tarball_install_path" ) - if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ] + if [[ -f "$tarball_sources_path" ]] && ! [[ -f "$tarball_install_path" ]] then printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})" @@ -90,7 +90,7 @@ update() { local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) local tarball_install_directory_path=$( dirname "$tarball_install_path" ) - if [ -f $tarball_sources_path ] + if [[ -f $tarball_sources_path ]] then printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})" @@ -190,7 +190,7 @@ release() { mkdir -p "$release_path" - if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ] + if [[ -f "$tarball_install_path" ]] && ! [[ -f "$tarball_release_path" ]] then printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})" diff --git a/projects/vboot/vboot b/projects/vboot/vboot index a36791d6..55d28c87 100755 --- a/projects/vboot/vboot +++ b/projects/vboot/vboot @@ -75,7 +75,7 @@ build() { git_project_checkout "$project" "$repository" "$@" fi - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then local sources_path=$( project_sources_path "$project" "$repository" "$@" ) local build_path=$( project_build_path "$project" "$@" ) @@ -92,7 +92,7 @@ build() { build_check() { local target=$1 - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_build_check "$project" "$@" fi @@ -101,7 +101,7 @@ build_check() { install() { local target=$1 - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_install "$project" "$@" fi @@ -110,7 +110,7 @@ install() { install_check() { local target=$1 - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_install_check "$project" "$@" fi @@ -121,7 +121,7 @@ release() { local repository=$project - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_release_install_archive "$project" "$TOOLS" "$@" fi @@ -134,7 +134,7 @@ release_check() { local repository=$project - if [ "$target" = "tools" ] + if [[ "$target" = "tools" ]] then project_release_install_archive_check "$project" "$TOOLS" "$@" fi diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index 6d143d02..3ced106c 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -18,7 +18,7 @@ arguments() { local project=$1 - if [ -z "$project" ] + if [[ -z "$project" ]] then ls -A "$root/$PROJECTS/" | while read project do @@ -50,7 +50,7 @@ update() { path_wildcard_expand "$patches_path" | while read patch_path do - if ! [ -f "$patch_path" ] + if ! [[ -f "$patch_path" ]] then continue fi @@ -75,7 +75,7 @@ verify() { requirements "sort" - if ! [ -z "$project_blobs_path" ] + if ! [[ -z "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -100,7 +100,7 @@ verify() { printf '%s' "Type \"blob\" to keep or press enter to discard: " read choice - if [ "$choice" = "blob" ] + if [[ "$choice" = "blob" ]] then printf '%s\n' "$file" >> "$project_blobs_path" else @@ -136,7 +136,7 @@ execute() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_directory_path - if ! [ -z "$project_blobs_path" ] + if ! [[ -z "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -159,17 +159,17 @@ execute() { printf '%s\n' "$files" | while read file do - if ! [ -z "$project_blobs_ignore_path" ] + if ! [[ -z "$project_blobs_ignore_path" ]] then match=$( grep "$file" "$project_blobs_ignore_path" || true) - if [ ! -z "$match" ] + if [[ ! -z "$match" ]] then continue fi fi match=$( "$deblob_check_path" -l -i "" "$file" || true ) - if ! [ -z "$match" ] + if ! [[ -z "$match" ]] then printf '%s\n' "$match" >> "$project_blobs_discover_path" fi @@ -187,7 +187,7 @@ execute_check() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_discover_path - if ! [ -z "$project_blobs_path" ] + if ! [[ -z "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else diff --git a/tools/boot-keys/boot-keys b/tools/boot-keys/boot-keys index a556aa41..5d133742 100755 --- a/tools/boot-keys/boot-keys +++ b/tools/boot-keys/boot-keys @@ -22,7 +22,7 @@ usage() { generate() { local type=$( boot_keys_type "$@" ) - if [ -z "$type" ] + if [[ -z "$type" ]] then printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 @@ -45,7 +45,7 @@ sign() { local kernel_path local media - if [ -z "$type" ] + if [[ -z "$type" ]] then printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 @@ -66,7 +66,7 @@ sign() { do kernel_path="$install_path/$KERNEL-$medium.$IMG" - if [ -f "$kernel_path" ] + if [[ -f "$kernel_path" ]] then boot_keys_cros "$type-prepare" "sign" "$kernel_path" else @@ -88,7 +88,7 @@ verify() { local kernel_path local media - if [ -z "$type" ] + if [[ -z "$type" ]] then printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper index 5d01916a..df53ec5b 100755 --- a/tools/boot-keys/boot-keys-helper +++ b/tools/boot-keys/boot-keys-helper @@ -13,7 +13,7 @@ boot_keys_cros() { local cros_scripts_path=$( project_install_path "cros-scripts" ) local cros_script_path="$cros_scripts_path/$cros_script" - if ! [ -x "$cros_script_path" ] + if ! [[ -x "$cros_script_path" ]] then printf 1>&2 '%s' "$cros_script script missing from cros-scripts install" return 1 @@ -37,7 +37,7 @@ boot_keys_files_install_path() { helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) - if [ $? -ne 0 ] || [ -z "$helper_arguments" ] + if [[ $? -ne 0 ]] || [[ -z "$helper_arguments" ]] then project_install_path "$project" "$@" else -- cgit v1.2.3-70-g09d2 From c7377e3eb74a73874f9d2253083b3ae952156ac8 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 26 Oct 2017 02:57:32 -0400 Subject: Make use of Bash's '-n' operator for tests As an example, do this: [[ -n $revision ]] instead of this: ! [[ -z $revision ]] Makes the code easier to read. --- libs/common | 4 ++-- libs/git | 32 ++++++++++++++++---------------- libs/project | 36 ++++++++++++++++++------------------ libs/tool | 8 ++++---- tools/blobs-discover/blobs-discover | 10 +++++----- 5 files changed, 45 insertions(+), 45 deletions(-) (limited to 'tools') diff --git a/libs/common b/libs/common index b7a7022e..28a34cf7 100755 --- a/libs/common +++ b/libs/common @@ -414,7 +414,7 @@ arguments_concat() { for argument in "$@" do - if ! [[ -z "$concat" ]] + if [[ -n "$concat" ]] then concat="$concat""$delimiter""$argument" else @@ -432,7 +432,7 @@ execute_root() { printf 1>&2 '%s' 'Running command as root: ' printf 1>&2 '%b\n' "$*" - if ! [[ -z "$sudo" ]] + if [[ -n "$sudo" ]] then sudo "$@" else diff --git a/libs/git b/libs/git index fdf4d753..7ede82b4 100755 --- a/libs/git +++ b/libs/git @@ -63,7 +63,7 @@ git_branch_create() { cd "$repository_path" git checkout -B "$branch" - if ! [[ -z "$revision" ]] + if [[ -n "$revision" ]] then git reset --hard "$revision" fi @@ -129,7 +129,7 @@ git_fetch_check() { fi local output=$( git fetch --dry-run origin 2>&1 ) - if ! [[ -z "$output" ]] + if [[ -n "$output" ]] then return 1 fi @@ -330,7 +330,7 @@ git_project_prepare_patch() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -353,7 +353,7 @@ git_project_prepare_patch() { prepare_path=$path done - if ! [[ -z "$prepare_branch" ]] + if [[ -n "$prepare_branch" ]] then git_project_patch_recursive "$project" "$repository" "$prepare_branch" "$prepare_path" fi @@ -376,7 +376,7 @@ git_project_prepare_revision() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -399,7 +399,7 @@ git_project_prepare_revision() { prepare_revision=$( cat "$revision_path" ) done - if ! [[ -z "$prepare_branch" ]] + if [[ -n "$prepare_branch" ]] then git_branch_create "$repository_path" "$prepare_branch" "$prepare_revision" fi @@ -421,7 +421,7 @@ git_project_prepare_check() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -443,7 +443,7 @@ git_project_prepare_check() { prepare_branch=$branch done - if ! [[ -z "$prepare_branch" ]] + if [[ -n "$prepare_branch" ]] then git_branch_check "$repository_path" "$prepare_branch" fi @@ -462,7 +462,7 @@ git_project_prepare_clean() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then branch="$branch-$argument" fi @@ -475,7 +475,7 @@ git_project_prepare_clean() { prepare_branch=$branch done - if ! [[ -z "$prepare_branch" ]] + if [[ -n "$prepare_branch" ]] then # Let's not worry about missing branches. ( @@ -504,7 +504,7 @@ git_project_checkout() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then branch="$branch-$argument" fi @@ -517,7 +517,7 @@ git_project_checkout() { checkout_branch=$branch done - if ! [[ -z "$checkout_branch" ]] + if [[ -n "$checkout_branch" ]] then git_branch_checkout "$repository_path" "$checkout_branch" git_submodule_update "$repository_path" @@ -564,7 +564,7 @@ git_project_release() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then branch="$branch-$argument" fi @@ -577,7 +577,7 @@ git_project_release() { release_branch=$branch done - if ! [[ -z "$release_branch" ]] + if [[ -n "$release_branch" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE" local sources_path="$root/$SOURCES/$repository" @@ -605,7 +605,7 @@ git_project_release_check() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then branch="$branch-$argument" fi @@ -618,7 +618,7 @@ git_project_release_check() { release_branch=$branch done - if ! [[ -z "$release_branch" ]] + if [[ -n "$release_branch" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$ARCHIVE" diff --git a/libs/project b/libs/project index 72bd647a..5eafee3d 100755 --- a/libs/project +++ b/libs/project @@ -254,7 +254,7 @@ project_sources_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path-$argument" fi @@ -267,7 +267,7 @@ project_sources_path() { sources_path=$path done - if ! [[ -z "$sources_path" ]] + if [[ -n "$sources_path" ]] then printf '%s\n' "$sources_path" return @@ -287,7 +287,7 @@ project_sources_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi @@ -300,7 +300,7 @@ project_sources_path() { sources_path=$path done - if ! [[ -z "$sources_path" ]] + if [[ -n "$sources_path" ]] then printf '%s\n' "$sources_path" return @@ -323,7 +323,7 @@ project_sources_directory_filled_error() { local sources_path=$( project_sources_path "$project" "$@" ) - if ! [[ -z "$sources_path" ]] + if [[ -n "$sources_path" ]] then printf 1>&2 '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" return 1 @@ -358,7 +358,7 @@ project_sources_archive() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path-$argument" fi @@ -373,7 +373,7 @@ project_sources_archive() { sources_archive=$archive done - if ! [[ -z "$sources_archive" ]] + if [[ -n "$sources_archive" ]] then printf '%s\n' "$sources_archive" fi @@ -474,7 +474,7 @@ project_blobs_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -507,7 +507,7 @@ project_blobs_ignore_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -746,7 +746,7 @@ project_build_check() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -826,7 +826,7 @@ project_install() { # Install built files first. for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -869,7 +869,7 @@ project_install() { # Install install files then. for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -920,7 +920,7 @@ project_install_check() { # Install built files first. for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -956,7 +956,7 @@ project_install_check() { # Install install files then. for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then if [[ -z "$path" ]] then @@ -1088,7 +1088,7 @@ project_release_sources_archive_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path-$argument" fi @@ -1103,7 +1103,7 @@ project_release_sources_archive_path() { release_path=$path done - if ! [[ -z "$release_path" ]] + if [[ -n "$release_path" ]] then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_path.$ARCHIVE" @@ -1399,7 +1399,7 @@ project_file_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi @@ -1450,7 +1450,7 @@ project_file_contents_herit() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi diff --git a/libs/tool b/libs/tool index c18ded8b..dc2a3d0a 100755 --- a/libs/tool +++ b/libs/tool @@ -236,7 +236,7 @@ tool_sources_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi @@ -292,7 +292,7 @@ tool_usage_arguments_recursive() { local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) local argument - if ! [[ -z "$action_helper_arguments" ]] + if [[ -n "$action_helper_arguments" ]] then printf '%s\n' "$action_helper_arguments" | while read argument do @@ -317,7 +317,7 @@ tool_file_path() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi @@ -368,7 +368,7 @@ tool_file_contents_herit() { for argument in "" "$@" do - if ! [[ -z "$argument" ]] + if [[ -n "$argument" ]] then path="$path/$argument" fi diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index 3ced106c..5d197723 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -75,7 +75,7 @@ verify() { requirements "sort" - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -136,7 +136,7 @@ execute() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_directory_path - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else @@ -159,7 +159,7 @@ execute() { printf '%s\n' "$files" | while read file do - if ! [[ -z "$project_blobs_ignore_path" ]] + if [[ -n "$project_blobs_ignore_path" ]] then match=$( grep "$file" "$project_blobs_ignore_path" || true) if [[ ! -z "$match" ]] @@ -169,7 +169,7 @@ execute() { fi match=$( "$deblob_check_path" -l -i "" "$file" || true ) - if ! [[ -z "$match" ]] + if [[ -n "$match" ]] then printf '%s\n' "$match" >> "$project_blobs_discover_path" fi @@ -187,7 +187,7 @@ execute_check() { local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) local project_blobs_discover_path - if ! [[ -z "$project_blobs_path" ]] + if [[ -n "$project_blobs_path" ]] then project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" else -- cgit v1.2.3-70-g09d2 From 5c1fe562d8044249f5830df826544bc72ecb41b2 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 26 Oct 2017 21:45:42 -0400 Subject: Remove unnecessary spaces in command substitutions This is likely one of the very last changes necessary to make the Libreboot build system more cohesive in appearance. Hopefully from this point forward it won't be as readily apparent as to who wrote which parts of the build system (i.e. won't look like a patchwork quilt any longer). --- libs/common | 20 ++--- libs/git | 34 ++++---- libs/project | 122 +++++++++++++-------------- libs/tool | 16 ++-- projects/cbfstool/cbfstool | 8 +- projects/cbmem/cbmem | 4 +- projects/coreboot/coreboot | 12 +-- projects/cros-ec/cros-ec | 8 +- projects/crossgcc/crossgcc | 30 +++---- projects/crossgcc/crossgcc-helper | 8 +- projects/depthcharge/depthcharge | 12 +-- projects/flashmap/flashmap | 4 +- projects/flashrom-cros/flashrom-cros | 4 +- projects/flashrom/flashrom | 4 +- projects/hdctools/hdctools | 4 +- projects/libpayload/libpayload | 10 +-- projects/libreboot-release/libreboot-release | 2 +- projects/libreboot-sources/libreboot-sources | 6 +- projects/mosys/mosys | 6 +- projects/nvramtool/nvramtool | 4 +- projects/vboot/vboot | 4 +- projects/vpd/vpd | 4 +- tools/blobs-discover/blobs-discover | 42 ++++----- tools/boot-keys/boot-keys | 14 +-- tools/boot-keys/boot-keys-helper | 10 +-- 25 files changed, 196 insertions(+), 196 deletions(-) (limited to 'tools') diff --git a/libs/common b/libs/common index 28a34cf7..43fe3b08 100755 --- a/libs/common +++ b/libs/common @@ -130,7 +130,7 @@ path_wildcard_expand() { local path=$@ # Evaluation fails with unescaped whitespaces. - path=$( printf '%s\n' "$path" | sed "s/ /\\\ /g" ) + path=$(printf '%s\n' "$path" | sed "s/ /\\\ /g") eval "arguments_list "$path"" } @@ -139,8 +139,8 @@ file_checksum_create() { local path=$1 local checksum_path="$path.$CHECKSUM" - local name=$( basename "$path" ) - local directory_path=$( dirname "$path" ) + local name=$(basename "$path") + local directory_path=$(dirname "$path") ( cd "$directory_path" @@ -152,8 +152,8 @@ file_checksum_check() { local path=$1 local checksum_path="$path.$CHECKSUM" - local name=$( basename "$path" ) - local directory_path=$( dirname "$path" ) + local name=$(basename "$path") + local directory_path=$(dirname "$path") if ! [[ -f "$checksum_path" ]] then @@ -217,7 +217,7 @@ file_exists_check() { directory_filled_check() { local path=$1 - if [[ -z "$( ls -A "$path" 2> /dev/null )" ]] + if [[ -z "$(ls -A "$path" 2> /dev/null)" ]] then return 1 else @@ -379,7 +379,7 @@ requirements() { for requirement in "$@" do - requirement_path=$( which "$requirement" || true ) + requirement_path=$(which "$requirement" || true) if [[ -z "$requirement_path" ]] then @@ -396,7 +396,7 @@ requirements_root() { for requirement in "$@" do # We need to keep stdout output to show the command. - requirement_path=$( execute_root which "$requirement" || true ) + requirement_path=$(execute_root which "$requirement" || true) if [[ -z "$requirement_path" ]] then @@ -426,7 +426,7 @@ arguments_concat() { } execute_root() { - local sudo=$( which sudo 2> /dev/null || true ) + local sudo=$(which sudo 2> /dev/null || true) local arguments printf 1>&2 '%s' 'Running command as root: ' @@ -437,7 +437,7 @@ execute_root() { sudo "$@" else # Quote arguments for eval through su. - arguments=$( printf '%q ' "$@" ) + arguments=$(printf '%q ' "$@") su -c "$arguments" fi } diff --git a/libs/git b/libs/git index 7ede82b4..1ca2358e 100755 --- a/libs/git +++ b/libs/git @@ -128,7 +128,7 @@ git_fetch_check() { return 1 fi - local output=$( git fetch --dry-run origin 2>&1 ) + local output=$(git fetch --dry-run origin 2>&1) if [[ -n "$output" ]] then return 1 @@ -220,7 +220,7 @@ git_project_repository_path() { git_project_check() { local repository=$1 - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") git_check "$repository_path" } @@ -257,8 +257,8 @@ git_project_clone() { shift local urls=$@ - local repository_path=$( git_project_repository_path "$repository" ) - local directory_path=$( dirname "$repository_path" ) + local repository_path=$(git_project_repository_path "$repository") + local directory_path=$(dirname "$repository_path") local url mkdir -p "$directory_path" @@ -297,8 +297,8 @@ git_project_prepare_blobs() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) - local blobs_path=$( project_blobs_path "$project" "$@" ) + local repository_path=$(git_project_repository_path "$repository") + local blobs_path=$(project_blobs_path "$project" "$@") local blob if ! [[ -f "$blobs_path" ]] @@ -320,7 +320,7 @@ git_project_prepare_patch() { local repository=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local configs_path="$project_path/$CONFIGS" local prepare_branch local prepare_path @@ -365,8 +365,8 @@ git_project_prepare_revision() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) - local project_path=$( project_path "$project" ) + local repository_path=$(git_project_repository_path "$repository") + local project_path=$(project_path "$project") local configs_path="$project_path/$CONFIGS" local prepare_branch local prepare_revision @@ -396,7 +396,7 @@ git_project_prepare_revision() { fi prepare_branch=$branch - prepare_revision=$( cat "$revision_path" ) + prepare_revision=$(cat "$revision_path") done if [[ -n "$prepare_branch" ]] @@ -411,8 +411,8 @@ git_project_prepare_check() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) - local project_path=$( project_path "$project" ) + local repository_path=$(git_project_repository_path "$repository") + local project_path=$(project_path "$project") local configs_path="$project_path/$CONFIGS" local prepare_branch local branch=$project @@ -455,7 +455,7 @@ git_project_prepare_clean() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") local prepare_branch local branch=$project local argument @@ -497,7 +497,7 @@ git_project_checkout() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") local checkout_branch local branch=$project local argument @@ -530,7 +530,7 @@ git_project_update() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") git_fetch "$repository_path" git_branch_checkout "$repository_path" "$ORIGIN_HEAD" @@ -557,7 +557,7 @@ git_project_release() { shift local arguments=$@ - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") local release_branch local branch=$project local argument @@ -598,7 +598,7 @@ git_project_release_check() { local repository=$1 shift - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") local release_branch local branch=$project local argument diff --git a/libs/project b/libs/project index 5eafee3d..4c8b2fff 100755 --- a/libs/project +++ b/libs/project @@ -24,7 +24,7 @@ INSTALL_REGEX='\([^:]*\):\(.*\)' project_include() { local project=$1 - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") unset -f "${PROJECT_ACTIONS[@]}" @@ -36,7 +36,7 @@ project_include() { project_helper_include() { local project=$1 - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local include="$project_path/$project-helper" if [[ -f "$include" ]] @@ -311,7 +311,7 @@ project_sources_directory_filled_check() { local project=$1 shift - local sources_path=$( project_sources_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$@") test ! -z "$sources_path" } @@ -321,7 +321,7 @@ project_sources_directory_filled_error() { shift local arguments="$*" - local sources_path=$( project_sources_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$@") if [[ -n "$sources_path" ]] then @@ -337,7 +337,7 @@ project_sources_directory_missing_empty_error() { shift local arguments="$*" - local sources_path=$( project_sources_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$@") if [[ -z "$sources_path" ]] then @@ -384,8 +384,8 @@ project_sources_archive_extract() { shift local arguments="$*" - local archive=$( project_sources_archive "$project" "$@" ) - local destination=$( dirname "$archive" ) + local archive=$(project_sources_archive "$project" "$@") + local destination=$(dirname "$archive") printf '%s\n' "Extracting source archive for $project (with ${arguments:-no argument})" @@ -399,9 +399,9 @@ project_sources_archive_update() { local arguments="$*" local repository=$project - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local archive=$( project_sources_archive "$project" "$@" ) - local destination=$( dirname "$archive" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local archive=$(project_sources_archive "$project" "$@") + local destination=$(dirname "$archive") if [[ -d "$sources_path" ]] then @@ -419,7 +419,7 @@ project_sources_archive_missing_error() { shift local arguments="$*" - local archive=$( project_sources_archive "$project" "$@" ) + local archive=$(project_sources_archive "$project" "$@") if [[ -z "$archive" ]] || ! [[ -f "$archive" ]] then printf 1>&2 '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" @@ -433,7 +433,7 @@ project_sources_archive_missing_check() { local project=$1 shift - local archive=$( project_sources_archive "$project" "$@" ) + local archive=$(project_sources_archive "$project" "$@") if [[ -z "$archive" ]] || ! [[ -f "$archive" ]] then return 0 @@ -467,7 +467,7 @@ project_blobs_path() { local project=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local configs_path="$project_path/$CONFIGS" local argument local path @@ -500,7 +500,7 @@ project_blobs_ignore_path() { local project=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local configs_path="$project_path/$CONFIGS" local argument local path @@ -531,7 +531,7 @@ project_arguments_targets() { local project=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local targets_path="$project_path/$CONFIGS" local argument @@ -737,8 +737,8 @@ project_build_check() { local project=$1 shift - local project_path=$( project_path "$project" ) - local build_path=$( project_build_path "$project" "$@" ) + local project_path=$(project_path "$project") + local build_path=$(project_build_path "$project" "$@") local source_file_path local argument local rule @@ -765,7 +765,7 @@ project_build_check() { while read -r rule do - source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g" ) + source=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g") source_path="$build_path/$source" # Source may contain a wildcard. @@ -800,7 +800,7 @@ project_build_directory_missing_empty_error() { shift local arguments="$*" - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") if ! directory_filled_check "$build_path" then @@ -815,9 +815,9 @@ project_install() { local project=$1 shift - local project_path=$( project_path "$project" ) - local build_path=$( project_build_path "$project" "$@" ) - local install_path=$( project_install_path "$project" "$@" ) + local project_path=$(project_path "$project") + local build_path=$(project_build_path "$project" "$@") + local install_path=$(project_install_path "$project" "$@") local source_file_path local argument local rule @@ -847,12 +847,12 @@ project_install() { while read -r rule do - source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g" ) + source=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g") source_path="$build_path/$source" - destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) + destination=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g") destination_path="$install_path/$destination" - destination_directory_path=$( dirname "$destination_path" ) + destination_directory_path=$(dirname "$destination_path") mkdir -p "$destination_directory_path" @@ -888,12 +888,12 @@ project_install() { while read -r rule do - source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g" ) + source=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\1/g") source_path="$project_path/$INSTALL/$path/$source" - destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) + destination=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g") destination_path="$install_path/$destination" - destination_directory_path=$( dirname "$destination_path" ) + destination_directory_path=$(dirname "$destination_path") mkdir -p "$destination_directory_path" @@ -910,9 +910,9 @@ project_install_check() { local project=$1 shift - local project_path=$( project_path "$project" ) - local build_path=$( project_build_path "$project" "$@" ) - local install_path=$( project_install_path "$project" "$@" ) + local project_path=$(project_path "$project") + local build_path=$(project_build_path "$project" "$@") + local install_path=$(project_install_path "$project" "$@") local argument local rule local path @@ -941,7 +941,7 @@ project_install_check() { while read -r rule do - destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) + destination=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g") destination_path="$install_path/$destination" if ! [[ -f "$destination_path" ]] && ! [[ -d "$destination_path" ]] @@ -975,7 +975,7 @@ project_install_check() { while read -r rule do - destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g" ) + destination=$(printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\\2/g") destination_path="$install_path/$destination" if ! [[ -f "$destination_path" ]] && ! [[ -d "$destination_path" ]] @@ -1006,7 +1006,7 @@ project_install_directory_missing_empty_error() { shift local arguments="$*" - local install_path=$( project_install_path "$project" "$@" ) + local install_path=$(project_install_path "$project" "$@") if ! directory_filled_check "$install_path" then @@ -1027,7 +1027,7 @@ project_release_path() { # Special care for tools and systems, that depend on the host arch. if [[ "$prefix" = "$SYSTEMS" ]] || [[ "$prefix" = "$TOOLS" ]] then - local machine=$( uname -m ) + local machine=$(uname -m) release_path="$release_path/$machine/$project" else @@ -1043,7 +1043,7 @@ project_release_archive_path() { local prefix=$1 shift - local release_path=$( project_release_path "$project" "$prefix" ) + local release_path=$(project_release_path "$project" "$prefix") local argument local path="$project" @@ -1063,7 +1063,7 @@ project_release_rootfs_path() { local prefix=$1 shift - local release_path=$( project_release_path "$project" "$prefix" ) + local release_path=$(project_release_path "$project" "$prefix") local argument local path="$project" @@ -1117,8 +1117,8 @@ project_release_sources_archive_create() { local arguments="$*" local repository=$project - local archive_path=$( project_release_sources_archive_path "$project" "$@" ) - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local archive_path=$(project_release_sources_archive_path "$project" "$@") + local sources_path=$(project_sources_path "$project" "$repository" "$@") printf '%s\n' "Releasing sources archive for $project (with ${arguments:-no argument})" @@ -1130,7 +1130,7 @@ project_release_sources_archive_exists_check() { local project=$1 shift - local archive_path=$( project_release_sources_archive_path "$project" "$@" ) + local archive_path=$(project_release_sources_archive_path "$project" "$@") if [[ -z "$archive_path" ]] || ! [[ -f "$archive_path" ]] then return 1 @@ -1185,20 +1185,20 @@ project_release_install() { local prefix=$1 shift - local install_path=$( project_install_path "$project" "$@" ) - local release_path=$( project_release_path "$project" "$prefix" ) + local install_path=$(project_install_path "$project" "$@") + local release_path=$(project_release_path "$project" "$prefix") local directory_path local path project_install_directory_missing_empty_error "$project" "$@" - local files=$( find "$install_path" -type f || true ) + local files=$(find "$install_path" -type f || true) local file printf '%s\n' "$files" | while read -r file do path="$release_path/$file" - directory_path=$( dirname "$path" ) + directory_path=$(dirname "$path") mkdir -p "$directory_path" @@ -1213,13 +1213,13 @@ project_release_install_check() { local prefix=$1 shift - local install_path=$( project_install_path "$project" "$@" ) - local release_path=$( project_release_path "$project" "$prefix" ) + local install_path=$(project_install_path "$project" "$@") + local release_path=$(project_release_path "$project" "$prefix") local path project_install_directory_missing_empty_error "$project" "$@" - local files=$( find "$install_path" -type f || true ) + local files=$(find "$install_path" -type f || true) local file printf '%s\n' "$files" | while read -r file @@ -1255,8 +1255,8 @@ project_release_install_archive_create() { shift local arguments="$*" - local install_path=$( project_install_path "$project" "$@" ) - local archive_path=$( project_release_archive_path "$project" "$prefix" "$@" ) + local install_path=$(project_install_path "$project" "$@") + local archive_path=$(project_release_archive_path "$project" "$prefix" "$@") printf '%s\n' "Releasing $prefix archive for $project (with ${arguments:-no argument})" @@ -1270,7 +1270,7 @@ project_release_install_archive_exists_check() { local prefix=$1 shift - local archive_path=$( project_release_archive_path "$project" "$prefix" "$@" ) + local archive_path=$(project_release_archive_path "$project" "$prefix" "$@") file_exists_check "$archive_path" } @@ -1303,8 +1303,8 @@ project_release_install_rootfs_create() { shift local arguments="$*" - local install_path=$( project_install_path "$project" "$@" ) - local rootfs_path=$( project_release_rootfs_path "$project" "$prefix" "$@" ) + local install_path=$(project_install_path "$project" "$@") + local rootfs_path=$(project_release_rootfs_path "$project" "$prefix" "$@") printf '%s\n' "Releasing $prefix rootfs for $project (with ${arguments:-no argument})" @@ -1318,7 +1318,7 @@ project_release_install_rootfs_exists_check() { local prefix=$1 shift - local rootfs_path=$( project_release_rootfs_path "$project" "$prefix" "$@" ) + local rootfs_path=$(project_release_rootfs_path "$project" "$prefix" "$@") file_exists_check "$rootfs_path" } @@ -1336,7 +1336,7 @@ project_clean_build() { local project=$1 shift - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") rm -rf "$build_path" } @@ -1345,7 +1345,7 @@ project_clean_install() { local project=$1 shift - local install_path=$( project_install_path "$project" "$@" ) + local install_path=$(project_install_path "$project" "$@") rm -rf "$install_path" } @@ -1358,7 +1358,7 @@ project_clean_release() { for prefix in "$SOURCES" "$SYSTEMS" "$IMAGES" "$TOOLS" "$DOCS" do - local release_path=$( project_release_path "$project" "$prefix" ) + local release_path=$(project_release_path "$project" "$prefix") rm -rf "$release_path" done @@ -1378,7 +1378,7 @@ project_clean_rootfs_install() { local project=$1 shift - local install_path=$( project_install_path "$project" "$@" ) + local install_path=$(project_install_path "$project" "$@") execute_root rm -rf "$install_path" @@ -1392,7 +1392,7 @@ project_file_path() { local file=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local path="$project_path/$directory" local argument local file_path @@ -1421,13 +1421,13 @@ project_file_path() { } project_file_test() { - local file_path=$( project_file_path "$@" ) + local file_path=$(project_file_path "$@") test -f "$file_path" } project_file_contents() { - local file_path=$( project_file_path "$@" ) + local file_path=$(project_file_path "$@") if [[ -f "$file_path" ]] then @@ -1443,7 +1443,7 @@ project_file_contents_herit() { local file=$1 shift - local project_path=$( project_path "$project" ) + local project_path=$(project_path "$project") local path="$project_path/$directory" local argument local file_path diff --git a/libs/tool b/libs/tool index dc2a3d0a..2732238a 100755 --- a/libs/tool +++ b/libs/tool @@ -22,7 +22,7 @@ TOOL_ACTIONS_HELPERS=(arguments) tool_include() { local tool=$1 - local tool_path=$( tool_path "$tool" ) + local tool_path=$(tool_path "$tool") unset -f "${TOOL_ACTIONS[@]}" @@ -34,7 +34,7 @@ tool_include() { tool_helper_include() { local tool=$1 - local tool_path=$( tool_path "$tool" ) + local tool_path=$(tool_path "$tool") local include="$tool_path/$tool-helper" if [[ -f "$include" ]] @@ -186,7 +186,7 @@ tool_action_arguments_recursive() { local tool=$1 shift - local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) + local action_helper_arguments=$(tool_action_helper "arguments" "$tool" "$@") local argument if [[ $? -ne 0 ]] || [[ -z "$action_helper_arguments" ]] @@ -289,7 +289,7 @@ tool_usage_arguments_recursive() { local spacing=$1 shift - local action_helper_arguments=$( tool_action_helper "arguments" "$tool" "$@" ) + local action_helper_arguments=$(tool_action_helper "arguments" "$tool" "$@") local argument if [[ -n "$action_helper_arguments" ]] @@ -310,7 +310,7 @@ tool_file_path() { local file=$1 shift - local tool_path=$( tool_path "$tool" ) + local tool_path=$(tool_path "$tool") local path="$tool_path/$directory" local argument local file_path @@ -339,13 +339,13 @@ tool_file_path() { } tool_file_test() { - local file_path=$( tool_file_path "$@" ) + local file_path=$(tool_file_path "$@") test -f "$file_path" } tool_file_contents() { - local file_path=$( tool_file_path "$@" ) + local file_path=$(tool_file_path "$@") if [[ -f "$file_path" ]] then @@ -361,7 +361,7 @@ tool_file_contents_herit() { local file=$1 shift - local tool_path=$( tool_path "$tool" ) + local tool_path=$(tool_path "$tool") local path="$tool_path/$directory" local argument local file_path diff --git a/projects/cbfstool/cbfstool b/projects/cbfstool/cbfstool index eafe2ba9..c665bdca 100755 --- a/projects/cbfstool/cbfstool +++ b/projects/cbfstool/cbfstool @@ -56,12 +56,12 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local coreboot_sources_path=$(project_sources_path "$project" "$repository" "$@") local sources_path="$coreboot_sources_path/util/cbfstool/" - local build_path=$( project_build_path "$project" "$@" ) - local build_util_path=$( dirname "$build_path" ) + local build_path=$(project_build_path "$project" "$@") + local build_util_path=$(dirname "$build_path") - local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + local vboot_sources_path=$(project_sources_path "vboot" "vboot" "devices") if git_project_check "$repository" then diff --git a/projects/cbmem/cbmem b/projects/cbmem/cbmem index 6a469f61..3e240529 100755 --- a/projects/cbmem/cbmem +++ b/projects/cbmem/cbmem @@ -56,9 +56,9 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local coreboot_sources_path=$(project_sources_path "$project" "$repository" "$@") local sources_path="$coreboot_sources_path/util/cbmem/" - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then diff --git a/projects/coreboot/coreboot b/projects/coreboot/coreboot index f577ca26..85c1719d 100755 --- a/projects/coreboot/coreboot +++ b/projects/coreboot/coreboot @@ -64,15 +64,15 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$payload" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$payload" "$@" ) - local build_path=$( project_build_path "$project" "$payload" "$@" ) - local config_path=$( coreboot_config_path "$payload" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$payload" "$@") + local build_path=$(project_build_path "$project" "$payload" "$@") + local config_path=$(coreboot_config_path "$payload" "$@") - local arch=$( coreboot_arch "$payload" "$@" ) + local arch=$(coreboot_arch "$payload" "$@") - local crossgcc_build_path=$( project_build_path "crossgcc" "$arch" ) + local crossgcc_build_path=$(project_build_path "crossgcc" "$arch") local crossgcc_bin_path="$crossgcc_build_path/bin/" - local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + local vboot_sources_path=$(project_sources_path "vboot" "vboot" "devices") if git_project_check "$repository" then diff --git a/projects/cros-ec/cros-ec b/projects/cros-ec/cros-ec index be7aa62b..ba03bd56 100755 --- a/projects/cros-ec/cros-ec +++ b/projects/cros-ec/cros-ec @@ -63,8 +63,8 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then @@ -79,9 +79,9 @@ build() { else local arch="arm" - local config=$( cros_ec_config "$@" ) + local config=$(cros_ec_config "$@") - local crossgcc_bin_prefix=$( project_action_arguments "prefix" "crossgcc" "$arch" ) + local crossgcc_bin_prefix=$(project_action_arguments "prefix" "crossgcc" "$arch") make -C "$sources_path" out="$build_path" CROSS_COMPILE="$crossgcc_bin_prefix" HOST_CROSS_COMPILE= BOARD="$config" -j$TASKS fi diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc index 92a46860..46b9e3f3 100755 --- a/projects/crossgcc/crossgcc +++ b/projects/crossgcc/crossgcc @@ -46,9 +46,9 @@ extract() { crossgcc_tarballs "$@" | while read tarball do - local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" ) - local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) - local tarball_install_directory_path=$( dirname "$tarball_install_path" ) + local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball") + local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@") + local tarball_install_directory_path=$(dirname "$tarball_install_path") if [[ -f "$tarball_sources_path" ]] && ! [[ -f "$tarball_install_path" ]] then @@ -70,7 +70,7 @@ extract_check() { crossgcc_tarballs "$@" | while read tarball do - local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) + local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@") test ! -f "$tarball_install_path" done @@ -86,9 +86,9 @@ update() { crossgcc_tarballs "$@" | while read tarball do - local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" ) - local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) - local tarball_install_directory_path=$( dirname "$tarball_install_path" ) + local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball") + local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@") + local tarball_install_directory_path=$(dirname "$tarball_install_path") if [[ -f $tarball_sources_path ]] then @@ -110,7 +110,7 @@ update_check() { crossgcc_tarballs "$@" | while read tarball do - local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" "$@" ) + local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball" "$@") test ! -f "$tarball_sources_path" done @@ -119,7 +119,7 @@ update_check() { prefix() { local arch=$1 - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") case $arch in "arm") @@ -138,8 +138,8 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then @@ -184,9 +184,9 @@ release() { crossgcc_tarballs "$@" | while read tarball do - local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" ) - local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" ) - local release_path=$( project_release_path "$project" "$SOURCES" "$@" ) + local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@") + local tarball_release_path=$(crossgcc_tarball_release_path "$tarball" "$@") + local release_path=$(project_release_path "$project" "$SOURCES" "$@") mkdir -p "$release_path" @@ -210,7 +210,7 @@ release_check() { crossgcc_tarballs "$@" | while read tarball do - local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" ) + local tarball_release_path=$(crossgcc_tarball_release_path "$tarball" "$@") test -f "$tarball_release_path" done diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper index 3891a15c..94e445bf 100755 --- a/projects/crossgcc/crossgcc-helper +++ b/projects/crossgcc/crossgcc-helper @@ -31,9 +31,9 @@ crossgcc_same_major_version_test() { } crossgcc_tarballs() { - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") local install_path="$sources_path/util/crossgcc/tarballs/" - local tarballs=$( ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//" ) + local tarballs=$(ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//") printf '%s\n' "$tarballs" } @@ -50,7 +50,7 @@ crossgcc_tarball_install_path() { local tarball=$1 shift - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") local install_path="$sources_path/util/crossgcc/tarballs/" local tarball_install_path="$install_path/$tarball" @@ -61,7 +61,7 @@ crossgcc_tarball_release_path() { local tarball=$1 shift - local release_path=$( project_release_path "$project" "$SOURCES" "$@" ) + local release_path=$(project_release_path "$project" "$SOURCES" "$@") local tarball_release_path="$release_path/$tarball" printf '%s\n' "$tarball_release_path" diff --git a/projects/depthcharge/depthcharge b/projects/depthcharge/depthcharge index fe64c7d9..966b9689 100755 --- a/projects/depthcharge/depthcharge +++ b/projects/depthcharge/depthcharge @@ -66,15 +66,15 @@ build() { git_project_checkout "$project" "$repository" "$@" fi - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") - local libpayload_build_path=$( project_build_path "libpayload" "$project" "$@" ) + local libpayload_build_path=$(project_build_path "libpayload" "$project" "$@") local libpayload_build_install_path="$libpayload_build_path/install" - local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + local vboot_sources_path=$(project_sources_path "vboot" "vboot" "devices") - local arch=$( depthcharge_arch "$@" ) - local device=$( depthcharge_device "$@" ) + local arch=$(depthcharge_arch "$@") + local device=$(depthcharge_device "$@") project_action_arguments "checkout" "vboot" "devices" diff --git a/projects/flashmap/flashmap b/projects/flashmap/flashmap index 4ac6ab70..cc1cb81b 100755 --- a/projects/flashmap/flashmap +++ b/projects/flashmap/flashmap @@ -56,8 +56,8 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then diff --git a/projects/flashrom-cros/flashrom-cros b/projects/flashrom-cros/flashrom-cros index 8e793fa7..a1259c2c 100755 --- a/projects/flashrom-cros/flashrom-cros +++ b/projects/flashrom-cros/flashrom-cros @@ -61,8 +61,8 @@ build() { git_project_checkout "$project" "$repository" "$@" fi - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") mkdir -p "$build_path" diff --git a/projects/flashrom/flashrom b/projects/flashrom/flashrom index 0206e6b7..bc3199f0 100755 --- a/projects/flashrom/flashrom +++ b/projects/flashrom/flashrom @@ -70,8 +70,8 @@ build() { git_project_checkout "$project" "$repository" "$@" fi - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") mkdir -p "$build_path" diff --git a/projects/hdctools/hdctools b/projects/hdctools/hdctools index 9a7abdf0..e30b1f7a 100755 --- a/projects/hdctools/hdctools +++ b/projects/hdctools/hdctools @@ -58,8 +58,8 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then diff --git a/projects/libpayload/libpayload b/projects/libpayload/libpayload index 06c239dd..4fb90eb1 100755 --- a/projects/libpayload/libpayload +++ b/projects/libpayload/libpayload @@ -34,17 +34,17 @@ build() { git_project_checkout "$repository" "$repository" "$@" fi - local coreboot_sources_path=$( project_sources_path "$repository" "$repository" "$@" ) + local coreboot_sources_path=$(project_sources_path "$repository" "$repository" "$@") local sources_path="$coreboot_sources_path/payloads/libpayload/" - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") local build_install_path="$build_path/install" - local config_name=$( libpayload_config "$@" ) + local config_name=$(libpayload_config "$@") local config_path="$sources_path/configs/$config_name" - local arch=$( libpayload_arch "$@" ) + local arch=$(libpayload_arch "$@") - local crossgcc_build_path=$( project_build_path "crossgcc" "$arch" ) + local crossgcc_build_path=$(project_build_path "crossgcc" "$arch") local crossgcc_bin_path="$crossgcc_build_path/bin/" rm -f "$sources_path/.xcompile" diff --git a/projects/libreboot-release/libreboot-release b/projects/libreboot-release/libreboot-release index d693f503..ed9604e1 100755 --- a/projects/libreboot-release/libreboot-release +++ b/projects/libreboot-release/libreboot-release @@ -16,7 +16,7 @@ # along with this program. If not, see . install() { - local install_path=$( project_install_path "$project" "$@" ) + local install_path=$(project_install_path "$project" "$@") project_install "$project" "$@" } diff --git a/projects/libreboot-sources/libreboot-sources b/projects/libreboot-sources/libreboot-sources index 3dc1cb7d..bbf42315 100755 --- a/projects/libreboot-sources/libreboot-sources +++ b/projects/libreboot-sources/libreboot-sources @@ -23,7 +23,7 @@ update() { } install() { - local install_path=$( project_install_path "$project" "$@" ) + local install_path=$(project_install_path "$project" "$@") project_install "$project" "$@" } @@ -33,7 +33,7 @@ install_check() { } release() { - local archive_path=$( project_release_archive_path "$project" "$SOURCES" "$@" ) + local archive_path=$(project_release_archive_path "$project" "$SOURCES" "$@") local sources_path=$root project_release_install "$project" "$TOOLS" "$@" @@ -51,7 +51,7 @@ release() { } release_check() { - local archive_path=$( project_release_archive_path "$project" "$SOURCES" "$@" ) + local archive_path=$(project_release_archive_path "$project" "$SOURCES" "$@") project_release_install_check "$project" "$TOOLS" "$@" diff --git a/projects/mosys/mosys b/projects/mosys/mosys index 5ac27ee4..b795deb2 100755 --- a/projects/mosys/mosys +++ b/projects/mosys/mosys @@ -56,10 +56,10 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") - local flashmap_build_path=$( project_build_path "flashmap" "$@" ) + local flashmap_build_path=$(project_build_path "flashmap" "$@") if git_project_check "$repository" then diff --git a/projects/nvramtool/nvramtool b/projects/nvramtool/nvramtool index 70bf0758..96813239 100755 --- a/projects/nvramtool/nvramtool +++ b/projects/nvramtool/nvramtool @@ -56,9 +56,9 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local coreboot_sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local coreboot_sources_path=$(project_sources_path "$project" "$repository" "$@") local sources_path="$coreboot_sources_path/util/nvramtool/" - local build_path=$( project_build_path "$project" "$@" ) + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then diff --git a/projects/vboot/vboot b/projects/vboot/vboot index 55d28c87..e1216872 100755 --- a/projects/vboot/vboot +++ b/projects/vboot/vboot @@ -77,8 +77,8 @@ build() { if [[ "$target" = "tools" ]] then - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") mkdir -p "$build_path" diff --git a/projects/vpd/vpd b/projects/vpd/vpd index f8ebe59f..1105e588 100755 --- a/projects/vpd/vpd +++ b/projects/vpd/vpd @@ -56,8 +56,8 @@ build() { project_sources_directory_missing_empty_error "$project" "$repository" "$@" - local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local build_path=$( project_build_path "$project" "$@" ) + local sources_path=$(project_sources_path "$project" "$repository" "$@") + local build_path=$(project_build_path "$project" "$@") if git_project_check "$repository" then diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index 5d197723..7e383942 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -36,8 +36,8 @@ usage() { } update() { - local tool_path=$( tool_path "$tool" ) - local sources_path=$( tool_sources_path "$tool" ) + local tool_path=$(tool_path "$tool") + local sources_path=$(tool_sources_path "$tool") local deblob_check_path="$sources_path/deblob-check" local patches_path="$tool_path/$PATCHES/$WILDDOTPATCH" @@ -63,10 +63,10 @@ verify() { local project=$1 shift - local project_path=$( project_path "$project" ) - local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local project_path=$(project_path "$project") + local project_sources_path=$(project_sources_path "$project" "$repository" "$@") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_discover_path local ifs_save @@ -77,7 +77,7 @@ verify() { if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi @@ -88,7 +88,7 @@ verify() { ifs_save=$IFS IFS=$'\n' - for file in $( cat "$project_blobs_discover_path" ) + for file in $(cat "$project_blobs_discover_path") do ( IFS=$ifs_save @@ -124,21 +124,21 @@ execute() { shift local repository=$project - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") # This assumes that the repository is the project, which is not always the case. project_sources_directory_missing_empty_error "$project" "$repository" - local sources_path=$( tool_sources_path "$tool" ) - local project_path=$( project_path "$project" ) - local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local sources_path=$(tool_sources_path "$tool") + local project_path=$(project_path "$project") + local project_sources_path=$(project_sources_path "$project" "$repository" "$@") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_directory_path if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi @@ -153,7 +153,7 @@ execute() { printf '\n%s\n' 'Discovering new blobs, this may take a while...' - files=$( find "$project_sources_path" -type f | grep -vP "\.git/|\.tar|\.patch" ) + files=$(find "$project_sources_path" -type f | grep -vP "\.git/|\.tar|\.patch") touch "$project_blobs_discover_path" @@ -168,7 +168,7 @@ execute() { fi fi - match=$( "$deblob_check_path" -l -i "" "$file" || true ) + match=$("$deblob_check_path" -l -i "" "$file" || true) if [[ -n "$match" ]] then printf '%s\n' "$match" >> "$project_blobs_discover_path" @@ -182,14 +182,14 @@ execute_check() { local project=$1 shift - local project_path=$( project_path "$project" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local project_path=$(project_path "$project") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_discover_path if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi diff --git a/tools/boot-keys/boot-keys b/tools/boot-keys/boot-keys index 5d133742..4c40bdf3 100755 --- a/tools/boot-keys/boot-keys +++ b/tools/boot-keys/boot-keys @@ -20,7 +20,7 @@ usage() { } generate() { - local type=$( boot_keys_type "$@" ) + local type=$(boot_keys_type "$@") if [[ -z "$type" ]] then @@ -38,8 +38,8 @@ generate() { sign() { local project=$1 - local prepare_files=$( boot_keys_files "$@" ) - local type=$( boot_keys_type "$@" ) + local prepare_files=$(boot_keys_files "$@") + local type=$(boot_keys_type "$@") local install_path local firmware_path local kernel_path @@ -60,7 +60,7 @@ sign() { boot_keys_cros "$type-prepare" "sign" "$firmware_path" ;; "cros-kernel") - media=$( project_action "media" "$@" ) + media=$(project_action "media" "$@") for medium in $media do @@ -81,8 +81,8 @@ sign() { verify() { local project=$1 - local prepare_files=$( boot_keys_files "$@" ) - local type=$( boot_keys_type "$@" ) + local prepare_files=$(boot_keys_files "$@") + local type=$(boot_keys_type "$@") local install_path local firmware_path local kernel_path @@ -103,7 +103,7 @@ verify() { boot_keys_cros "$type-prepare" "verify" "$firmware_path" ;; "cros-kernel") - media=$( project_action "media" "$@" ) + media=$(project_action "media" "$@") for medium in $media do diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper index df53ec5b..464638b9 100755 --- a/tools/boot-keys/boot-keys-helper +++ b/tools/boot-keys/boot-keys-helper @@ -9,8 +9,8 @@ boot_keys_cros() { local cros_script=$1 shift - local vboot_tools_path=$( project_install_path "vboot" "tools" ) - local cros_scripts_path=$( project_install_path "cros-scripts" ) + local vboot_tools_path=$(project_install_path "vboot" "tools") + local cros_scripts_path=$(project_install_path "cros-scripts") local cros_script_path="$cros_scripts_path/$cros_script" if ! [[ -x "$cros_script_path" ]] @@ -34,7 +34,7 @@ boot_keys_files_install_path() { local argument local ifs_save - helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + helper_arguments=$(project_action_helper "arguments" "$project" "$@") if [[ $? -ne 0 ]] || [[ -z "$helper_arguments" ]] @@ -45,7 +45,7 @@ boot_keys_files_install_path() { ifs_save=$IFS IFS=$'\n' - for argument in $( printf '%s\n' "$helper_arguments" ) + for argument in $(printf '%s\n' "$helper_arguments") do ( IFS=$ifs_save @@ -63,7 +63,7 @@ boot_keys_files() { local project=$1 shift - local cros_scripts_path=$( project_install_path "cros-scripts" ) + local cros_scripts_path=$(project_install_path "cros-scripts") local cros_boot_keys="$cros_scripts_path/cros-boot-keys" project_action_arguments_verify_recursive "install" "$project" "$@" -- cgit v1.2.3-70-g09d2