xbps-src: always create logs for configure/build/install stages in $wrksrc.

Fixed -C and install-destdir in the chroot, $# wasn't consistent :-)
This commit is contained in:
Juan RP 2010-05-07 12:25:24 +02:00
parent 9615930eb4
commit 22774084ab
7 changed files with 62 additions and 56 deletions

View File

@ -90,7 +90,7 @@ install_src_phase()
# Run pre_install func.
run_func pre_install 2>${wrksrc}/.xbps_pre_install.log \
|| msg_error "pre_install stage failed!"
|| msg_error "$pkgname: pre_install() failed! check $wrksrc/.xbps_pre_install.log"
msg_normal "Running install phase for $pkgname-$lver."
@ -98,12 +98,12 @@ install_src_phase()
case "$build_style" in
custom-install)
run_func do_install 2>${wrksrc}/.xbps_do_install.log \
|| msg_error "do_install stage failed!"
|| msg_error "$pkgname: do_install() failed! check $wrksrc/.xbps_do_install.log"
;;
python-module)
. $XBPS_HELPERSDIR/python-module.sh
run_func do_install 2>${wrksrc}/.xbps_do_install.log \
|| msg_error "python module install failed!"
|| msg_error "$pkgname: install failed! check $wrksrc/.xbps_do_install.log"
;;
*)
make_install $lver 2>${wrksrc}/.xbps_make_install.log
@ -113,7 +113,7 @@ install_src_phase()
# Run post_install func.
run_func post_install 2>${wrksrc}/.xbps_post_install.log \
|| msg_error "post_install stage failed!"
|| msg_error "$pkgname: post_install() failed! check $wrksrc/.xbps_post_install.log"
# Remove libtool archives by default.
if [ -z "$keep_libtool_archives" ]; then
@ -160,13 +160,13 @@ install_src_phase()
set_tmpl_common_vars
run_func do_install \
2>${wrksrc}/.xbps_do_install_${pkgname}.log || \
msg_error "$pkgname do_install stage failed!"
msg_error "$pkgname: do_install() failed! check $wrksrc/.xbps_do_install_$pkgname.log"
done
#
# Remove $wrksrc if -C not specified.
#
if [ -d "$saved_wrksrc" -a -z "$dontrm_builddir" ]; then
if [ -d "$saved_wrksrc" -a "$dontrm_builddir" = "no" ]; then
rm -rf $saved_wrksrc && \
msg_normal "Removed $sourcepkg-$lver build directory."
fi
@ -192,8 +192,9 @@ make_install()
#
# Install package via make.
#
${make_cmd} ${make_install_target} \
${make_install_args} || msg_error "installing $pkgname-$lver"
{ ${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"
# Unset build vars.
unset_build_vars

View File

@ -58,7 +58,7 @@ build_src_phase()
fi
# Run pre_build func.
run_func pre_build 2>${wrksrc}/.xbps_pre_build.log \
|| msg_error "pre_build stage failed!"
|| msg_error "$pkgname: pre_build() failed! check $wrksrc/.xbps_pre_build.log"
. $XBPS_SHUTILSDIR/buildvars_funcs.sh
set_build_vars
@ -72,14 +72,15 @@ build_src_phase()
#
# Build package via make.
#
${make_cmd} ${makejobs} ${make_build_args} \
${make_build_target} 2>${wrksrc}/.xbps_make_build.log
[ $? -ne 0 ] && msg_error "building $pkg (build phase)."
{ ${make_cmd} ${makejobs} ${make_build_args} \
${make_build_target} \
2>&1 | tee ${wrksrc}/.xbps_make_build.log; } || \
msg_error "$pkgname: build phase failed! check $wrksrc/.xbps_make_build.log"
fi
# Run post_build func.
run_func post_build 2>${wrksrc}/.xbps_post_build.log \
|| msg_error "post_build stage failed!"
|| msg_error "$pkgname: post_build() failed! check $wrksrc/.xbps_post_build.log"
unset makejobs

View File

@ -218,13 +218,14 @@ xbps_chroot_handler()
{
local action="$1"
local pkg="$2"
local only_destdir="$3"
local norm_builddir="$4"
local norm_builddir="$3"
local path="/tools/bin:/usr/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
[ -z "$action" -o -z "$pkg" ] && return 1
[ "$action" != "configure" -a "$action" != "build" -a \
"$action" != "install" -a "$action" != "chroot" ] && return 1
"$action" != "install" -a "$action" != "chroot" -a \
"$action" != "install-destdir" ] && return 1
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
echo -n "==> Preparing chroot on $XBPS_MASTERDIR... "
@ -236,8 +237,8 @@ xbps_chroot_handler()
create_busybox_links
install_xbps_utils
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount
{ MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount; }
[ $? -ne 0 ] && return $?
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
@ -247,29 +248,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; }
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; }
else
local lenv
[ -n "$only_destdir" ] && \
lenv="install_destdir_target=yes"
[ -n "$norm_builddir" ] && \
[ "$norm_builddir" = "yes" ] && \
action="-C $action"
env in_chroot=yes LANG=C PATH=$path \
${lenv} ${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action"
{ env in_chroot=yes LANG=C PATH=$path \
${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action"; }
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
{ MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount; }
return $?
}

View File

@ -59,7 +59,7 @@ configure_src_phase()
# Run pre_configure func.
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log \
|| msg_error "pre_configure stage failed!"
|| msg_error "$pkgname: pre_configure() failed! check $wrksrc/.xbps_pre_configure.log"
# Export configure_env vars.
for f in ${configure_env}; do
@ -83,9 +83,11 @@ configure_src_phase()
#
# Packages using GNU autoconf
#
${configure_script} --prefix=/usr --sysconfdir=/etc \
{ ${configure_script} --prefix=/usr --sysconfdir=/etc \
--infodir=/usr/share/info --mandir=/usr/share/man \
${configure_args}
${configure_args} 2>&1 \
| tee ${wrksrc}/.xbps_configure.log; } || \
msg_error "$pkgname: configure failed! check ${wrksrc}/.xbps_configure.log"
;;
configure)
#
@ -99,7 +101,8 @@ configure_src_phase()
# They are all handled by the helper perl-module.sh.
#
. $XBPS_HELPERSDIR/perl-module.sh
perl_module_build $pkgname
{ perl_module_build $pkgname; } \
2>&1 | tee ${wrksrc}/.xbps_configure.log
;;
*)
#
@ -116,7 +119,7 @@ configure_src_phase()
# Run post_configure func.
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log \
|| msg_error "post_configure stage failed!"
|| msg_error "$pkgname: post_configure() failed! check $wrksrc/.xbps_post_configure.log"
# unset configure_env vars.
for f in ${configure_env}; do

View File

@ -364,16 +364,18 @@ _EOF
mv -f $TMPFPLIST ${DESTDIR}/files.plist
mv -f $TMPFPROPS ${DESTDIR}/props.plist
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/files.plist || return 1
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/props.plist || return 1
chmod 644 ${DESTDIR}/files.plist ${DESTDIR}/props.plist
[ -f $metadir/flist ] && chmod 644 $metadir/flist
{ \
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/files.plist; \
$XBPS_PKGDB_CMD sanitize-plist ${DESTDIR}/props.plist; \
chmod 644 ${DESTDIR}/files.plist ${DESTDIR}/props.plist; \
[ -f $metadir/flist ] && chmod 644 $metadir/flist; \
\
#
# Create the INSTALL/REMOVE scripts if package uses them
# or uses any available trigger.
#
. ${XBPS_SHUTILSDIR}/metadata_scripts.sh
xbps_write_metadata_scripts_pkg install || return $?
xbps_write_metadata_scripts_pkg remove || return $?
. ${XBPS_SHUTILSDIR}/metadata_scripts.sh; \
xbps_write_metadata_scripts_pkg install; \
xbps_write_metadata_scripts_pkg remove; \
} || return $?
}

View File

@ -96,22 +96,21 @@ install_pkg()
fi
# Install pkg into destdir.
env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \
{ env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \
dontrm_builddir=${dontrm_builddir} \
${fakeroot_cmd} ${fakeroot_cmd_args} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \
${curpkgn} || exit $?
${curpkgn}; } || exit $?
# Always write metadata to package's destdir.
. $XBPS_SHUTILSDIR/metadata.sh
xbps_write_metadata_pkg
xbps_write_metadata_pkg || return $?
#
# Do not stow package if it wasn't requested.
#
if [ -z "$install_destdir_target" ]; then
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow
fi
[ "$install_destdir_target" = "yes" ] && return 0
# Stow package into masterdir.
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow
}
#

View File

@ -277,11 +277,13 @@ install|install-destdir)
[ ! -r ./template ] && msg_error "missing build template file."
. ./template
install_destdir_target=no
[ "$target" = "install-destdir" ] && install_destdir_target=yes
[ -z "$dontrm_builddir" ] && dontrm_builddir=no
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler install $(basename_cwd) \
$install_destdir_target $dontrm_builddir
xbps_chroot_handler $target $(basename_cwd) $dontrm_builddir
else
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
setup_tmpl $(basename_cwd)