From: Kevin Day Date: Sat, 29 Apr 2023 02:49:32 +0000 (-0500) Subject: Bugfix: Fix return codes and clean up package.sh. X-Git-Tag: 0.6.5^0 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=521b73b1b8f6375f79301cb6e702f824a685cdfb;p=fll Bugfix: Fix return codes and clean up package.sh. Fix the return code handling just like the test.sh script in commit 68367b9577fdf1578b66008e5e1cb37070098b1b. 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 0f79dbc..c4a7671 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= @@ -507,7 +507,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 @@ -852,7 +852,7 @@ bootstrap_load_settings() { let failure=1 fi - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then return 1 fi @@ -1059,7 +1059,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 @@ -1078,7 +1078,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 @@ -1088,11 +1088,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() { @@ -1392,7 +1392,7 @@ bootstrap_operation_build() { bootstrap_operation_build_validate_build - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then return 1 fi @@ -1405,7 +1405,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 @@ -1421,14 +1421,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}) @@ -1440,7 +1440,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 @@ -1452,7 +1452,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 @@ -1518,20 +1518,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 @@ -1539,13 +1539,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= @@ -1570,12 +1570,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 @@ -1653,12 +1653,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} @@ -1668,7 +1668,7 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} == "" && ${sources_program} != "" ]] ; then + if [[ ${failure} -eq 0 && ${sources_program} != "" ]] ; then sources= links= @@ -1693,12 +1693,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 @@ -1710,11 +1710,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() { @@ -2783,11 +2783,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() { @@ -2802,7 +2802,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 @@ -2812,11 +2812,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() { @@ -2849,11 +2849,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() { @@ -2954,11 +2954,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 5527ace..3df888a 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 @@ -441,18 +441,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() { @@ -727,7 +727,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}||") @@ -760,7 +760,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 @@ -794,7 +794,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}||") @@ -828,7 +828,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 @@ -862,7 +862,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}||") @@ -896,7 +896,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}||") @@ -929,7 +929,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}||") @@ -962,11 +962,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 844012f..41d2f41 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,89 +63,89 @@ 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 [[ ${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 == "+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" - elif [[ $operation_failure == "" ]] ; then + elif [[ ${operation} == "" ]] ; then + 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|/*$|/|') + path_build=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|') elif [[ $grab_next == "path_destination" ]] ; then - path_destination=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|') + path_destination=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|') elif [[ $grab_next == "path_sources" ]] ; then - path_sources=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|') + 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 # 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" @@ -840,14 +840,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}" @@ -857,7 +857,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}" @@ -875,12 +875,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}" @@ -890,7 +890,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}" @@ -908,66 +908,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}" @@ -978,21 +978,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}" @@ -1005,12 +1005,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}" @@ -1021,11 +1021,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}" @@ -1038,16 +1038,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() { @@ -1057,8 +1057,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}" @@ -1069,58 +1069,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() { @@ -1134,19 +1134,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() { @@ -1161,19 +1161,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}" @@ -1184,37 +1184,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}" @@ -1225,13 +1225,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}" @@ -1242,19 +1242,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}" @@ -1265,19 +1265,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}" @@ -1288,24 +1288,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 @@ -1317,117 +1317,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}" @@ -1438,29 +1438,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}" @@ -1477,15 +1477,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 @@ -1494,16 +1494,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 @@ -1512,16 +1512,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 @@ -1530,16 +1530,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 @@ -1548,20 +1548,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 @@ -1570,16 +1570,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'." @@ -1593,13 +1593,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 @@ -1607,10 +1607,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}" @@ -1625,10 +1625,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}" @@ -1639,10 +1639,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}" @@ -1655,10 +1655,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}" @@ -1669,10 +1669,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}" @@ -1685,10 +1685,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}" @@ -1696,13 +1696,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}" @@ -1715,10 +1715,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}" @@ -1729,10 +1729,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}" @@ -1761,12 +1761,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}" @@ -1774,13 +1774,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}" @@ -1788,7 +1788,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi @@ -1797,7 +1797,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}" @@ -1805,15 +1805,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}" @@ -1821,13 +1821,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}" @@ -1835,7 +1835,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi @@ -1844,7 +1844,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}" @@ -1852,17 +1852,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}" @@ -1870,13 +1870,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}" @@ -1884,7 +1884,7 @@ package_operation_create_config_stubs() { let failure=1 - return $failure + return ${failure} fi fi fi @@ -1902,14 +1902,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 @@ -1923,25 +1923,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}" @@ -1949,10 +1949,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}" @@ -1965,16 +1965,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() { @@ -1985,17 +1985,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}" @@ -2009,10 +2009,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}" @@ -2024,14 +2024,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}" @@ -2043,10 +2043,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}" @@ -2060,10 +2060,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}" @@ -2074,10 +2074,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}" @@ -2089,21 +2089,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() { @@ -2117,14 +2117,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}" @@ -2138,10 +2138,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}" @@ -2154,13 +2154,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}" @@ -2172,10 +2172,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}" @@ -2188,10 +2188,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}" @@ -2205,18 +2205,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}" @@ -2228,13 +2228,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 @@ -2242,10 +2242,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}" @@ -2257,10 +2257,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}" @@ -2272,10 +2272,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}" @@ -2285,11 +2285,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}" @@ -2299,11 +2299,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}" @@ -2313,11 +2313,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}" @@ -2327,11 +2327,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}" @@ -2343,10 +2343,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}" @@ -2358,10 +2358,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}" @@ -2374,17 +2374,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 @@ -2392,11 +2392,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() { @@ -2405,10 +2405,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}" @@ -2416,16 +2416,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}" @@ -2433,10 +2433,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}" @@ -2456,11 +2456,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() { @@ -2478,10 +2478,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}" @@ -2493,12 +2493,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}" @@ -2512,10 +2512,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}" @@ -2534,10 +2534,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}" @@ -2548,10 +2548,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}" @@ -2563,10 +2563,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}" @@ -2585,7 +2585,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 @@ -2593,10 +2593,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}" @@ -2608,10 +2608,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}" @@ -2623,20 +2623,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}" @@ -2651,8 +2651,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 @@ -2670,18 +2670,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}" @@ -2693,10 +2693,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}" @@ -2708,28 +2708,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= @@ -2738,11 +2738,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 @@ -2751,7 +2751,7 @@ package_print_first_or_always() { package_print_last() { - if [[ $print_line_last == "yes" ]] ; then + if [[ ${print_line_last} == "yes" ]] ; then echo fi }