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

View File

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

View File

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

View File

@ -59,7 +59,7 @@ configure_src_phase()
# Run pre_configure func. # Run pre_configure func.
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log \ 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. # Export configure_env vars.
for f in ${configure_env}; do for f in ${configure_env}; do
@ -83,9 +83,11 @@ configure_src_phase()
# #
# Packages using GNU autoconf # Packages using GNU autoconf
# #
${configure_script} --prefix=/usr --sysconfdir=/etc \ { ${configure_script} --prefix=/usr --sysconfdir=/etc \
--infodir=/usr/share/info --mandir=/usr/share/man \ --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) configure)
# #
@ -99,7 +101,8 @@ configure_src_phase()
# They are all handled by the helper perl-module.sh. # They are all handled by the helper perl-module.sh.
# #
. $XBPS_HELPERSDIR/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 post_configure func.
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log \ 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. # unset configure_env vars.
for f in ${configure_env}; do for f in ${configure_env}; do

View File

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

View File

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

View File

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