From: Kevin Day Date: Sat, 29 Apr 2023 02:51:38 +0000 (-0500) Subject: Bugfix: Fix return codes and clean up package.sh. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=e93da385c054b0a4c26f24ecfde215322d66bce1;p=fll Bugfix: Fix return codes and clean up package.sh. Fix the return code handling just like the test.sh script in commit 5ccbc0f080ca5908f77e20879988b94a4cc0c6a9. The package.sh script is rather out of date in regards to the use of wrapping braces. --- diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index c39fa97..25abb91 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -44,7 +44,7 @@ bootstrap_main() { local key= local -A variables=() - local failure= + local failure=0 local settings_name=settings local settings_file= local settings_defines= @@ -511,7 +511,7 @@ bootstrap_main() { fi if [[ ${verbosity} != "quiet" ]] ; then - if [[ ${failure} != "" || ${verbosity} != "error" ]] ; then + if [[ ${failure} -eq 1 || ${verbosity} != "error" ]] ; then bootstrap_print_last fi fi @@ -858,7 +858,7 @@ bootstrap_load_settings() { let failure=1 fi - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then return 1 fi @@ -1065,7 +1065,7 @@ bootstrap_prepare_build() { mkdir ${verbose_common} -p ${path_build}{documents,includes,libraries/{script,shared,static},objects/{script,shared,static},programs/{script,shared,static},settings,stage} || failure=1 - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then echo -e "${c_warning}WARNING: Failed to create build directories in '${c_notice}${path_build}${c_error}'.${c_reset}" fi @@ -1084,7 +1084,7 @@ bootstrap_prepare_build() { fi fi - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then echo -e "${c_warning}WARNING: Failed to create ${c_notice}path_heades${c_error} build directories in '${c_notice}${path_build}${c_error}'.${c_reset}" fi @@ -1094,11 +1094,11 @@ bootstrap_prepare_build() { touch ${project_built}-${settings_name}.prepared - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build() { @@ -1398,7 +1398,7 @@ bootstrap_operation_build() { bootstrap_operation_build_validate_build - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then return 1 fi @@ -1411,7 +1411,7 @@ bootstrap_operation_build() { else mkdir ${verbose_common} -p ${path_build}documentation/${directory} || failure=1 - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then cp ${verbose_common} -R ${path_documentation}${i} ${path_build}documentation/${directory}/ || failure=1 fi fi @@ -1427,14 +1427,14 @@ bootstrap_operation_build() { else mkdir ${verbose_common} -p ${path_build}settings/${directory} || failure=1 - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then cp ${verbose_common} -R ${path_settings}${i} ${path_build}settings/${directory}/ || failure=1 fi fi done fi - if [[ ${failure} == "" && ${sources_headers} != "" ]] ; then + if [[ ${failure} -eq 0 && ${sources_headers} != "" ]] ; then if [[ ${preserve_path_headers} == "yes" ]] ; then for i in ${sources_headers} ; do directory=$(dirname ${i}) @@ -1446,7 +1446,7 @@ bootstrap_operation_build() { mkdir ${verbose_common} -p ${path_build}includes/${path_headers}${directory} || failure=1 fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then cp ${verbose_common} -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers}${i} || failure=1 fi fi @@ -1458,7 +1458,7 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} == "" && ${build_shared} == "yes" && ! -f ${project_built_shared}.built ]] ; then + if [[ ${failure} -eq 0 && ${build_shared} == "yes" && ! -f ${project_built_shared}.built ]] ; then if [[ ${sources_object} != "" || ${sources_object_shared} != "" ]] ; then sources= let count=0 @@ -1524,20 +1524,20 @@ bootstrap_operation_build() { ${build_compiler} ${sources} -shared -Wl,-soname,lib${build_name}.so${version_target} -o ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_file} ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_library} ${flags_library_shared} ${defines} ${defines_shared} ${defines_library} ${defines_library_shared} ${define_extra} || failure=1 - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then if [[ ${version_file_value} != "major" ]] ; then if [[ ${version_file_value} == "minor" ]] ; then ln ${verbose_common} -sf lib${build_name}.so${version_file} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major} || failure=1 else ln ${verbose_common} -sf lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major} || failure=1 - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then if [[ ${version_file_value} == "micro" ]] ; then ln ${verbose_common} -sf lib${build_name}.so${version_file} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor} || failure=1 else ln ${verbose_common} -sf lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor}${version_micro_prefix}${version_micro} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor} || failure=1 - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then ln ${verbose_common} -sf lib${build_name}.so${version_file} ${path_build}libraries/${path_library_shared}lib${build_name}.so${version_major_prefix}${version_major}${version_minor_prefix}${version_minor_prefix}${version_minor}${version_micro_prefix}${version_micro} || failure=1 fi fi @@ -1545,13 +1545,13 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then ln ${verbose_common} -sf lib${build_name}.so${version_major_prefix}${version_major} ${path_build}libraries/${path_library_shared}lib${build_name}.so || failure=1 fi fi fi - if [[ ${failure} == "" && ${sources_program} != "" ]] ; then + if [[ ${failure} -eq 0 && ${sources_program} != "" ]] ; then sources= links= @@ -1576,12 +1576,12 @@ bootstrap_operation_build() { ${build_compiler} ${sources} -o ${path_build}programs/${path_program_shared}${build_name} ${arguments_shared} ${arguments_include} ${links} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_program} ${flags_program_shared} ${defines} ${defines_shared} ${defines_program} ${defines_program_shared} ${define_extra} || failure=1 fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then touch ${project_built_shared}-${settings_name}.built fi fi - if [[ ${failure} == "" && ${build_static} == "yes" && ! -f ${project_built_static}.built ]] ; then + if [[ ${failure} -eq 0 && ${build_static} == "yes" && ! -f ${project_built_static}.built ]] ; then if [[ ${sources_object} != "" || ${sources_object_static} != "" ]] ; then let count=0 @@ -1659,12 +1659,12 @@ bootstrap_operation_build() { ${build_compiler} ${path_sources}${path_language}${i} -c -static -o ${path_build}objects/${directory}/${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_library} ${flags_library_static} ${defines} ${defines_static} ${defines_library} ${defines_library_static} ${define_extra} || failure=1 - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ ${failure} == "" && ( ${sources_library} != "" || ${sources_library_static} != "" ) ]] ; then + if [[ ${failure} -eq 0 && ( ${sources_library} != "" || ${sources_library_static} != "" ) ]] ; then if [[ ${verbosity} == "verbose" ]] ; then echo ${build_indexer} ${build_indexer_arguments} ${path_build}libraries/${path_library_static}lib${build_name}.a ${sources} @@ -1674,7 +1674,7 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} == "" && ${sources_program} != "" ]] ; then + if [[ ${failure} -eq 0 && ${sources_program} != "" ]] ; then sources= links= @@ -1699,12 +1699,12 @@ bootstrap_operation_build() { ${build_compiler} ${sources} -static -o ${path_build}programs/${path_program_static}${build_name} ${arguments_static} ${arguments_include} ${links} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_program} ${flags_program_static} ${defines} ${defines_static} ${defines_program} ${defines_program_static} ${define_extra} || failure=1 fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then touch ${project_built_static}-${settings_name}.built fi fi - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then if [[ ${verbosity} != "quiet" ]] ; then bootstrap_print_first @@ -1716,11 +1716,11 @@ bootstrap_operation_build() { return 1 fi - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build_prepare_defaults() { @@ -2789,11 +2789,11 @@ bootstrap_operation_build_validate_build() { let failure=1 fi - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build_validate_paths() { @@ -2808,7 +2808,7 @@ bootstrap_operation_build_validate_paths() { let failure=1 fi - if [[ ${failure} == "" && ${path_sources_object} != "" && ! -d ${path_sources_object} ]] ; then + if [[ ${failure} -eq 0 && ${path_sources_object} != "" && ! -d ${path_sources_object} ]] ; then if [[ ${verbosity} != "quiet" ]] ; then bootstrap_print_first @@ -2818,11 +2818,11 @@ bootstrap_operation_build_validate_paths() { let failure=1 fi - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build_validate_search() { @@ -2855,11 +2855,11 @@ bootstrap_operation_build_validate_shared_static() { let failure=1 fi - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build_validate_sources() { @@ -2960,11 +2960,11 @@ bootstrap_operation_build_validate_sources() { fi done - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } bootstrap_operation_build_prepare_versions() { diff --git a/build/scripts/install.sh b/build/scripts/install.sh index 7234d3e..4db64b7 100644 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -43,7 +43,7 @@ install_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - local failure= + local failure=0 local operation= local operation_failure= local verbosity=normal @@ -445,18 +445,18 @@ install_main() { install_perform_install if [[ ${verbosity} != "quiet" ]] ; then - if [[ ${failure} != "" || ${verbosity} != "error" ]] ; then + if [[ ${failure} -eq 1 || ${verbosity} != "error" ]] ; then install_print_last fi fi install_cleanup - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } install_handle_colors() { @@ -733,7 +733,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_includes} && ${enable_includes} == "yes" ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_includes} && ${enable_includes} == "yes" ]] ; then for i in ${path_build}${path_includes}* ; do file=$(echo ${i} | sed -e "s|^${path_build}${path_includes}||") @@ -766,7 +766,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_libraries} && ( ${enable_shared_libraries} == "yes" || ${enable_static_libraries} == "yes" ) ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_libraries} && ( ${enable_shared_libraries} == "yes" || ${enable_static_libraries} == "yes" ) ]] ; then if [[ -d ${path_build}${path_libraries}${path_static} && ${enable_static_libraries} == "yes" ]] ; then for i in ${path_build}${path_libraries}${path_static}* ; do @@ -800,7 +800,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_libraries}${path_shared} && ${enable_shared_libraries} == "yes" ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_libraries}${path_shared} && ${enable_shared_libraries} == "yes" ]] ; then for i in ${path_build}${path_libraries}${path_shared}* ; do file=$(echo ${i} | sed -e "s|^${path_build}${path_libraries}${path_shared}||") @@ -834,7 +834,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_programs} && ( ${enable_shared_programs} == "yes" || ${enable_static_programs} == "yes" ) ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_programs} && ( ${enable_shared_programs} == "yes" || ${enable_static_programs} == "yes" ) ]] ; then if [[ -d ${path_build}${path_programs}${path_static} && ${enable_static_programs} == "yes" ]] ; then for i in ${path_build}${path_programs}${path_static}* ; do @@ -868,7 +868,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_programs}${path_shared} && ${enable_shared_programs} == "yes" ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_programs}${path_shared} && ${enable_shared_programs} == "yes" ]] ; then for i in ${path_build}${path_programs}${path_shared}* ; do file=$(echo ${i} | sed -e "s|^${path_build}${path_programs}${path_shared}||") @@ -902,7 +902,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_settings} && ${enable_settings} == "yes" ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_settings} && ${enable_settings} == "yes" ]] ; then for i in ${path_build}${path_settings}* ; do file=$(echo ${i} | sed -e "s|^${path_build}${path_settings}||") @@ -935,7 +935,7 @@ install_perform_install() { fi fi - if [[ ${failure} == "" && -d ${path_build}${path_documentation} && ${enable_documentation} == "yes" ]] ; then + if [[ ${failure} -eq 0 && -d ${path_build}${path_documentation} && ${enable_documentation} == "yes" ]] ; then for i in ${path_build}${path_documentation}* ; do file=$(echo ${i} | sed -e "s|^${path_build}${path_documentation}||") @@ -968,11 +968,11 @@ install_perform_install() { fi fi - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } install_print_first() { diff --git a/build/scripts/package.sh b/build/scripts/package.sh index 2ae11b6..6949ae0 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -13,7 +13,7 @@ package_main() { - if [[ $SHELL_ENGINE == "zsh" ]] ; then + if [[ ${SHELL_ENGINE} == "zsh" ]] ; then emulate ksh fi @@ -41,7 +41,7 @@ package_main() { local c_prefix="\\" local -A variables=() - local failure= + local failure=0 local operation= local operation_failure= local mode_individual= @@ -63,93 +63,93 @@ package_main() { if [[ $# -gt 0 ]] ; then t=$# - while [[ $i -lt $t ]] ; do - let i=$i+1 + while [[ ${i} -lt ${t} ]] ; do + let i=${i}+1 - if [[ $SHELL_ENGINE == "zsh" ]] ; then + if [[ ${SHELL_ENGINE} == "zsh" ]] ; then p=${(P)i} else p=${!i} fi - if [[ $grab_next == "" ]] ; then - if [[ $p == "-h" || $p == "--help" ]] ; then + if [[ ${grab_next} == "" ]] ; then + if [[ ${p} == "-h" || ${p} == "--help" ]] ; then do_help=yes - elif [[ $p == "+C" || $p == "++copyright" ]] ; then + elif [[ ${p} == "+C" || ${p} == "++copyright" ]] ; then do_copyright="yes" - elif [[ $p == "+d" || $p == "++dark" ]] ; then + elif [[ ${p} == "+d" || ${p} == "++dark" ]] ; then do_color=dark context="+d" - elif [[ $p == "+l" || $p == "++light" ]] ; then + elif [[ ${p} == "+l" || ${p} == "++light" ]] ; then do_color=light context="+l" - elif [[ $p == "+n" || $p == "++no_color" ]] ; then + elif [[ ${p} == "+n" || ${p} == "++no_color" ]] ; then do_color=none context="+n" - elif [[ $p == "+Q" || $p == "++quiet" ]] ; then + elif [[ ${p} == "+Q" || ${p} == "++quiet" ]] ; then verbosity="quiet" verbose="+Q" verbose_common= - elif [[ $p == "+E" || $p == "++error" ]] ; then + elif [[ ${p} == "+E" || ${p} == "++error" ]] ; then verbosity="error" verbose="+E" verbose_common= - elif [[ $p == "+N" || $p == "++normal" ]] ; then + elif [[ ${p} == "+N" || ${p} == "++normal" ]] ; then verbosity= verbose="+N" verbose_common= - elif [[ $p == "+V" || $p == "++verbose" ]] ; then + elif [[ ${p} == "+V" || ${p} == "++verbose" ]] ; then verbosity="verbose" verbose="+V" verbose_common="-v" - elif [[ $p == "+D" || $p == "++debug" ]] ; then + elif [[ ${p} == "+D" || ${p} == "++debug" ]] ; then verbosity="debug" verbose="+D" verbose_common="-v" - elif [[ $p == "+F" || $p == "++line_first_no" ]] ; then + elif [[ ${p} == "+F" || ${p} == "++line_first_no" ]] ; then print_line_first="no" - elif [[ $p == "+L" || $p == "++line_last_no" ]] ; then + elif [[ ${p} == "+L" || ${p} == "++line_last_no" ]] ; then print_line_last="no" - elif [[ $p == "+v" || $p == "++version" ]] ; then + elif [[ ${p} == "+v" || ${p} == "++version" ]] ; then echo $version return 0 - elif [[ $p == "-b" || $p == "--build" ]] ; then + elif [[ ${p} == "-b" || ${p} == "--build" ]] ; then grab_next=path_build - elif [[ $p == "-d" || $p == "--destination" ]] ; then + elif [[ ${p} == "-d" || ${p} == "--destination" ]] ; then grab_next=path_destination - elif [[ $p == "-i" || $p == "--individual" ]] ; then + elif [[ ${p} == "-i" || ${p} == "--individual" ]] ; then mode_individual="yes" - elif [[ $p == "-l" || $p == "--level" ]] ; then + elif [[ ${p} == "-l" || ${p} == "--level" ]] ; then mode_level="yes" - elif [[ $p == "-m" || $p == "--monolithic" ]] ; then + elif [[ ${p} == "-m" || ${p} == "--monolithic" ]] ; then mode_monolithic="yes" - elif [[ $p == "-P" || $p == "--prepend" ]] ; then + elif [[ ${p} == "-P" || ${p} == "--prepend" ]] ; then grab_next=prepend - elif [[ $p == "-p" || $p == "--program" ]] ; then + elif [[ ${p} == "-p" || ${p} == "--program" ]] ; then mode_program="yes" - elif [[ $p == "-s" || $p == "--sources" ]] ; then + elif [[ ${p} == "-s" || ${p} == "--sources" ]] ; then grab_next=path_sources - elif [[ $p == "-S" || $p == "--stand_alone" ]] ; then + elif [[ ${p} == "-S" || ${p} == "--stand_alone" ]] ; then grab_next=stand_alone elif [[ $operation == "" ]] ; then - operation="$p" + operation="${p}" elif [[ $operation_failure == "" ]] ; then operation_failure=fail-multiple - operation="$p" + operation="${p}" fi else - if [[ $grab_next == "path_build" ]] ; then - path_build=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|') - elif [[ $grab_next == "path_destination" ]] ; then - path_destination=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|') - elif [[ $grab_next == "path_sources" ]] ; then - path_sources=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|') - elif [[ $grab_next == "stand_alone" ]] ; then + if [[ ${grab_next} == "path_build" ]] ; then + path_build=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|') + elif [[ ${grab_next} == "path_destination" ]] ; then + path_destination=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|') + elif [[ ${grab_next} == "path_sources" ]] ; then + path_sources=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|') + elif [[ ${grab_next} == "stand_alone" ]] ; then mode_stand_alone="${mode_stand_alone}${p} " - elif [[ $grab_next == "prepend" ]] ; then + elif [[ ${grab_next} == "prepend" ]] ; then # Provide a bare minimal sanitizer that probably doesn't catch everything that it ideally should. - prepend=$(echo $p | sed -e 's|[\!~\`@#$%^&*();:>") != "" ]] ; then has_thread="yes" @@ -846,14 +846,14 @@ package_dependencies_individual() { for dependency in $dependencies ; do - if [[ $(echo "$dependency" | grep -o "^f_") != "" ]] ; then + if [[ $(echo "${dependency}" | grep -o "^f_") != "" ]] ; then level=level_0 - elif [[ $(echo "$dependency" | grep -o "^fl_") != "" ]] ; then + elif [[ $(echo "${dependency}" | grep -o "^fl_") != "" ]] ; then level=level_1 - elif [[ $(echo "$dependency" | grep -o "^fll_") != "" ]] ; then + elif [[ $(echo "${dependency}" | grep -o "^fll_") != "" ]] ; then level=level_2 else - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first echo -e "${c_warning}WARNING: Failed to detect level for dependency ${c_notice}${dependency}${c_warning}.${c_reset}" @@ -863,7 +863,7 @@ package_dependencies_individual() { fi if [[ ! -d ${path_sources}${level}/${dependency}/data/build/ ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to find dependency data directory ${c_notice}${path_sources}${level}/${dependency}/data/build/${c_error}.${c_reset}" @@ -881,12 +881,12 @@ package_dependencies_individual() { for sub_dependency in $sub_dependencies ; do - if [[ $(echo "$sub_dependency" | grep -o "^f_") != "" ]] ; then + if [[ $(echo "${sub_dependency}" | grep -o "^f_") != "" ]] ; then sub_level=level_0 - elif [[ $(echo "$sub_dependency" | grep -o "^fl_") != "" ]] ; then + elif [[ $(echo "${sub_dependency}" | grep -o "^fl_") != "" ]] ; then sub_level=level_1 else - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first echo -e "${c_warning}WARNING: Failed to detect level for sub-dependency ${c_notice}${sub_dependency}${c_warning}.${c_reset}" @@ -896,7 +896,7 @@ package_dependencies_individual() { fi if [[ ! -d ${path_sources}${sub_level}/${sub_dependency}/data/build/ ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to find dependency data directory ${c_notice}${path_sources}${sub_level}/${sub_dependency}/data/build/${c_error}.${c_reset}" @@ -914,66 +914,66 @@ package_dependencies_individual() { for sub_sub_dependency in $sub_sub_dependencies ; do - if [[ $(echo "$sub_sub_dependency" | grep -o "^f_") != "" ]] ; then + if [[ $(echo "${sub_sub_dependency}" | grep -o "^f_") != "" ]] ; then sub_sub_level=level_0 else - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first - echo -e "${c_warning}WARNING: Failed to detect level for sub-sub-dependency ${c_notice}$sub_sub_dependency${c_warning}.${c_reset}" + echo -e "${c_warning}WARNING: Failed to detect level for sub-sub-dependency ${c_notice}${sub_sub_dependency}${c_warning}.${c_reset}" fi continue fi - package_dependencies_individual_append "$sub_sub_level" "$sub_sub_dependency" + package_dependencies_individual_append "${sub_sub_level}" "${sub_sub_dependency}" done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi - package_dependencies_individual_append "$sub_level" "$sub_dependency" + package_dependencies_individual_append "${sub_level}" "${sub_dependency}" - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi - package_dependencies_individual_append "$level" "$dependency" + package_dependencies_individual_append "${level}" "${dependency}" - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi - dependencies_individual=$(echo "$dependencies_individual" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|[[:space:]][[:space:]]*$| |') - if [[ $dependencies_individual != "" ]] ; then - if [[ $verbosity == "verbose" ]] ; then - echo -e " $dependencies_individual" + dependencies_individual=$(echo "${dependencies_individual}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|[[:space:]][[:space:]]*$| |') + if [[ ${dependencies_individual} != "" ]] ; then + if [[ ${verbosity} == "verbose" ]] ; then + echo -e " ${dependencies_individual}" fi - dependencies_individual=" $dependencies_individual" + dependencies_individual=" ${dependencies_individual}" fi settings=${directory}/data/build/settings${dependency_suffix} - sed -i -e "s|^\s*build_libraries-individual[[:space:]].*\$|build_libraries-individual${dependencies_individual}|" $settings && - sed -i -e "s|^\s*build_libraries-individual\$|build_libraries-individual${dependencies_individual}|" $settings + sed -i -e "s|^\s*build_libraries-individual[[:space:]].*\$|build_libraries-individual${dependencies_individual}|" ${settings} && + sed -i -e "s|^\s*build_libraries-individual\$|build_libraries-individual${dependencies_individual}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -984,21 +984,21 @@ package_dependencies_individual() { break fi - if [[ $has_thread == "yes" && $dependencies_individual != "" && $(grep -o "^\s*build_libraries-individual_threadless\>" $settings) != "" ]] ; then - dependencies_individual_threadless=$(echo "$dependencies_individual" | sed -e "s| \-lf_thread\>||g") + if [[ $has_thread == "yes" && ${dependencies_individual} != "" && $(grep -o "^\s*build_libraries-individual_threadless\>" ${settings}) != "" ]] ; then + dependencies_individual_threadless=$(echo "${dependencies_individual}" | sed -e "s| \-lf_thread\>||g") - if [[ $verbosity == "verbose" ]] ; then + if [[ ${verbosity} == "verbose" ]] ; then package_print_first - echo -e " (threadless) $dependencies_individual_threadless" + echo -e " (threadless) ${dependencies_individual_threadless}" fi settings=${directory}/data/build/settings - sed -i -e "s|^\s*build_libraries-individual_threadless[[:space:]].*\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" $settings && - sed -i -e "s|^\s*build_libraries-individual_threadless\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" $settings + sed -i -e "s|^\s*build_libraries-individual_threadless[[:space:]].*\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" ${settings} && + sed -i -e "s|^\s*build_libraries-individual_threadless\$|build_libraries-individual_threadless${dependencies_individual_threadless}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1011,12 +1011,12 @@ package_dependencies_individual() { fi # All level 3 are expected to support all modes: individual, level, and monolithic. - if [[ $level_current == "3" ]] ; then - sed -i -e "s|^\s*build_libraries-level\>.*\$|build_libraries-level -lfll_2 -lfll_1 -lfll_0|" $settings && - sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level -lfll_2 -lfll_1 -lfll_0|" $settings + if [[ ${level_current} == "3" ]] ; then + sed -i -e "s|^\s*build_libraries-level\>.*\$|build_libraries-level -lfll_2 -lfll_1 -lfll_0|" ${settings} && + sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level -lfll_2 -lfll_1 -lfll_0|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1027,11 +1027,11 @@ package_dependencies_individual() { break fi - sed -i -e "s|^\s*build_libraries-monolithic\>.*\$|build_libraries-monolithic -lfll|" $settings && - sed -i -e "s|^\s*build_libraries-monolithic\$|build_libraries-monolithic -lfll|" $settings + sed -i -e "s|^\s*build_libraries-monolithic\>.*\$|build_libraries-monolithic -lfll|" ${settings} && + sed -i -e "s|^\s*build_libraries-monolithic\$|build_libraries-monolithic -lfll|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1044,16 +1044,16 @@ package_dependencies_individual() { fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_dependencies_individual_append() { @@ -1063,8 +1063,8 @@ package_dependencies_individual_append() { local libraries= settings=${path_sources}${level}/${dependency}/data/build/settings - if [[ ! -f $settings ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ! -f ${settings} ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to find dependency settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1075,58 +1075,58 @@ package_dependencies_individual_append() { return 1 fi - libraries=$(grep -o '^\s*build_sources_library\s.*$' $settings | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||') + libraries=$(grep -o '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||') if [[ $libraries != "" ]] ; then - if [[ $(echo -n $dependencies_individual | grep -o "\-l$dependency\>") == "" ]] ; then + if [[ $(echo -n ${dependencies_individual} | grep -o "\-l${dependency}\>") == "" ]] ; then if [[ "$(type -p sort)" != "" ]] ; then - if [[ $level == "level_0" ]] ; then - dependencies_0="-l$dependency $dependencies_0" - dependencies_0="$(for i in $dependencies_0; do echo $i ; done | sort)" - dependencies_0=$(echo $dependencies_0) - elif [[ $level == "level_1" ]] ; then - dependencies_1="-l$dependency $dependencies_1" - dependencies_1=" $(for i in $dependencies_1; do echo $i ; done | sort)" - dependencies_1=$(echo $dependencies_1) + if [[ ${level} == "level_0" ]] ; then + dependencies_0="-l${dependency} ${dependencies_0}" + dependencies_0="$(for i in ${dependencies_0}; do echo ${i} ; done | sort)" + dependencies_0=$(echo ${dependencies_0}) + elif [[ ${level} == "level_1" ]] ; then + dependencies_1="-l${dependency} ${dependencies_1}" + dependencies_1=" $(for i in ${dependencies_1}; do echo ${i} ; done | sort)" + dependencies_1=$(echo ${dependencies_1}) else - dependencies_2="-l$dependency $dependencies_2" - dependencies_2=" $(for i in $dependencies_2; do echo $i ; done | sort)" - dependencies_2=$(echo $dependencies_2) + dependencies_2="-l${dependency} ${dependencies_2}" + dependencies_2=" $(for i in ${dependencies_2}; do echo ${i} ; done | sort)" + dependencies_2=$(echo ${dependencies_2}) fi else # Sort is not available, so do not bother trying to sort. - if [[ $level == "level_0" ]] ; then - dependencies_0="-l$dependency $dependencies_0" - elif [[ $level == "level_1" ]] ; then - dependencies_1="-l$dependency $dependencies_1" + if [[ ${level} == "level_0" ]] ; then + dependencies_0="-l${dependency} ${dependencies_0}" + elif [[ ${level} == "level_1" ]] ; then + dependencies_1="-l${dependency} ${dependencies_1}" else - dependencies_2="-l$dependency $dependencies_2" + dependencies_2="-l${dependency} ${dependencies_2}" fi fi dependencies_individual= - if [[ $dependencies_0 != "" ]] ; then - dependencies_individual="$dependencies_0" + if [[ ${dependencies_0} != "" ]] ; then + dependencies_individual="${dependencies_0}" fi - if [[ $dependencies_1 != "" ]] ; then - dependencies_individual="$dependencies_1 $dependencies_individual" + if [[ ${dependencies_1} != "" ]] ; then + dependencies_individual="${dependencies_1} ${dependencies_individual}" fi - if [[ $dependencies_2 != "" ]] ; then - dependencies_individual="$dependencies_2 $dependencies_individual" + if [[ ${dependencies_2} != "" ]] ; then + dependencies_individual="${dependencies_2} ${dependencies_individual}" fi fi fi - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_dependencies_level() { @@ -1140,19 +1140,19 @@ package_dependencies_level() { package_dependencies_level_update "level_0" "" - if [[ $failure == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then package_dependencies_level_update "level_1" " -lfll_0" fi - if [[ $failure == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then package_dependencies_level_update "level_2" " -lfll_1 -lfll_0" fi - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_dependencies_level_update() { @@ -1167,19 +1167,19 @@ package_dependencies_level_update() { local monolithic_libraries_threaded= local monolithic_headers_threaded= - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Building Dependencies: ${c_notice}${level}${c_highlight}.${c_reset}" fi - for directory in $path_sources${level}/* ; do + for directory in ${path_sources}${level}/* ; do - name="$(echo $directory | sed -e "s|${path_sources}${level}/||")" + name="$(echo ${directory} | sed -e "s|${path_sources}${level}/||")" settings=${directory}/data/build/settings - if [[ ! -f $settings ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ! -f ${settings} ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to find settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1190,37 +1190,37 @@ package_dependencies_level_update() { return 1 fi - libraries=$(grep -o '^\s*build_sources_library\s.*$' $settings | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||') + libraries=$(grep -o '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||') for library in $libraries ; do - if [[ $name == "f_thread" ]] ; then - level_sources_library_threaded="$level_sources_library_threaded $library" - monolithic_libraries_threaded="$monolithic_libraries_threaded ${level}/${library}" + if [[ ${name} == "f_thread" ]] ; then + level_sources_library_threaded="${level_sources_library_threaded} $library" + monolithic_libraries_threaded="${monolithic_libraries_threaded} ${level}/${library}" else - level_sources_library="$level_sources_library $library" - monolithic_libraries="$monolithic_libraries ${level}/${library}" + level_sources_library="${level_sources_library} $library" + monolithic_libraries="${monolithic_libraries} ${level}/${library}" fi done - headers=$(grep -o '^\s*build_sources_headers\s.*$' $settings | sed -e 's|^\s*build_sources_headers\>||' -e 's|^\s*||' -e 's|\s*$||') + headers=$(grep -o '^\s*build_sources_headers\s.*$' ${settings} | sed -e 's|^\s*build_sources_headers\>||' -e 's|^\s*||' -e 's|\s*$||') for header in $headers ; do - if [[ $name == "f_thread" ]] ; then - level_sources_headers_threaded="$level_sources_headers_threaded $header" - monolithic_headers_threaded="$monolithic_headers_threaded ${level}/${header}" + if [[ ${name} == "f_thread" ]] ; then + level_sources_headers_threaded="${level_sources_headers_threaded} $header" + monolithic_headers_threaded="${monolithic_headers_threaded} ${level}/${header}" else - level_sources_headers="$level_sources_headers $header" - monolithic_headers="$monolithic_headers ${level}/${header}" + level_sources_headers="${level_sources_headers} $header" + monolithic_headers="${monolithic_headers} ${level}/${header}" fi done done settings=${path_sources}/build/${level}/settings - if [[ ! -f $settings ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ! -f ${settings} ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to find settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1231,13 +1231,13 @@ package_dependencies_level_update() { return 1 fi - sed -i -e "s|^\s*build_libraries-level\s.*\$|build_libraries-level${level_libraries}|" $settings && - sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level${level_libraries}|" $settings && - sed -i -e "s|^\s*build_libraries-level_threadless\s.*\$|build_libraries-level_threadless${level_libraries}|" $settings && - sed -i -e "s|^\s*build_libraries-level_threadless\$|build_libraries-level_threadless${level_libraries}|" $settings + sed -i -e "s|^\s*build_libraries-level\s.*\$|build_libraries-level${level_libraries}|" ${settings} && + sed -i -e "s|^\s*build_libraries-level\$|build_libraries-level${level_libraries}|" ${settings} && + sed -i -e "s|^\s*build_libraries-level_threadless\s.*\$|build_libraries-level_threadless${level_libraries}|" ${settings} && + sed -i -e "s|^\s*build_libraries-level_threadless\$|build_libraries-level_threadless${level_libraries}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1248,19 +1248,19 @@ package_dependencies_level_update() { return 1 fi - level_sources_library=$(echo "$level_sources_library" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - if [[ $level_sources_library != "" ]] ; then - echo " $level_sources_library" - level_sources_library=" $level_sources_library" + level_sources_library=$(echo "${level_sources_library}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + if [[ ${level_sources_library} != "" ]] ; then + echo " ${level_sources_library}" + level_sources_library=" ${level_sources_library}" fi - sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${level_sources_library}|" $settings && - sed -i -e "s|^\s*build_sources_library\$|build_sources_library${level_sources_library}|" $settings && - sed -i -e "s|^\s*build_sources_library-level\s.*\$|build_sources_library-level${level_sources_library_threaded}|" $settings && - sed -i -e "s|^\s*build_sources_library-level\$|build_sources_library-level${level_sources_library_threaded}|" $settings + sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${level_sources_library}|" ${settings} && + sed -i -e "s|^\s*build_sources_library\$|build_sources_library${level_sources_library}|" ${settings} && + sed -i -e "s|^\s*build_sources_library-level\s.*\$|build_sources_library-level${level_sources_library_threaded}|" ${settings} && + sed -i -e "s|^\s*build_sources_library-level\$|build_sources_library-level${level_sources_library_threaded}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1271,19 +1271,19 @@ package_dependencies_level_update() { return 1 fi - level_sources_headers=$(echo "$level_sources_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - if [[ $level_sources_headers != "" ]] ; then - echo " $level_sources_headers" - level_sources_headers=" $level_sources_headers" + level_sources_headers=$(echo "${level_sources_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + if [[ ${level_sources_headers} != "" ]] ; then + echo " ${level_sources_headers}" + level_sources_headers=" ${level_sources_headers}" fi - sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${level_sources_headers}|" $settings && - sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${level_sources_headers}|" $settings && - sed -i -e "s|^\s*build_sources_headers-level\s.*\$|build_sources_headers-level${level_sources_headers_threaded}|" $settings && - sed -i -e "s|^\s*build_sources_headers-level\$|build_sources_headers-level${level_sources_headers_threaded}|" $settings + sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${level_sources_headers}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${level_sources_headers}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers-level\s.*\$|build_sources_headers-level${level_sources_headers_threaded}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers-level\$|build_sources_headers-level${level_sources_headers_threaded}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update headers for settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1294,24 +1294,24 @@ package_dependencies_level_update() { return 1 fi - if [[ $level == "level_0" ]] ; then - level_0_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_0_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + if [[ ${level} == "level_0" ]] ; then + level_0_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_0_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_0_libraries_threaded=$(echo "$monolithic_libraries_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_0_headers_threaded=$(echo "$monolithic_headers_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - elif [[ $level == "level_1" ]] ; then - level_1_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_1_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_0_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_0_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + elif [[ ${level} == "level_1" ]] ; then + level_1_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_1_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_1_libraries_threaded=$(echo "$monolithic_libraries_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_1_headers_threaded=$(echo "$monolithic_headers_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - elif [[ $level == "level_2" ]] ; then - level_2_libraries=$(echo "$monolithic_libraries" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_2_headers=$(echo "$monolithic_headers" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_1_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_1_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + elif [[ ${level} == "level_2" ]] ; then + level_2_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_2_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_2_libraries_threaded=$(echo "$monolithic_libraries_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') - level_2_headers_threaded=$(echo "$monolithic_headers_threaded" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_2_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') + level_2_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||') fi return 0 @@ -1323,117 +1323,117 @@ package_dependencies_monolithic() { local monolithic_headers="" local monolithic_headers_threaded="" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.${c_reset}" fi - if [[ $level_0_libraries != "" ]] ; then - monolithic_libraries="$level_0_libraries" + if [[ ${level_0_libraries} != "" ]] ; then + monolithic_libraries="${level_0_libraries}" fi - if [[ $level_0_libraries_threaded != "" ]] ; then - monolithic_libraries_threaded="$level_0_libraries_threaded" + if [[ ${level_0_libraries_threaded} != "" ]] ; then + monolithic_libraries_threaded="${level_0_libraries_threaded}" fi - if [[ $level_0_headers != "" ]] ; then - monolithic_headers="$level_0_headers" + if [[ ${level_0_headers} != "" ]] ; then + monolithic_headers="${level_0_headers}" fi - if [[ $level_0_headers_threaded != "" ]] ; then - monolithic_headers_threaded="$level_0_headers_threaded" + if [[ ${level_0_headers_threaded} != "" ]] ; then + monolithic_headers_threaded="${level_0_headers_threaded}" fi - if [[ $level_1_libraries != "" ]] ; then - if [[ $monolithic_libraries == "" ]] ; then - monolithic_libraries="$level_1_libraries" + if [[ ${level_1_libraries} != "" ]] ; then + if [[ ${monolithic_libraries} == "" ]] ; then + monolithic_libraries="${level_1_libraries}" else - monolithic_libraries="$monolithic_libraries $level_1_libraries" + monolithic_libraries="${monolithic_libraries} ${level_1_libraries}" fi fi - if [[ $level_1_libraries_threaded != "" ]] ; then - if [[ $monolithic_libraries_threaded == "" ]] ; then - monolithic_libraries_threaded="$level_1_libraries_threaded" + if [[ ${level_1_libraries_threaded} != "" ]] ; then + if [[ ${monolithic_libraries_threaded} == "" ]] ; then + monolithic_libraries_threaded="${level_1_libraries_threaded}" else - monolithic_libraries_threaded="$monolithic_libraries_threaded $level_1_libraries_threaded" + monolithic_libraries_threaded="${monolithic_libraries_threaded} ${level_1_libraries_threaded}" fi fi - if [[ $level_1_headers != "" ]] ; then - if [[ $monolithic_libraries == "" ]] ; then - monolithic_headers="$level_1_headers" + if [[ ${level_1_headers} != "" ]] ; then + if [[ ${monolithic_libraries} == "" ]] ; then + monolithic_headers="${level_1_headers}" else - monolithic_headers="$monolithic_headers $level_1_headers" + monolithic_headers="${monolithic_headers} ${level_1_headers}" fi fi - if [[ $level_1_headers_threaded != "" ]] ; then - if [[ $monolithic_libraries_threaded == "" ]] ; then - monolithic_headers_threaded="$level_1_headers_threaded" + if [[ ${level_1_headers_threaded} != "" ]] ; then + if [[ ${monolithic_libraries_threaded} == "" ]] ; then + monolithic_headers_threaded="${level_1_headers_threaded}" else - monolithic_headers_threaded="$monolithic_headers_threaded $level_1_headers_threaded" + monolithic_headers_threaded="${monolithic_headers_threaded} ${level_1_headers_threaded}" fi fi - if [[ $level_2_libraries != "" ]] ; then - if [[ $monolithic_libraries == "" ]] ; then - monolithic_libraries="$level_2_libraries" + if [[ ${level_2_libraries} != "" ]] ; then + if [[ ${monolithic_libraries} == "" ]] ; then + monolithic_libraries="${level_2_libraries}" else - monolithic_libraries="$monolithic_libraries $level_2_libraries" + monolithic_libraries="${monolithic_libraries} ${level_2_libraries}" fi fi - if [[ $level_2_libraries_threaded != "" ]] ; then - if [[ $monolithic_libraries_threaded == "" ]] ; then - monolithic_libraries_threaded="$level_2_libraries_threaded" + if [[ ${level_2_libraries_threaded} != "" ]] ; then + if [[ ${monolithic_libraries_threaded} == "" ]] ; then + monolithic_libraries_threaded="${level_2_libraries_threaded}" else - monolithic_libraries_threaded="$monolithic_libraries_threaded $level_2_libraries_threaded" + monolithic_libraries_threaded="${monolithic_libraries_threaded} ${level_2_libraries_threaded}" fi fi - if [[ $level_2_headers != "" ]] ; then - if [[ $monolithic_libraries == "" ]] ; then - monolithic_headers="$level_2_headers" + if [[ ${level_2_headers} != "" ]] ; then + if [[ ${monolithic_libraries} == "" ]] ; then + monolithic_headers="${level_2_headers}" else - monolithic_headers="$monolithic_headers $level_2_headers" + monolithic_headers="${monolithic_headers} ${level_2_headers}" fi fi - if [[ $level_2_headers_threaded != "" ]] ; then - if [[ $monolithic_libraries_threaded == "" ]] ; then - monolithic_headers_threaded="$level_2_headers_threaded" + if [[ ${level_2_headers_threaded} != "" ]] ; then + if [[ ${monolithic_libraries_threaded} == "" ]] ; then + monolithic_headers_threaded="${level_2_headers_threaded}" else - monolithic_headers_threaded="$monolithic_headers_threaded $level_2_headers_threaded" + monolithic_headers_threaded="${monolithic_headers_threaded} ${level_2_headers_threaded}" fi fi settings=${path_sources}/build/monolithic/settings - if [[ $monolithic_libraries != "" ]] ; then - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then - echo " $monolithic_libraries" + if [[ ${monolithic_libraries} != "" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then + echo " ${monolithic_libraries}" fi - monolithic_libraries=" $monolithic_libraries" + monolithic_libraries=" ${monolithic_libraries}" fi - if [[ $monolithic_libraries_threaded != "" ]] ; then - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then - echo " (threaded) $monolithic_libraries_threaded" + if [[ ${monolithic_libraries_threaded} != "" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then + echo " (threaded) ${monolithic_libraries_threaded}" fi - monolithic_libraries_threaded=" $monolithic_libraries_threaded" + monolithic_libraries_threaded=" ${monolithic_libraries_threaded}" fi - sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${monolithic_libraries}|" $settings && - sed -i -e "s|^\s*build_sources_library\$|build_sources_library${monolithic_libraries}|" $settings && - sed -i -e "s|^\s*build_sources_library-monolithic\s.*\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" $settings && - sed -i -e "s|^\s*build_sources_library-monolithic\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" $settings + sed -i -e "s|^\s*build_sources_library\s.*\$|build_sources_library${monolithic_libraries}|" ${settings} && + sed -i -e "s|^\s*build_sources_library\$|build_sources_library${monolithic_libraries}|" ${settings} && + sed -i -e "s|^\s*build_sources_library-monolithic\s.*\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" ${settings} && + sed -i -e "s|^\s*build_sources_library-monolithic\$|build_sources_library-monolithic${monolithic_libraries_threaded}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update libraries for settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1444,29 +1444,29 @@ package_dependencies_monolithic() { return 1 fi - if [[ $monolithic_headers != "" ]] ; then - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then - echo " $monolithic_headers" + if [[ ${monolithic_headers} != "" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then + echo " ${monolithic_headers}" fi - monolithic_headers=" $monolithic_headers" + monolithic_headers=" ${monolithic_headers}" fi - if [[ $monolithic_headers_threaded != "" ]] ; then - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then - echo " (threaded) $monolithic_headers_threaded" + if [[ ${monolithic_headers_threaded} != "" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then + echo " (threaded) ${monolithic_headers_threaded}" fi - monolithic_headers_threaded=" $monolithic_headers_threaded" + monolithic_headers_threaded=" ${monolithic_headers_threaded}" fi - sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${monolithic_headers}|" $settings && - sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${monolithic_headers}|" $settings && - sed -i -e "s|^\s*build_sources_headers-monolithic\s.*\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" $settings && - sed -i -e "s|^\s*build_sources_headers-monolithic\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" $settings + sed -i -e "s|^\s*build_sources_headers\s.*\$|build_sources_headers${monolithic_headers}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers\$|build_sources_headers${monolithic_headers}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers-monolithic\s.*\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" ${settings} && + sed -i -e "s|^\s*build_sources_headers-monolithic\$|build_sources_headers-monolithic${monolithic_headers_threaded}|" ${settings} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to update headers for settings file ${c_notice}${settings}${c_error}.${c_reset}" @@ -1483,15 +1483,15 @@ package_dependencies_monolithic() { package_operation_clean() { local i= - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Cleaning Package Directory '${c_reset}${c_notice}${path_destination}${c_reset}${c_highlight}'.${c_reset}" fi - if [[ $mode_individual == "yes" ]] ; then + if [[ ${mode_individual} == "yes" ]] ; then if [[ -d ${path_destination}individual ]] ; then - rm $verbose_common -Rf ${path_destination}individual + rm ${verbose_common} -Rf ${path_destination}individual if [[ $? -ne 0 ]] ; then let failure=1 @@ -1500,16 +1500,16 @@ package_operation_clean() { fi fi - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}individual'." fi fi - if [[ $mode_level == "yes" ]] ; then + if [[ ${mode_level} == "yes" ]] ; then if [[ -d ${path_destination}level ]] ; then - rm $verbose_common -Rf ${path_destination}level + rm ${verbose_common} -Rf ${path_destination}level if [[ $? -ne 0 ]] ; then let failure=1 @@ -1518,16 +1518,16 @@ package_operation_clean() { fi fi - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}level'." fi fi - if [[ $mode_monolithic == "yes" ]] ; then + if [[ ${mode_monolithic} == "yes" ]] ; then if [[ -d ${path_destination}monolithic ]] ; then - rm $verbose_common -Rf ${path_destination}monolithic + rm ${verbose_common} -Rf ${path_destination}monolithic if [[ $? -ne 0 ]] ; then let failure=1 @@ -1536,16 +1536,16 @@ package_operation_clean() { fi fi - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}monolithic'." fi fi - if [[ $mode_program == "yes" ]] ; then + if [[ ${mode_program} == "yes" ]] ; then if [[ -d ${path_destination}program ]] ; then - rm $verbose_common -Rf ${path_destination}program + rm ${verbose_common} -Rf ${path_destination}program if [[ $? -ne 0 ]] ; then let failure=1 @@ -1554,20 +1554,20 @@ package_operation_clean() { fi fi - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}program'." fi fi - if [[ $mode_stand_alone != "" ]] ; then + if [[ ${mode_stand_alone} != "" ]] ; then if [[ -d ${path_destination}stand_alone ]] ; then - for i in $mode_stand_alone ; do + for i in ${mode_stand_alone} ; do if [[ -d ${path_destination}stand_alone/${prepend}${i}-${version}/ ]] ; then - rm $verbose_common -Rf ${path_destination}stand_alone/${prepend}${i}-${version}/ + rm ${verbose_common} -Rf ${path_destination}stand_alone/${prepend}${i}-${version}/ if [[ $? -ne 0 ]] ; then let failure=1 @@ -1576,16 +1576,16 @@ package_operation_clean() { fi fi - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}stand_alone/${prepend}${i}-${version}/'." fi done - rmdir $verbose_common --ignore-fail-on-non-empty ${path_destination}stand_alone + rmdir ${verbose_common} --ignore-fail-on-non-empty ${path_destination}stand_alone - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo "Cleaned '${path_destination}stand_alone'." @@ -1599,13 +1599,13 @@ package_operation_clean() { package_operation_copy_package() { if [[ -d ${package}sources/data/ ]] ; then - cp $verbose_common -R ${package}sources/data ${package} + cp ${verbose_common} -R ${package}sources/data ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first - echo -e "${c_error}ERROR: Failed to copy the data directory ${c_notice}${package}sources/data${c_error} to ${c_notice}$package${c_error}.${c_reset}" + echo -e "${c_error}ERROR: Failed to copy the data directory ${c_notice}${package}sources/data${c_error} to ${c_notice}${package}${c_error}.${c_reset}" fi let failure=1 @@ -1613,10 +1613,10 @@ package_operation_copy_package() { return 1 fi - rm $verbose_common -Rf ${package}sources/data + rm ${verbose_common} -Rf ${package}sources/data if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data${c_error}.${c_reset}" @@ -1631,10 +1631,10 @@ package_operation_copy_package() { fi if [[ -d ${package}sources/documents/ ]] ; then - cp $verbose_common -R ${package}sources/documents/ ${package} + cp ${verbose_common} -R ${package}sources/documents/ ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move sources documents directory ${c_notice}${path_sources}sources/documents${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1645,10 +1645,10 @@ package_operation_copy_package() { return 1 fi - rm $verbose_common -Rf ${package}sources/documents/ + rm ${verbose_common} -Rf ${package}sources/documents/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove sources documents directory ${c_notice}${path_sources}sources/documents${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1661,10 +1661,10 @@ package_operation_copy_package() { fi if [[ -d ${package}sources/licenses/ ]] ; then - cp $verbose_common -R ${package}sources/licenses/ ${package} + cp ${verbose_common} -R ${package}sources/licenses/ ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move sources licenses directory ${c_notice}${path_sources}sources/licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1675,10 +1675,10 @@ package_operation_copy_package() { return 1 fi - rm $verbose_common -Rf ${package}sources/licenses/ + rm ${verbose_common} -Rf ${package}sources/licenses/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove sources licenses directory ${c_notice}${path_sources}sources/licenses${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1691,10 +1691,10 @@ package_operation_copy_package() { fi if [[ -d ${package}sources/specifications/ ]] ; then - cp $verbose_common -R ${package}sources/specifications/ ${package} + cp ${verbose_common} -R ${package}sources/specifications/ ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move sources specifications directory ${c_notice}${path_sources}sources/specifications${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1702,13 +1702,13 @@ package_operation_copy_package() { let failure=1 - return $failure + return ${failure} fi - rm $verbose_common -Rf ${package}sources/specifications/ + rm ${verbose_common} -Rf ${package}sources/specifications/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove sources specifications directory ${c_notice}${path_sources}sources/specifications${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1721,10 +1721,10 @@ package_operation_copy_package() { fi if [[ -d ${package}sources/tests/ ]] ; then - cp $verbose_common -R ${package}sources/tests/ ${package} + cp ${verbose_common} -R ${package}sources/tests/ ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move sources tests directory ${c_notice}${path_sources}sources/tests${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1735,10 +1735,10 @@ package_operation_copy_package() { return 1 fi - rm $verbose_common -Rf ${package}sources/tests/ + rm ${verbose_common} -Rf ${package}sources/tests/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove sources tests directory ${c_notice}${path_sources}sources/tests${c_error} to ${c_notice}${package}${c_error}.${c_reset}" @@ -1767,12 +1767,12 @@ package_operation_create_config_stubs() { return 0 fi - if [[ $language == "c" && ! -f ${package}sources/c/config.c ]] ; then + if [[ ${language} == "c" && ! -f ${package}sources/c/config.c ]] ; then if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then sed -i -E -e "s|^\s*\bbuild_sources_program\s+|&config.c |" ${package}data/build/settings if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to insert the config.c into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" @@ -1780,13 +1780,13 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi elif [[ $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then sed -i -E -e "s|^\s*\bbuild_sources_library\s+|&config.c |" ${package}data/build/settings if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to insert the config.c into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" @@ -1794,7 +1794,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi @@ -1803,7 +1803,7 @@ package_operation_create_config_stubs() { echo "#include \"config.h\"" >> ${package}sources/c/config.c if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create the config.c at ${c_notice}${package}sources/c/config.c${c_error}.${c_reset}" @@ -1811,15 +1811,15 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi - elif [[ $language == "c++" && ! -f ${package}sources/c/config.cpp ]] ; then + elif [[ ${language} == "c++" && ! -f ${package}sources/c/config.cpp ]] ; then if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then sed -i -E -e "s|^\s*\bbuild_sources_program\s+|&config.cpp |" ${package}data/build/settings if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to insert the config.cpp into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" @@ -1827,13 +1827,13 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi elif [[ $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then sed -i -E -e "s|^\s*\bbuild_sources_library\s+|&config.cpp |" ${package}data/build/settings if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to insert the config.cpp into ${c_notice}${package}data/build/settings${c_error}.${c_reset}" @@ -1841,7 +1841,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi @@ -1850,7 +1850,7 @@ package_operation_create_config_stubs() { echo "#include \"config.h\"" >> ${package}sources/c++/config.cpp if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c++/config.cpp${c_error}.${c_reset}" @@ -1858,17 +1858,17 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi fi - if [[ ( $language == "c" && ! -f ${package}sources/c/config.h ) || ( $language == "c++" && ! -f ${package}sources/c++/config.h ) ]] ; then + if [[ ( ${language} == "c" && ! -f ${package}sources/c/config.h ) || ( ${language} == "c++" && ! -f ${package}sources/c++/config.h ) ]] ; then if [[ $(grep -soP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then echo > ${package}sources/c/config.h if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c/config.h${c_error}.${c_reset}" @@ -1876,13 +1876,13 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi else echo > ${package}sources/c++/config.h if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create the config.cpp at ${c_notice}${package}sources/c++/config.h${c_error}.${c_reset}" @@ -1890,7 +1890,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi fi @@ -1908,14 +1908,14 @@ package_operation_dependencies() { package_dependencies_individual - if [[ $failure != "" ]] ; then - return $failure; + if [[ ${failure} -eq 1 ]] ; then + return ${failure}; fi package_dependencies_level - if [[ $failure != "" ]] ; then - return $failure; + if [[ ${failure} -eq 1 ]] ; then + return ${failure}; fi package_dependencies_monolithic @@ -1929,25 +1929,25 @@ package_operation_individual() { local package= if [[ ! -d ${path_destination}individual ]] ; then - mkdir $verbose_common -p ${path_destination}individual + mkdir ${verbose_common} -p ${path_destination}individual if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}individual${c_error}.${c_reset}" fi - return $failure + return ${failure} fi fi for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ; do - name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")" + name="$(echo ${directory} | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")" package="${path_destination}individual/${prepend}${name}-${version}/" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Packaging Project${c_reset} (individual) ${c_notice}${prepend}${name}-${version}${c_reset}${c_highlight}.${c_reset}" @@ -1955,10 +1955,10 @@ package_operation_individual() { package_create_base_files - cp $verbose_common -R $directory ${package}sources/ + cp ${verbose_common} -R ${directory} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" @@ -1971,16 +1971,16 @@ package_operation_individual() { package_operation_copy_package - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_operation_level() { @@ -1991,17 +1991,17 @@ package_operation_level() { for level in level_0 level_1 level_2 ; do - name="fll-$level" + name="fll-${level}" package="${path_destination}level/${prepend}${name}-${version}/" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Packaging Project${c_reset} (level) ${c_notice}${prepend}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi - if [[ ! -d $path_build$level ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ! -d ${path_build}${level} ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Build settings directory ${c_notice}${path_build}${level}${c_error} is invalid or missing.${c_reset}" @@ -2015,10 +2015,10 @@ package_operation_level() { package_create_base_files if [[ ! -d ${package}data/ ]] ; then - mkdir $verbose_common ${package}data/ + mkdir ${verbose_common} ${package}data/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}data${c_error}.${c_reset}" @@ -2030,14 +2030,14 @@ package_operation_level() { fi fi - if [[ -d $path_build${level}/build ]] ; then - cp $verbose_common -R ${path_build}${level}/build ${package}data/ + if [[ -d ${path_build}${level}/build ]] ; then + cp ${verbose_common} -R ${path_build}${level}/build ${package}data/ else - cp $verbose_common -R ${path_build}${level} ${package}data/build + cp ${verbose_common} -R ${path_build}${level} ${package}data/build fi if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move the directory ${c_notice}${path_build}${level}${c_error} as ${c_notice}${path_build}${level}build${c_error}.${c_reset}" @@ -2049,10 +2049,10 @@ package_operation_level() { fi if [[ ! -d ${package}sources/ ]] ; then - mkdir $verbose_common ${package}sources/ + mkdir ${verbose_common} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}sources${c_error}.${c_reset}" @@ -2066,10 +2066,10 @@ package_operation_level() { for directory in ${path_sources}${level}/* ; do - cp $verbose_common -R ${directory}/* ${package}sources/ + cp ${verbose_common} -R ${directory}/* ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" @@ -2080,10 +2080,10 @@ package_operation_level() { break fi - rm $verbose_common -Rf ${package}sources/data/build/ + rm ${verbose_common} -Rf ${package}sources/data/build/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data/build${c_error}.${c_reset}" @@ -2095,21 +2095,21 @@ package_operation_level() { package_operation_copy_package - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_operation_monolithic() { @@ -2123,14 +2123,14 @@ package_operation_monolithic() { name="fll" package="${path_destination}monolithic/${prepend}${name}-${version}/" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Packaging Project${c_reset} (monolithic) ${c_notice}${prepend}${name}-${version}${c_reset}${c_highlight}.${c_reset}" fi if [[ ! -d ${path_build}monolithic ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Build settings directory ${c_notice}${path_build}monolithic${c_error} is invalid or missing.${c_reset}" @@ -2144,10 +2144,10 @@ package_operation_monolithic() { package_create_base_files if [[ ! -d ${package}data/ ]] ; then - mkdir $verbose_common ${package}data/ + mkdir ${verbose_common} ${package}data/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}data${c_error}.${c_reset}" @@ -2160,13 +2160,13 @@ package_operation_monolithic() { fi if [[ -d ${path_build}monolithic/build ]] ; then - cp $verbose_common -R ${path_build}monolithic/build ${package}data + cp ${verbose_common} -R ${path_build}monolithic/build ${package}data else - cp $verbose_common -R ${path_build}monolithic ${package}data/build + cp ${verbose_common} -R ${path_build}monolithic ${package}data/build fi if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move the directory ${c_notice}${path_build}${level}${c_error} as ${c_notice}${path_build}${level}build${c_error}.${c_reset}" @@ -2178,10 +2178,10 @@ package_operation_monolithic() { fi if [[ ! -d ${package}sources/ ]] ; then - mkdir $verbose_common ${package}sources/ + mkdir ${verbose_common} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}sources${c_error}.${c_reset}" @@ -2194,10 +2194,10 @@ package_operation_monolithic() { fi if [[ ! -d ${package}tests/ ]] ; then - mkdir $verbose_common ${package}tests/ + mkdir ${verbose_common} ${package}tests/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${package}tests${c_error}.${c_reset}" @@ -2211,18 +2211,18 @@ package_operation_monolithic() { for level in level_0 level_1 level_2 ; do - for directory in $path_sources${level}/* ; do + for directory in ${path_sources}${level}/* ; do - for directory_sub in $directory/* ; do + for directory_sub in ${directory}/* ; do - path_name="$(basename $directory_sub)" + path_name="$(basename ${directory_sub})" - if [[ $path_name == "data" ]] ; then - if [[ ! -d ${package}data/$level ]] ; then - mkdir $verbose_common -p ${package}data/$level + if [[ ${path_name} == "data" ]] ; then + if [[ ! -d ${package}data/${level} ]] ; then + mkdir ${verbose_common} -p ${package}data/${level} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create package data directory ${c_notice}${package}data/${level}${c_error}.${c_reset}" @@ -2234,13 +2234,13 @@ package_operation_monolithic() { fi fi - cp $verbose_common -R $directory_sub ${package}sources/data + cp ${verbose_common} -R ${directory_sub} ${package}sources/data if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first - echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/data$level${c_error}.${c_reset}" + echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/data${level}${c_error}.${c_reset}" fi let failure=1 @@ -2248,10 +2248,10 @@ package_operation_monolithic() { break fi - rm $verbose_common -Rf ${package}sources/data/build/ + rm ${verbose_common} -Rf ${package}sources/data/build/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data/build${c_error}.${c_reset}" @@ -2263,10 +2263,10 @@ package_operation_monolithic() { fi if [[ "$(ls ${package}sources/data)" != "" ]] ; then - cp $verbose_common -R ${package}sources/data/* ${package}data/${level} + cp ${verbose_common} -R ${package}sources/data/* ${package}data/${level} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy the data directory ${c_notice}${package}sources/data/${level}/data${c_error} to ${c_notice}${package}data/${level}${c_error}.${c_reset}" @@ -2278,10 +2278,10 @@ package_operation_monolithic() { fi fi - rm $verbose_common -Rf ${package}sources/data + rm ${verbose_common} -Rf ${package}sources/data if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to remove directory ${c_notice}${package}sources/data${c_error}.${c_reset}" @@ -2291,11 +2291,11 @@ package_operation_monolithic() { break fi - elif [[ $path_name == "documents" ]] ; then - cp $verbose_common -R $directory_sub ${package}sources/ + elif [[ ${path_name} == "documents" ]] ; then + cp ${verbose_common} -R ${directory_sub} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/documents${c_error}.${c_reset}" @@ -2305,11 +2305,11 @@ package_operation_monolithic() { break fi - elif [[ $path_name == "licenses" ]] ; then - cp $verbose_common -R $directory_sub ${package}sources/ + elif [[ ${path_name} == "licenses" ]] ; then + cp ${verbose_common} -R ${directory_sub} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/licenses${c_error}.${c_reset}" @@ -2319,11 +2319,11 @@ package_operation_monolithic() { break fi - elif [[ $path_name == "specifications" ]] ; then - cp $verbose_common -R $directory_sub ${package}sources/ + elif [[ ${path_name} == "specifications" ]] ; then + cp ${verbose_common} -R ${directory_sub} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/specifications${c_error}.${c_reset}" @@ -2333,11 +2333,11 @@ package_operation_monolithic() { break fi - elif [[ $path_name == "tests" ]] ; then - cp $verbose_common -R $directory_sub ${package} + elif [[ ${path_name} == "tests" ]] ; then + cp ${verbose_common} -R ${directory_sub} ${package} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from data directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}tests${c_error}.${c_reset}" @@ -2349,10 +2349,10 @@ package_operation_monolithic() { fi else if [[ ! -d ${package}sources/${path_name}/${level} ]] ; then - mkdir $verbose_common -p ${package}sources/${path_name}/${level} + mkdir ${verbose_common} -p ${package}sources/${path_name}/${level} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/${level}${c_error}.${c_reset}" @@ -2364,10 +2364,10 @@ package_operation_monolithic() { fi fi - cp $verbose_common -R ${directory_sub}/* ${package}sources/${path_name}/${level} + cp ${verbose_common} -R ${directory_sub}/* ${package}sources/${path_name}/${level} if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory_sub}${c_error} to ${c_notice}${package}sources/${path_name}/${level}${c_error}.${c_reset}" @@ -2380,17 +2380,17 @@ package_operation_monolithic() { fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ $failure == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then package_operation_create_config_stubs if [[ $? -ne 0 ]] ; then @@ -2398,11 +2398,11 @@ package_operation_monolithic() { fi fi - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_operation_program() { @@ -2411,10 +2411,10 @@ package_operation_program() { local package= if [[ ! -d ${path_destination}program ]] ; then - mkdir $verbose_common -p ${path_destination}program + mkdir ${verbose_common} -p ${path_destination}program if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}program${c_error}.${c_reset}" @@ -2422,16 +2422,16 @@ package_operation_program() { package_cleanup - exit $failure + exit ${failure} fi fi for directory in ${path_sources}level_3/* ; do - name="$(echo $directory | sed -e "s|${path_sources}level_3/||")" + name="$(echo ${directory} | sed -e "s|${path_sources}level_3/||")" package="${path_destination}program/${prepend}${name}-${version}/" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Packaging Project${c_reset} (program) ${c_notice}${prepend}${name}-${version}${c_reset}${c_highlight}.${c_reset}" @@ -2439,10 +2439,10 @@ package_operation_program() { package_create_base_files - cp $verbose_common -R $directory ${package}sources/ + cp ${verbose_common} -R ${directory} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" @@ -2462,11 +2462,11 @@ package_operation_program() { fi done - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_operation_stand_alone() { @@ -2484,10 +2484,10 @@ package_operation_stand_alone() { local path_name_sub= if [[ ! -d ${path_destination}stand_alone ]] ; then - mkdir $verbose_common -p ${path_destination}stand_alone + mkdir ${verbose_common} -p ${path_destination}stand_alone if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create directory ${c_notice}${path_destination}stand_alone${c_error}.${c_reset}" @@ -2499,12 +2499,12 @@ package_operation_stand_alone() { fi fi - for name in $mode_stand_alone ; do + for name in ${mode_stand_alone} ; do directory="${path_sources}level_3/${name}" package="${path_destination}stand_alone/${prepend}${name}-${version}/" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then package_print_first_or_always echo -e "${c_highlight}Packaging Project${c_reset} (stand_alone) ${c_notice}${prepend}${name}-${version}${c_reset}${c_highlight}.${c_reset}" @@ -2518,10 +2518,10 @@ package_operation_stand_alone() { break fi - cp $verbose_common -R $directory ${package}sources/ + cp ${verbose_common} -R ${directory} ${package}sources/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy sources directory ${c_notice}${directory}${c_error} to ${c_notice}${package}sources${c_error}.${c_reset}" @@ -2540,10 +2540,10 @@ package_operation_stand_alone() { break fi - cp $verbose_common -R ${path_build}stand_alone/${name}.settings ${package}data/build/settings + cp ${verbose_common} -R ${path_build}stand_alone/${name}.settings ${package}data/build/settings if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy file ${c_notice}${path_build}stand_alone/${name}.settings${c_error} to ${c_notice}${package}data/build/settings${c_error}.${c_reset}" @@ -2554,10 +2554,10 @@ package_operation_stand_alone() { break fi - cp $verbose_common -R ${path_build}stand_alone/${name}.fakefile ${package}data/build/fakefile + cp ${verbose_common} -R ${path_build}stand_alone/${name}.fakefile ${package}data/build/fakefile if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy file ${c_notice}${path_build}stand_alone/${name}.fakefile${c_error} to ${c_notice}${package}data/build/fakefile${c_error}.${c_reset}" @@ -2569,10 +2569,10 @@ package_operation_stand_alone() { fi if [[ ! -d ${package}sources/c/program/${name}/ ]] ; then - mkdir $verbose_common -p ${package}sources/c/program/$name/ + mkdir ${verbose_common} -p ${package}sources/c/program/${name}/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/c/program/${name}/${c_error}.${c_reset}" @@ -2591,7 +2591,7 @@ package_operation_stand_alone() { for path_sub in ${package}sources/${path_name}/* ; do - path_name_sub="$(basename $path_sub)" + path_name_sub="$(basename ${path_sub})" # Do not attempt copying into self. if [[ $path_name_sub == "program" ]] ; then @@ -2599,10 +2599,10 @@ package_operation_stand_alone() { fi if [[ ! -d ${package}sources/${path_name}/program/${name}/ ]] ; then - mkdir $verbose_common -p ${package}sources/${path_name}/program/${name}/ + mkdir ${verbose_common} -p ${package}sources/${path_name}/program/${name}/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/program/${name}/${c_error}.${c_reset}" @@ -2614,10 +2614,10 @@ package_operation_stand_alone() { fi fi - mv $verbose_common $path_sub ${package}sources/${path_name}/program/${name}/ + mv ${verbose_common} ${path_sub} ${package}sources/${path_name}/program/${name}/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to move path ${c_notice}${path_sub}${c_error} to ${c_notice}${package}sources/${path_name}/program/${name}/${c_error}.${c_reset}" @@ -2629,20 +2629,20 @@ package_operation_stand_alone() { fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break fi if [[ -f ${path_build}stand_alone/${name}.config.h ]] ; then - cp $verbose_common -R ${path_build}stand_alone/${name}.config.h ${package}sources/c/config.h + cp ${verbose_common} -R ${path_build}stand_alone/${name}.config.h ${package}sources/c/config.h if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy file ${c_notice}${path_build}stand_alone/config.h${c_error} to ${c_notice}${package}sources/c/${c_error}.${c_reset}" @@ -2657,8 +2657,8 @@ package_operation_stand_alone() { if [[ -f ${package}data/build/dependencies ]] ; then packages=$(grep -soP '^\s*[^\s]+' ${package}data/build/dependencies | sed -e 's|^[[:space:]]*||g') - if [[ $packages != "" ]] ; then - for package_sub in $packages ; do + if [[ ${packages} != "" ]] ; then + for package_sub in ${packages} ; do if [[ -d ${path_sources}level_0/${package_sub}/ ]] ; then level=level_0 @@ -2676,18 +2676,18 @@ package_operation_stand_alone() { for directory_sub in ${directory_level}* ; do - path_name="$(basename $directory_sub)" + path_name="$(basename ${directory_sub})" # Skip directories that are not to be copied. - if [[ $path_name == "data" || $path_name == "documents" || $path_name == "licenses" || $path_name == "specifications" || $path_name == "tests" ]] ; then + if [[ ${path_name} == "data" || ${path_name} == "documents" || ${path_name} == "licenses" || ${path_name} == "specifications" || ${path_name} == "tests" ]] ; then continue fi if [[ ! -d ${package}sources/${path_name}/fll/${level}/ ]] ; then - mkdir $verbose_common -p ${package}sources/${path_name}/fll/${level}/ + mkdir ${verbose_common} -p ${package}sources/${path_name}/fll/${level}/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to create package sources directory ${c_notice}${package}sources/${path_name}/fll/${level}/${c_error}.${c_reset}" @@ -2699,10 +2699,10 @@ package_operation_stand_alone() { fi fi - cp $verbose_common -R ${directory_level}${path_name}/* ${package}sources/${path_name}/fll/${level}/ + cp ${verbose_common} -R ${directory_level}${path_name}/* ${package}sources/${path_name}/fll/${level}/ if [[ $? -ne 0 ]] ; then - if [[ $verbosity != "quiet" ]] ; then + if [[ ${verbosity} != "quiet" ]] ; then package_print_first echo -e "${c_error}ERROR: Failed to copy files from sources directory ${c_notice}${directory_level}${path_name}/${c_error} to ${c_notice}${package}sources/${path_name}/fll/${level}/${c_error}.${c_reset}" @@ -2714,28 +2714,28 @@ package_operation_stand_alone() { fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break fi done - if [[ $failure != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break fi fi fi done - if [[ $failure == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } package_print_first() { - if [[ $print_line_first == "yes" ]] ; then + if [[ ${print_line_first} == "yes" ]] ; then echo print_line_first= @@ -2744,11 +2744,11 @@ package_print_first() { package_print_first_or_always() { - if [[ $print_line_first == "yes" ]] ; then + if [[ ${print_line_first} == "yes" ]] ; then echo print_line_first= - elif [[ $print_line_first == "no" ]] ; then + elif [[ ${print_line_first} == "no" ]] ; then print_line_first= else echo @@ -2757,7 +2757,7 @@ package_print_first_or_always() { package_print_last() { - if [[ $print_line_last == "yes" ]] ; then + if [[ ${print_line_last} == "yes" ]] ; then echo fi }