xbps-src: improve run_func and always make a log in $wrksrc.
Also when or after the pkg is installed to destdir/stowned, and there was any error, always remove the files that were installed into destdir. With these changes there's no need to return any value in the do_foo() functions because they are caught automatically. Also any function is now logged into its own file to always log what happens.
This commit is contained in:
parent
4965921029
commit
08d47bc8b1
8 changed files with 158 additions and 151 deletions
|
@ -24,6 +24,7 @@
|
|||
#-
|
||||
|
||||
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
|
||||
. ${XBPS_SHUTILSDIR}/common_funcs.sh
|
||||
|
||||
#
|
||||
# Installs a pkg by reading its build template file.
|
||||
|
@ -62,10 +63,7 @@ install_pkg()
|
|||
#
|
||||
if [ -z "$doing_deps" ]; then
|
||||
install_dependencies_pkg $pkg
|
||||
if [ $? -eq 1 ]; then
|
||||
msg_red "cannot install pkgdeps for '$pkg'!"
|
||||
return 1
|
||||
fi
|
||||
[ $? -eq 1 ] && return 1
|
||||
#
|
||||
# At this point all required deps are installed, and
|
||||
# only remaining is the origin package; install it.
|
||||
|
@ -110,10 +108,9 @@ install_pkg()
|
|||
|
||||
# Install pkg into destdir.
|
||||
env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \
|
||||
dontrm_builddir=${dontrm_builddir} wrksrc=${wrksrc} \
|
||||
wrksrc=${wrksrc} \
|
||||
${fakeroot_cmd} ${fakeroot_cmd_args} \
|
||||
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \
|
||||
${curpkgn}
|
||||
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper ${curpkgn}
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_red "xbps-src-doinst-helper failed for '$pkgname'!"
|
||||
return 1
|
||||
|
@ -127,11 +124,14 @@ install_pkg()
|
|||
|
||||
# Always write metadata to package's destdir.
|
||||
. $XBPS_SHUTILSDIR/metadata.sh
|
||||
trap 'remove_pkgdestdir_sighandler ${pkgname}' 0 INT
|
||||
xbps_write_metadata_pkg
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_red "cannot write package metadata for '$pkgname'!"
|
||||
trap '' 0 INT
|
||||
return 1
|
||||
fi
|
||||
trap '' 0 INT
|
||||
|
||||
[ "$install_destdir_target" = "yes" ] && return 0
|
||||
|
||||
|
@ -142,6 +142,13 @@ install_pkg()
|
|||
msg_red "cannot stow '$pkgname'!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Remove $wrksrc if -C not specified.
|
||||
#
|
||||
if [ -d "$wrksrc" -a "$dontrm_builddir" = "no" ]; then
|
||||
remove_tmpl_wrksrc $wrksrc
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue