From c785787fdd8e84b616920c0eeca61240c94740ec Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 20 May 2010 04:05:35 +0200 Subject: [PATCH] xbps-src: added 'clean' target to remove pkg build directory. --- xbps-src/libexec/xbps-src-doinst-helper.sh.in | 3 +-- xbps-src/shutils/tmpl_funcs.sh.in | 13 +++++++++++++ xbps-src/xbps-src.sh.in | 7 +++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/xbps-src/libexec/xbps-src-doinst-helper.sh.in b/xbps-src/libexec/xbps-src-doinst-helper.sh.in index 1ad86ad2ed..33faeec34f 100644 --- a/xbps-src/libexec/xbps-src-doinst-helper.sh.in +++ b/xbps-src/libexec/xbps-src-doinst-helper.sh.in @@ -209,8 +209,7 @@ install_src_phase() # Remove $wrksrc if -C not specified. # if [ -d "$saved_wrksrc" -a "$dontrm_builddir" = "no" ]; then - rm -rf $saved_wrksrc && \ - msg_normal "Package '$sourcepkg ($lver)': removed build directory." + remove_tmpl_wrksrc $saved_wrksrc fi } diff --git a/xbps-src/shutils/tmpl_funcs.sh.in b/xbps-src/shutils/tmpl_funcs.sh.in index f98f2687df..4978da437c 100644 --- a/xbps-src/shutils/tmpl_funcs.sh.in +++ b/xbps-src/shutils/tmpl_funcs.sh.in @@ -252,6 +252,19 @@ prepare_tmpl() fi } +remove_tmpl_wrksrc() +{ + local lwrksrc="$1" + + if [ -z "$lwrksrc" -o ! -d "$lwrksrc" ]; then + return 1 + fi + + msg_normal "Cleaning '$pkgname' build directory... " + rm -rf $lwrksrc + return $? +} + set_tmpl_common_vars() { [ -z "$pkgname" ] && return 1 diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index c038834597..5f4b88df20 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -77,6 +77,7 @@ Targets: checkvers Checks installed package versions against srcpkgs for new available versions. chroot Enter to the chroot in . + clean Remove build directory. configure Configure a package (fetch + extract + configure). extract Extract distribution file(s) into build directory. Build directory is always available in @@ -312,6 +313,12 @@ chroot) . $XBPS_SHUTILSDIR/chroot.sh xbps_chroot_handler chroot dummy ;; +clean) + . $XBPS_SHUTILSDIR/tmpl_funcs.sh + [ ! -r ./template ] && msg_error "missing build template in $(pwd)." + setup_tmpl $(basename_cwd) + remove_tmpl_wrksrc $wrksrc + ;; extract|fetch|info) . $XBPS_SHUTILSDIR/tmpl_funcs.sh [ ! -r ./template ] && msg_error "missing build template in $(pwd)."