From 0ffdf599a15eedcd06dc2e0db2d89faff6a9cd16 Mon Sep 17 00:00:00 2001 From: gsell Date: Fri, 22 Mar 2024 15:35:01 +0100 Subject: [PATCH] Resolve "modbuild: cleanup source and build directory before and after building" --- CHANGELOG.md | 2 ++ Pmodules/libpbuild.bash | 6 ++++-- Pmodules/modbuild.in | 25 ++++--------------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 836bf1b..db2b8e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ (issue #236) * BUGFIX: writing list of 'systems' to module configuration file fixed (issue #235) +* CHANGE: files in `$PMODULES_TMPDIR/` are now removed before + and after building a module (except cleanup has been disbaled). ### Toolchain * update to Tcl 8.6.14 (issue #239) diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index b345f58..6857c5d 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -1570,7 +1570,7 @@ _build_module() { } cleanup_build() { - [[ ${enable_cleanup_build} == yes ]] || return 0 + [[ ${enable_cleanup_build} != 'yes' ]] && return 0 [[ "${BUILD_DIR}" == "${SRC_DIR}" ]] && return 0 { cd "/${BUILD_DIR}/.." || std::die 42 "Internal error" @@ -1590,7 +1590,7 @@ _build_module() { } cleanup_src() { - [[ ${enable_cleanup_src} == yes ]] || return 0 + [[ ${enable_cleanup_src} != 'yes' ]] && return 0 { cd "/${SRC_DIR}/.." || std::die 42 "Internal error" [[ $(pwd) == / ]] && \ @@ -1799,6 +1799,8 @@ _build_module() { "%s " \ "${module_name}/${module_version}:" \ "start building ..." + cleanup_build + cleanup_src compile_and_install post_install fi diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 3058ee6..8262924 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -129,19 +129,12 @@ MISCELLANEOUS OPTIONS: Dry run. --disable-cleanup-build ---enable-cleanup-build - Cleanup files in the build directory. Default is to remove. - all files in the build-directory. - --disable-cleanup-src ---enable-cleanup-src - Cleanup files in the source directory. Default is to - remove all files in the source directory. - --disable-cleanup ---enable-cleanup - Cleanup all files in temporary directory. Default is to - remove all files created during building. + Disable the cleanup of files in the build and/or source + directory. Default is to remove all files in the build + respective source directory at the beginning of a build + and after a successful build. --distdir Directory where to store and lookup downloaded files. @@ -237,23 +230,13 @@ parse_args() { --dry-run ) opt_dry_run='yes' ;; - --enable-cleanup ) - opt_enable_cleanup_build='yes' - opt_enable_cleanup_src='yes' - ;; --disable-cleanup ) opt_enable_cleanup_build='no' opt_enable_cleanup_src='no' ;; - --enable-cleanup-build ) - opt_enable_cleanup_build='yes' - ;; --disable-cleanup-build ) opt_enable_cleanup_build='no' ;; - --enable-cleanup-src ) - opt_enable_cleanup_src='yes' - ;; --disable-cleanup-src ) opt_enable_cleanup_src='no' ;;