diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index bf04dc5..da7c040 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -1290,7 +1290,9 @@ _build_module() { # # FIXME: Can it happen, that we remove module-/config-files which # we shouldn't remove? - # For now we exclude removing from the overlay 'base' only. + # For now we exclude removing from the overlay 'base' only + # This function is only called if the option '--cleanup-modulefiles' + # was specified. # [[ "${is_subpkg}" == 'yes' ]] && return 0 local ol='' @@ -1612,7 +1614,9 @@ _build_module() { bm::build_sub_packages "${ModuleConfig['sub_packages']}" fi - bm::cleanup_modulefiles + if [[ "${opt_cleanup_modulefiles}" == 'yes' ]]; then + bm::cleanup_modulefiles + fi std::info \ "\n%s\n%s" \ "${module_name}/${module_version}: done" \ diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index a6ca44a..e96a4e4 100644 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -80,6 +80,9 @@ BUILD-STEPS OPTIONS: --update-modulefiles Only install the modulefile and set the release. +--cleanup-modulefiles + Remove modulefiles in other overlays. + MISCELLANEOUS OPTIONS: -? | -h | --help @@ -144,6 +147,7 @@ declare opt_enable_cleanup_src='yes' declare opt_force_rebuild='no' declare -i opt_jobs=0 declare opt_update_modulefiles='no' +declare opt_cleanup_modulefiles='no' declare opt_system='' declare opt_verbose='no' # array collecting all modules specified on the command line via '--with=module' @@ -266,6 +270,9 @@ parse_args() { --update-modulefiles ) opt_update_modulefiles='yes' ;; + --cleanup-modulefiles ) + opt_cleanup_modulefiles='yes' + ;; --config-file | --config-file=* ) if [[ $1 == *=* ]]; then opt_config_file=( "${1#--*=}" )