Skip to content

Commit

Permalink
refactor: prefix functions with n2st namespace
Browse files Browse the repository at this point in the history
- Renamed functions to include the n2st namespace for consistency
- Updated script header and footer printing functions
- Aligned warning and error message functions for uniformity
- Ensured splash screen functions reflect new naming convention
  • Loading branch information
RedLeader962 committed Aug 14, 2024
1 parent b38ebf9 commit e9aae7a
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 73 deletions.
8 changes: 4 additions & 4 deletions build_system/lpm_utility_script/lpm_bashrc_config.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function lpm::configure_bashrc() {
source "${N2ST_PATH}/import_norlab_shell_script_tools_lib.bash"

# ====Begin======================================================================================
print_formated_script_header 'lpm_bashrc_config.bash' "${MSG_LINE_CHAR_UTIL}"
n2st::print_formated_script_header 'lpm_bashrc_config.bash' "${MSG_LINE_CHAR_UTIL}"


if [[ "$(basename ${LPM_PATH})" != "${NBS_REPOSITORY_NAME}" ]]; then
print_msg_error_and_exit "Can't find directory ${MSG_DIMMED_FORMAT}${NBS_REPOSITORY_NAME}${MSG_END_FORMAT}"
n2st::print_msg_error_and_exit "Can't find directory ${MSG_DIMMED_FORMAT}${NBS_REPOSITORY_NAME}${MSG_END_FORMAT}"
fi


Expand All @@ -47,9 +47,9 @@ function lpm::configure_bashrc() {
# echo "alias lpm_attach='cd $DN_PATH && bash dn_attach.bash'"
fi

print_msg_done "New aliases with prefix 'lpm' added to .bashrc"
n2st::print_msg_done "New aliases with prefix 'lpm' added to .bashrc"

print_formated_script_footer 'lpm_bashrc_config.bash' "${MSG_LINE_CHAR_UTIL}"
n2st::print_formated_script_footer 'lpm_bashrc_config.bash' "${MSG_LINE_CHAR_UTIL}"

# ====Teardown===================================================================================
cd "${TMP_CWD}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ set -o allexport && source ./build_system/.env && set +o allexport
source "./build_system/utilities/norlab-shell-script-tools/import_norlab_shell_script_tools_lib.bash"

# ====Begin========================================================================================
print_formated_script_header 'build_and_run_IamBuildSystemTester.bash' "${MSG_LINE_CHAR_TEST}"
n2st::print_formated_script_header 'build_and_run_IamBuildSystemTester.bash' "${MSG_LINE_CHAR_TEST}"

# ....Build image..................................................................................
echo
print_msg "Building 'lpm.ubuntu20.buildsystem.test'"
n2st::print_msg "Building 'lpm.ubuntu20.buildsystem.test'"
# Note: Build context must be at repository root

pwd
tree -L 1 -a

show_and_execute_docker "build -f build_system/tests/tests_docker_interactive/Dockerfile.build_system_test -t lpm.ubuntu20.buildsystem.test ."
n2st::show_and_execute_docker "build -f build_system/tests/tests_docker_interactive/Dockerfile.build_system_test -t lpm.ubuntu20.buildsystem.test ."
#--no-cache

# ....Run container................................................................................
print_msg "Starting 'IamBuildSystemTester'"
n2st::print_msg "Starting 'IamBuildSystemTester'"

if [[ -n ${DOCKER_CMD_ARGS} ]]; then
print_msg "Passing command ${MSG_DIMMED_FORMAT}\"${DOCKER_CMD_ARGS}\"${MSG_END_FORMAT} to docker run"
n2st::print_msg "Passing command ${MSG_DIMMED_FORMAT}\"${DOCKER_CMD_ARGS}\"${MSG_END_FORMAT} to docker run"
fi

show_and_execute_docker "run --name IamBuildSystemTester -it --rm lpm.ubuntu20.buildsystem.test ${DOCKER_CMD_ARGS}"
n2st::show_and_execute_docker "run --name IamBuildSystemTester -it --rm lpm.ubuntu20.buildsystem.test ${DOCKER_CMD_ARGS}"

print_formated_script_footer 'build_and_run_IamBuildSystemTester.bash' "${MSG_LINE_CHAR_TEST}"
n2st::print_formated_script_footer 'build_and_run_IamBuildSystemTester.bash' "${MSG_LINE_CHAR_TEST}"
# ====Teardown=====================================================================================
cd "${TMP_CWD}"
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build"
if [[ -d ./utest ]]; then
source "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash"
else
print_msg_warning "Directory ${MSG_DIMMED_FORMAT}utest/${MSG_END_FORMAT} was not created during compilation.
n2st::print_msg_warning "Directory ${MSG_DIMMED_FORMAT}utest/${MSG_END_FORMAT} was not created during compilation.
Skipping Libpointmatcher unit-test."
fi

Expand Down
10 changes: 5 additions & 5 deletions build_system/ubuntu/lpm_execute_libpointmatcher_unittest.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ N2ST_PATH=${N2ST_PATH:-"${LPM_PATH}/build_system/utilities/norlab-shell-script-t
source "${N2ST_PATH}/import_norlab_shell_script_tools_lib.bash"

# ====Begin========================================================================================
print_formated_script_header 'lpm_execute_libpointmatcher_unittest.bash' ':'
n2st::print_formated_script_header 'lpm_execute_libpointmatcher_unittest.bash' ':'

cd "${NBS_LIB_INSTALL_PATH}/${NBS_REPOSITORY_NAME}/build"

if [[ ${IS_TEAMCITY_RUN} == true ]] || [[ ${TEAMCITY_VERSION} ]]; then
echo -e "##teamcity[testSuiteStarted name='gtest']"
echo -e "##teamcity[testStarted name='gtest' captureStandardOutput='true']"
else
print_msg "Starting Libpointmatcher GoogleTest unit-test"
n2st::print_msg "Starting Libpointmatcher GoogleTest unit-test"
fi

# .................................................................................................
Expand All @@ -59,14 +59,14 @@ if [[ ${IS_TEAMCITY_RUN} == true ]] || [[ ${TEAMCITY_VERSION} ]]; then
else

if [[ ${UTEST_EXIT_CODE} == 0 ]]; then
print_msg_done "${SUCCESS_MSG}"
n2st::print_msg_done "${SUCCESS_MSG}"
else
print_msg_error "${FAILURE_MSG}"
n2st::print_msg_error "${FAILURE_MSG}"
fi

fi

print_formated_script_footer 'lpm_execute_libpointmatcher_unittest.bash' ':'
n2st::print_formated_script_footer 'lpm_execute_libpointmatcher_unittest.bash' ':'
# ====Teardown=====================================================================================
cd "${TMP_CWD}"
exit $UTEST_EXIT_CODE
26 changes: 13 additions & 13 deletions build_system/ubuntu/lpm_install_dependencies_general_ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ cd "${N2ST_PATH}"/src/utility_scripts/ && source "which_architecture_and_os.bash
SHOW_SPLASH_IDU="${SHOW_SPLASH_IDU:-true}"

if [[ "${SHOW_SPLASH_IDU}" == 'true' ]]; then
norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
n2st::norlab_splash "${NBS_SPLASH_NAME}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
fi

print_formated_script_header "lpm_install_dependencies_general_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"
n2st::print_formated_script_header "lpm_install_dependencies_general_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"

# ....Script command line flags....................................................................
while [ $# -gt 0 ]; do
Expand All @@ -66,7 +66,7 @@ done


# .................................................................................................
teamcity_service_msg_blockOpened "Install development utilities"
n2st::teamcity_service_msg_blockOpened "Install development utilities"

sudo apt-get update &&
sudo apt-get install --assume-yes \
Expand All @@ -87,49 +87,49 @@ sudo apt-get update &&

##cmake --version

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed
# .................................................................................................

# (Priority) ToDo: add check to see if executed in a docker container. Current check does not do what its intended
if [[ ${IS_TEAMCITY_RUN} == true ]]; then
print_msg "The install script is run in teamCity >> the python install step was executed earlier in the Dockerfile.dependencies"
n2st::print_msg "The install script is run in teamCity >> the python install step was executed earlier in the Dockerfile.dependencies"
else
print_msg "The install script is executed in stand alone mode"
n2st::print_msg "The install script is executed in stand alone mode"
cd "${NBS_PATH:?err}/src/utility_scripts" || exit 1
bash "./nbs_install_python_dev_tools.bash"
fi

# .................................................................................................
teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Boost"
n2st::teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Boost"
# https://www.boost.org/doc/libs/1_79_0/more/getting_started/unix-variants.html

sudo apt-get update &&
sudo apt-get install --assume-yes "${APT_FLAGS[@]}" \
libboost-all-dev &&
sudo rm -rf /var/lib/apt/lists/*

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed
# .................................................................................................
teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Eigen"
n2st::teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Eigen"
# https://eigen.tuxfamily.org/index.php

sudo apt-get update &&
sudo apt-get install --assume-yes "${APT_FLAGS[@]}" \
libeigen3-dev &&
sudo rm -rf /var/lib/apt/lists/*

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed
# .................................................................................................
teamcity_service_msg_blockOpened "Install Libpointmatcher dev tools"
n2st::teamcity_service_msg_blockOpened "Install Libpointmatcher dev tools"

sudo apt-get update &&
sudo apt-get install --assume-yes "${APT_FLAGS[@]}" \
libyaml-cpp-dev &&
sudo rm -rf /var/lib/apt/lists/*

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed


print_formated_script_footer "lpm_install_dependencies_general_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"
n2st::print_formated_script_footer "lpm_install_dependencies_general_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"
# ====Teardown=====================================================================================
cd "${TMP_CWD}"
22 changes: 11 additions & 11 deletions build_system/ubuntu/lpm_install_dependencies_libnabo_ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ cd "${N2ST_PATH}"/src/utility_scripts/ && source "which_architecture_and_os.bash
SHOW_SPLASH_IDU="${SHOW_SPLASH_IDU:-true}"

if [[ "${SHOW_SPLASH_IDU}" == 'true' ]]; then
norlab_splash "${NBS_SPLASH_NAME:?err}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
n2st::norlab_splash "${NBS_SPLASH_NAME:?err}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
fi

print_formated_script_header "lpm_install_dependencies_libnabo_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"
n2st::print_formated_script_header "lpm_install_dependencies_libnabo_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"


# ....Script command line flags....................................................................
Expand Down Expand Up @@ -77,7 +77,7 @@ done
CMAKE_FLAGS=( -D CMAKE_BUILD_TYPE=RelWithDebInfo "${APPEND_TO_CMAKE_FLAG[@]}" )

# .................................................................................................
teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Libnabo"
n2st::teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Libnabo"
# https://github.com/norlab-ulaval/libnabo

## Note:
Expand Down Expand Up @@ -108,7 +108,7 @@ teamcity_service_msg_blockOpened "Install Libpointmatcher dependencies › Libna
# && sudo rm -rf /var/lib/apt/lists/*

# ....Repository cloning step......................................................................
print_msg "Create required dir structure"
n2st::print_msg "Create required dir structure"
mkdir -p "${NBS_LIB_INSTALL_PATH}"

cd "${NBS_LIB_INSTALL_PATH}"
Expand All @@ -119,14 +119,14 @@ git clone https://github.com/norlab-ulaval/libnabo.git &&
# git checkout 1.0.7

# ....Cmake install step...........................................................................
teamcity_service_msg_compilationStarted "cmake"
n2st::teamcity_service_msg_compilationStarted "cmake"

print_msg "Execute ${MSG_DIMMED_FORMAT}
n2st::print_msg "Execute ${MSG_DIMMED_FORMAT}
cmake ${CMAKE_FLAGS[*]} ${NBS_LIB_INSTALL_PATH}/libnabo
${MSG_END_FORMAT}"

if [[ $TEST_RUN == true ]]; then
print_msg "Test-run mode: Skipping cmake"
n2st::print_msg "Test-run mode: Skipping cmake"
BUILD_EXIT_CODE=0
INSTALL_EXIT_CODE=0
else
Expand All @@ -140,12 +140,12 @@ else
# make -j $(nproc) && make test && sudo make install
fi

teamcity_service_msg_compilationFinished
n2st::teamcity_service_msg_compilationFinished

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed

echo " " && print_msg_done "Libpointmatcher dependencies installed"
print_formated_script_footer "lpm_install_dependencies_libnabo_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"
echo " " && n2st::print_msg_done "Libpointmatcher dependencies installed"
n2st::print_formated_script_footer "lpm_install_dependencies_libnabo_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"

# ====Teardown=====================================================================================
cd "${TMP_CWD}"
12 changes: 6 additions & 6 deletions build_system/ubuntu/lpm_install_doc_dependencies_ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ cd "${N2ST_PATH}"/src/utility_scripts/ && source "which_architecture_and_os.bash
SHOW_SPLASH_IDDU="${SHOW_SPLASH_IDDU:-true}"

if [[ "${SHOW_SPLASH_IDDU}" == 'true' ]]; then
norlab_splash "${NBS_SPLASH_NAME:?err}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
n2st::norlab_splash "${NBS_SPLASH_NAME:?err}" "https://github.com/${NBS_REPOSITORY_DOMAIN:?err}/${NBS_REPOSITORY_NAME:?err}"
fi

print_formated_script_header "lpm_install_doc_dependencies_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"
n2st::print_formated_script_header "lpm_install_doc_dependencies_ubuntu.bash (${IMAGE_ARCH_AND_OS:?err})" "${MSG_LINE_CHAR_INSTALLER}"

# ....Script command line flags....................................................................
while [ $# -gt 0 ]; do
Expand All @@ -74,7 +74,7 @@ done


# .................................................................................................
teamcity_service_msg_blockOpened "Install libpointmatcher documentation related dependencies"
n2st::teamcity_service_msg_blockOpened "Install libpointmatcher documentation related dependencies"

## Package required when GENERATE_API_DOC flag is set to true
## Note: 'texlive-full' is ~6GB. 'doxygen-latex' is a slim version tailor made for doxygen code documentation task
Expand All @@ -84,10 +84,10 @@ sudo apt-get update \
doxygen-latex \
&& sudo rm -rf /var/lib/apt/lists/*

teamcity_service_msg_blockClosed
n2st::teamcity_service_msg_blockClosed

echo " " && print_msg_done "Libpointmatcher documentation related dependencies installed"
print_formated_script_footer "lpm_install_doc_dependencies_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"
echo " " && n2st::print_msg_done "Libpointmatcher documentation related dependencies installed"
n2st::print_formated_script_footer "lpm_install_doc_dependencies_ubuntu.bash (${IMAGE_ARCH_AND_OS})" "${MSG_LINE_CHAR_INSTALLER}"
# ====Teardown=====================================================================================
cd "${TMP_CWD}"

Loading

0 comments on commit e9aae7a

Please sign in to comment.