xbps-src: added 'clean' target to remove pkg build directory.

This commit is contained in:
Juan RP 2010-05-20 04:05:35 +02:00
parent db16467721
commit c785787fdd
3 changed files with 21 additions and 2 deletions

View file

@ -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
}

View file

@ -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

View file

@ -77,6 +77,7 @@ Targets:
checkvers Checks installed package versions against srcpkgs
for new available versions.
chroot Enter to the chroot in <masterdir>.
clean Remove <pkg> 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)."