xbps-src: propagate error returned by xbps-src in the chroot.

Rather than pointing the user to cat the .log file, just cat it before exiting.
This commit is contained in:
Juan RP 2010-05-09 19:46:28 +02:00
parent e514b75180
commit 81d6978f02
5 changed files with 73 additions and 32 deletions

View File

@ -91,8 +91,12 @@ install_src_phase()
set_build_vars
# Run pre_install func.
run_func pre_install 2>${wrksrc}/.xbps_pre_install.log \
|| msg_error "$pkgname: pre_install() failed! check $wrksrc/.xbps_pre_install.log"
run_func pre_install 2>${wrksrc}/.xbps_pre_install.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: pre_install() failed:"
cat $wrksrc/.xbps_pre_install.log
exit 1
fi
msg_normal "Running install phase for $pkgname-$lver."
@ -114,9 +118,12 @@ install_src_phase()
cd ${wrksrc} || msg_error "can't change cwd to wrksrc!"
# Run post_install func.
run_func post_install 2>${wrksrc}/.xbps_post_install.log \
|| msg_error "$pkgname: post_install() failed! check $wrksrc/.xbps_post_install.log"
run_func post_install 2>${wrksrc}/.xbps_post_install.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: post_install() failed:"
cat ${wrksrc}/.xbps_post_install.log
exit 1
fi
unset_build_vars
# Remove libtool archives by default.
@ -163,9 +170,12 @@ install_src_phase()
pkgname=${subpkg}
set_tmpl_common_vars
set_build_vars
run_func do_install \
2>${wrksrc}/.xbps_do_install_${pkgname}.log || \
msg_error "$pkgname: do_install() failed! check $wrksrc/.xbps_do_install_$pkgname.log"
run_func do_install 2>${wrksrc}/.xbps_do_install_${pkgname}.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: do_install() failed:"
cat ${wrksrc}/.xbps_do_install_${pkgname}.log
exit 1
fi
unset_build_vars
done
@ -196,9 +206,8 @@ make_install()
#
# Install package via make.
#
{ ${make_cmd} ${make_install_target} ${make_install_args} \
2>&1 | tee $wrksrc/.xbps_make_install.log; } \
|| msg_error "$pkgname: make install failed! check $wrksrc/.xbps_make_install.log"
${make_cmd} ${make_install_target} ${make_install_args} \
|| msg_error "$pkgname: make install failed!"
}
[ -z "$PKG_TMPLNAME" ] && exit 1

View File

@ -57,8 +57,12 @@ build_src_phase()
makejobs="-j$XBPS_MAKEJOBS"
fi
# Run pre_build func.
run_func pre_build 2>${wrksrc}/.xbps_pre_build.log \
|| msg_error "$pkgname: pre_build() failed! check $wrksrc/.xbps_pre_build.log"
run_func pre_build 2>${wrksrc}/.xbps_pre_build.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: pre_build() failed:"
cat $wrksrc/.xbps_pre_build.log
exit 1
fi
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
set_build_vars
@ -78,8 +82,12 @@ build_src_phase()
fi
# Run post_build func.
run_func post_build 2>${wrksrc}/.xbps_post_build.log \
|| msg_error "$pkgname: post_build() failed! check $wrksrc/.xbps_post_build.log"
run_func post_build 2>${wrksrc}/.xbps_post_build.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: post_build() failed:"
cat $wrksrc/.xbps_post_build.log
exit 1
fi
unset makejobs

View File

@ -214,6 +214,20 @@ install_xbps_utils()
fi
}
_mount()
{
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount
return $?
}
_umount()
{
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
return $?
}
xbps_chroot_handler()
{
local action="$1"
@ -237,9 +251,7 @@ xbps_chroot_handler()
create_busybox_links
install_xbps_utils
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount
[ $? -ne 0 ] && return $?
_mount || return $?
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
prepare_binpkg_repos
@ -248,26 +260,26 @@ xbps_chroot_handler()
# Reinstall xbps-src in the chroot
if [ ! -f $XBPS_MASTERDIR/usr/local/sbin/xbps-src ]; then
msg_normal "Installing xbps-src in the masterdir..."
{ env in_chroot=yes LANG=C PATH=$path \
env in_chroot=yes LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/xbps-src && make IN_CHROOT=1 install clean" \
2>&1 >/dev/null; }
2>&1 >/dev/null || return $?
fi
if [ "$action" = "chroot" ]; then
{ env in_chroot=yes IN_CHROOT=1 LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR /bin/sh; }
env in_chroot=yes IN_CHROOT=1 LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR /bin/sh || return $?
else
[ "$norm_builddir" = "yes" ] && \
action="-C $action"
{ env in_chroot=yes LANG=C PATH=$path \
env in_chroot=yes LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action"; }
"cd /xbps/srcpkgs/$pkg && xbps-src $action" || \
rv=$? && _umount && return $rv
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
_umount
return $?
}

View File

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008-2009 Juan Romero Pardines.
# Copyright (c) 2008-2010 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@ run_func()
fi
}
msg_error()
msg_red()
{
[ -z "$1" ] && return 1
@ -50,7 +50,11 @@ msg_error()
echo "=> ERROR: $1"
fi
printf "\033[m"
}
msg_error()
{
msg_red "$@"
exit 1
}

View File

@ -58,8 +58,12 @@ configure_src_phase()
cd $wrksrc || msg_error "unexistent build directory [$wrksrc]."
# Run pre_configure func.
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log \
|| msg_error "$pkgname: pre_configure() failed! check $wrksrc/.xbps_pre_configure.log"
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: pre_configure() failed:"
cat $wrksrc/.xbps_pre_configure.log
exit 1
fi
# Export configure_env vars.
for f in ${configure_env}; do
@ -115,8 +119,12 @@ configure_src_phase()
fi
# Run post_configure func.
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log \
|| msg_error "$pkgname: post_configure() failed! check $wrksrc/.xbps_post_configure.log"
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log
if [ $? -ne 0 ]; then
msg_red "$pkgname: post_configure() failed:"
cat $wrksrc/.xbps_post_configure.log
exit 1
fi
# unset configure_env vars.
for f in ${configure_env}; do