libpbuild: improve test whether a module exist or not

This commit is contained in:
2021-04-19 15:45:06 +02:00
parent c8d2e065aa
commit 837bf74522
+3 -14
View File
@@ -1142,8 +1142,9 @@ pbuild::make_all() {
check_supported_os
check_supported_compilers
set_full_module_name_and_prefix
if module_exists "${module_name}/${module_version}" \
&& [[ ${forece_rebuild} != 'yes' ]]; then
if [[ -e "${modulefile_name}" ]] \
&& [[ -d ${PREFIX} ]] \
&& [[ ${force_rebuild} != 'yes' ]]; then
if [[ "${module_release}" == 'removed' ]]; then
remove_module
else
@@ -1260,18 +1261,6 @@ pbuild.init_env() {
configure_with='undef'
}
#..............................................................
#
# Test whether a module with the given name already exists.
#
# Arguments:
# $1: module name/version
#
module_exists() {
[[ -n $("${MODULECMD}" bash avail -m "$1" \
2>&1 1>/dev/null) ]]
}
pbuild.build_module() {
module_name="$1"
module_version="$2"