shutils: return proper error in {do,pre,post}_* stage funcs and use msg_error.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091012220713-k3j00b7x3jk5s3we
This commit is contained in:
Juan RP 2009-10-13 00:07:13 +02:00
parent cf7b3caebe
commit 9296d25811
4 changed files with 16 additions and 18 deletions

View File

@ -58,7 +58,7 @@ build_src_phase()
[ -z "$make_cmd" ] && make_cmd=/usr/bin/make
# Run pre_build func.
run_func pre_build
run_func pre_build || msg_error "pre_build stage failed!"
[ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ] && \
makejobs="-j$XBPS_MAKEJOBS"
@ -80,7 +80,7 @@ build_src_phase()
[ $? -ne 0 ] && msg_error "building $pkg (build phase)."
# Run post_build func.
run_func post_build
run_func post_build || msg_error "post_build stage failed!"
unset makejobs

View File

@ -33,7 +33,10 @@ run_func()
[ -z "$func" ] && return 1
type -t $func | grep -q 'function'
[ $? -eq 0 ] && $func
if [ $? -eq 0 ]; then
$func
return $?
fi
}
run_rootcmd()

View File

@ -62,7 +62,7 @@ configure_src_phase()
fi
# Run pre_configure func.
run_func pre_configure
run_func pre_configure || msg_error "pre_configure stage failed!"
# Export configure_env vars.
for f in ${configure_env}; do
@ -124,7 +124,7 @@ configure_src_phase()
fi
# Run post_configure func.
run_func post_configure
run_func post_configure || msg_error "post_configure stage failed!"
# unset configure_env vars.
for f in ${configure_env}; do

View File

@ -49,12 +49,10 @@ install_src_phase()
return 0
fi
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]"
cd $wrksrc || exit 1
cd $wrksrc || msg_error "can't change cwd to wrksrc!"
# Run pre_install func.
run_func pre_install
run_func pre_install || msg_error "pre_install stage failed!"
msg_normal "Running install phase for $pkgname-$lver."
@ -65,13 +63,13 @@ install_src_phase()
fi
if [ "$build_style" = "custom-install" ]; then
run_func do_install
run_func do_install || msg_error "do_install stage failed!"
else
make_install $lver
fi
# Run post_install func.
run_func post_install
run_func post_install || msg_error "post_install stage failed!"
# Remove libtool archives from pkg destdir.
if [ -z "$libtool_no_delete_archives" ]; then
@ -110,7 +108,8 @@ install_src_phase()
. $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template
pkgname=${sourcepkg}-${subpkg}
set_tmpl_common_vars
run_func do_install
run_func do_install || \
msg_error "$pkgname do_install stage failed!"
run_template ${sourcepkg}
[ "$pkg" = "${sourcepkg}-${subpkg}" ] && break
done
@ -120,8 +119,7 @@ install_src_phase()
# Remove $wrksrc if -C not specified.
#
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
rm -rf $wrksrc
[ $? -eq 0 ] && \
rm -rf $wrksrc && \
msg_normal "Removed $pkgname-$lver build directory."
fi
}
@ -147,10 +145,7 @@ make_install()
# Install package via make.
#
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args}
if [ "$?" -ne 0 ]; then
msg_error "installing $pkgname-$lver."
exit 1
fi
[ $? -ne 0 ] && msg_error "installing $pkgname-$lver."
# Replace libtool archives if requested.
if [ -z "$in_chroot" ]; then