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
|
@ -26,10 +26,6 @@ perl_module_build()
|
||||||
cd $wrksrc && \
|
cd $wrksrc && \
|
||||||
PERL_MM_USE_DEFAULT=1 perl Makefile.PL \
|
PERL_MM_USE_DEFAULT=1 perl Makefile.PL \
|
||||||
${make_build_args} INSTALLDIRS=vendor
|
${make_build_args} INSTALLDIRS=vendor
|
||||||
if [ "$?" -ne 0 ]; then
|
|
||||||
echo "*** ERROR building perl module for $pkgname ***"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in "$perl_configure_dirs"; do
|
for i in "$perl_configure_dirs"; do
|
||||||
|
@ -38,7 +34,6 @@ perl_module_build()
|
||||||
cd $wrksrc/$i && PERL_MM_USE_DEFAULT=1 \
|
cd $wrksrc/$i && PERL_MM_USE_DEFAULT=1 \
|
||||||
perl Makefile.PL ${make_build_args} \
|
perl Makefile.PL ${make_build_args} \
|
||||||
INSTALLDIRS=vendor
|
INSTALLDIRS=vendor
|
||||||
[ "$?" -ne 0 ] && exit 1
|
|
||||||
else
|
else
|
||||||
echo -n "*** ERROR: couldn't find $perlmkf"
|
echo -n "*** ERROR: couldn't find $perlmkf"
|
||||||
echo ", aborting ***"
|
echo ", aborting ***"
|
||||||
|
|
|
@ -42,7 +42,7 @@ set_defvars
|
||||||
|
|
||||||
install_src_phase()
|
install_src_phase()
|
||||||
{
|
{
|
||||||
local f i subpkg lver spkgrev saved_wrksrc
|
local f i subpkg lver spkgrev
|
||||||
|
|
||||||
[ -z $pkgname ] && return 2
|
[ -z $pkgname ] && return 2
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ install_src_phase()
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
saved_wrksrc=$wrksrc
|
|
||||||
cd $wrksrc || msg_error "can't change cwd to wrksrc!"
|
cd $wrksrc || msg_error "can't change cwd to wrksrc!"
|
||||||
if [ -n "$build_wrksrc" ]; then
|
if [ -n "$build_wrksrc" ]; then
|
||||||
cd $build_wrksrc \
|
cd $build_wrksrc \
|
||||||
|
@ -70,12 +69,8 @@ install_src_phase()
|
||||||
|
|
||||||
# Run pre_install func.
|
# Run pre_install func.
|
||||||
if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then
|
if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then
|
||||||
run_func pre_install 2>${wrksrc}/.xbps_pre_install.log
|
run_func pre_install
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "Package '$pkgname': pre_install phase failed! errors below"
|
|
||||||
cat $wrksrc/.xbps_pre_install.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "Package '$pkgname': pre_install (destdir) phase done."
|
msg_normal "Package '$pkgname': pre_install (destdir) phase done."
|
||||||
touch -f $XBPS_PRE_INSTALL_DONE
|
touch -f $XBPS_PRE_INSTALL_DONE
|
||||||
fi
|
fi
|
||||||
|
@ -85,26 +80,12 @@ install_src_phase()
|
||||||
|
|
||||||
# Type of installation: custom, make or python.
|
# Type of installation: custom, make or python.
|
||||||
case "$build_style" in
|
case "$build_style" in
|
||||||
custom-install)
|
custom-install) run_func do_install;;
|
||||||
run_func do_install 2>${wrksrc}/.xbps_do_install.log
|
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_red "Package '$pkgname': do_install phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_do_install.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
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
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_red "Package '$pkgname': install phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_do_install.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
make_install $lver 2>${wrksrc}/.xbps_make_install.log
|
|
||||||
;;
|
;;
|
||||||
|
*) run_func make_install;;
|
||||||
esac
|
esac
|
||||||
cd ${wrksrc} || msg_error "can't change cwd to wrksrc!"
|
cd ${wrksrc} || msg_error "can't change cwd to wrksrc!"
|
||||||
|
|
||||||
|
@ -112,12 +93,8 @@ install_src_phase()
|
||||||
|
|
||||||
# Run post_install func.
|
# Run post_install func.
|
||||||
if [ ! -f $XBPS_POST_INSTALL_DONE ]; then
|
if [ ! -f $XBPS_POST_INSTALL_DONE ]; then
|
||||||
run_func post_install 2>${wrksrc}/.xbps_post_install.log
|
run_func post_install
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "Package '$pkgname': post_install phase failed! errors below:"
|
|
||||||
cat ${wrksrc}/.xbps_post_install.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "Package '$pkgname': post_install (destdir) phase done."
|
msg_normal "Package '$pkgname': post_install (destdir) phase done."
|
||||||
touch -f $XBPS_POST_INSTALL_DONE
|
touch -f $XBPS_POST_INSTALL_DONE
|
||||||
fi
|
fi
|
||||||
|
@ -164,26 +141,14 @@ install_src_phase()
|
||||||
pkgname=${subpkg}
|
pkgname=${subpkg}
|
||||||
set_tmpl_common_vars
|
set_tmpl_common_vars
|
||||||
if [ ! -f ${wrksrc}/.xbps_do_install_${pkgname}_done ]; then
|
if [ ! -f ${wrksrc}/.xbps_do_install_${pkgname}_done ]; then
|
||||||
run_func do_install \
|
run_func do_install
|
||||||
2>${wrksrc}/.xbps_do_install_${pkgname}.log
|
if [ $? -eq 0 ]; then
|
||||||
if [ $? -ne 0 -a $? -eq 255 ]; then
|
|
||||||
msg_red "Package '$pkgname': do_install phase failed! errors below:"
|
|
||||||
cat ${wrksrc}/.xbps_do_install_${pkgname}.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
touch -f ${wrksrc}/.xbps_do_install_${pkgname}_done
|
touch -f ${wrksrc}/.xbps_do_install_${pkgname}_done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
msg_normal "Package '$sourcepkg ($lver)': skipping '$pkgname' subpkg, already installed into destdir."
|
msg_normal "Package '$sourcepkg ($lver)': skipping '$pkgname' subpkg, already installed into destdir."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# Remove $wrksrc if -C not specified.
|
|
||||||
#
|
|
||||||
if [ -d "$saved_wrksrc" -a "$dontrm_builddir" = "no" ]; then
|
|
||||||
remove_tmpl_wrksrc $saved_wrksrc
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -191,8 +156,6 @@ install_src_phase()
|
||||||
#
|
#
|
||||||
make_install()
|
make_install()
|
||||||
{
|
{
|
||||||
local lver="$1"
|
|
||||||
|
|
||||||
if [ -z "$make_install_target" ]; then
|
if [ -z "$make_install_target" ]; then
|
||||||
make_install_target="DESTDIR=${DESTDIR} install"
|
make_install_target="DESTDIR=${DESTDIR} install"
|
||||||
fi
|
fi
|
||||||
|
@ -201,11 +164,6 @@ make_install()
|
||||||
# Install package via make.
|
# Install package via make.
|
||||||
#
|
#
|
||||||
${make_cmd} ${make_install_target} ${make_install_args}
|
${make_cmd} ${make_install_target} ${make_install_args}
|
||||||
if [ $? -ne 0 -a -f ${wrksrc}/.xbps_make_install.log ]; then
|
|
||||||
msg_red "Package '$pkgname ($lver)': make install failed! full log below:"
|
|
||||||
cat ${wrksrc}/.xbps_make_install.log
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -z "$PKG_TMPLNAME" ] && exit 2
|
[ -z "$PKG_TMPLNAME" ] && exit 2
|
||||||
|
|
|
@ -27,6 +27,20 @@
|
||||||
# Runs the "build" phase for a pkg. This builds the binaries and other
|
# Runs the "build" phase for a pkg. This builds the binaries and other
|
||||||
# related stuff.
|
# related stuff.
|
||||||
#
|
#
|
||||||
|
do_make_build()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Build package via make.
|
||||||
|
#
|
||||||
|
if [ "$build_style" = "gnu_makefile" ]; then
|
||||||
|
if [ -n "$XBPS_LDFLAGS" ]; then
|
||||||
|
mkldfags="$LDFLAGS $XBPS_LDFLAGS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
env LDFLAGS="$mkldflags" ${make_cmd} ${makejobs} ${make_build_args} \
|
||||||
|
${make_build_target}
|
||||||
|
}
|
||||||
|
|
||||||
build_src_phase()
|
build_src_phase()
|
||||||
{
|
{
|
||||||
local pkg="$pkgname-$version" pkgparam="$1" f lver
|
local pkg="$pkgname-$version" pkgparam="$1" f lver
|
||||||
|
@ -64,12 +78,8 @@ build_src_phase()
|
||||||
fi
|
fi
|
||||||
# Run pre_build func.
|
# Run pre_build func.
|
||||||
if [ ! -f $XBPS_PRE_BUILD_DONE ]; then
|
if [ ! -f $XBPS_PRE_BUILD_DONE ]; then
|
||||||
run_func pre_build 2>${wrksrc}/.xbps_pre_build.log
|
run_func pre_build
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "$pkgname: pre_build phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_pre_build.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "$pkgname: pre_build phase done."
|
msg_normal "$pkgname: pre_build phase done."
|
||||||
touch -f $XBPS_PRE_BUILD_DONE
|
touch -f $XBPS_PRE_BUILD_DONE
|
||||||
fi
|
fi
|
||||||
|
@ -79,34 +89,17 @@ build_src_phase()
|
||||||
|
|
||||||
if [ "$build_style" = "custom-install" ]; then
|
if [ "$build_style" = "custom-install" ]; then
|
||||||
[ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$XBPS_LDFLAGS"
|
[ -n "$XBPS_LDFLAGS" ] && export LDFLAGS="$XBPS_LDFLAGS"
|
||||||
run_func do_build 2>${wrksrc}/.xbps_do_build.log
|
run_func do_build
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_error "Package '$pkgname': do_build phase failed!"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
#
|
run_func do_make_build
|
||||||
# Build package via make.
|
|
||||||
#
|
|
||||||
if [ "$build_style" = "gnu_makefile" ]; then
|
|
||||||
if [ -n "$XBPS_LDFLAGS" ]; then
|
|
||||||
mkldfags="$LDFLAGS $XBPS_LDFLAGS"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
env LDFLAGS="$mkldflags" ${make_cmd} ${makejobs} ${make_build_args} \
|
|
||||||
${make_build_target} ||
|
|
||||||
msg_error "Package '$pkgname': build phase failed!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_normal "Package '$pkgname ($lver)': build phase done."
|
msg_normal "Package '$pkgname ($lver)': build phase done."
|
||||||
|
|
||||||
# Run post_build func.
|
# Run post_build func.
|
||||||
if [ ! -f $XBPS_POST_BUILD_DONE ]; then
|
if [ ! -f $XBPS_POST_BUILD_DONE ]; then
|
||||||
run_func post_build 2>${wrksrc}/.xbps_post_build.log
|
run_func post_build
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "Package '$pkgname': post_build phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_post_build.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "Package '$pkgname': post_build phase done."
|
msg_normal "Package '$pkgname': post_build phase done."
|
||||||
touch -f $XBPS_POST_BUILD_DONE
|
touch -f $XBPS_POST_BUILD_DONE
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -26,15 +26,83 @@
|
||||||
#
|
#
|
||||||
# Common functions for xbps.
|
# Common functions for xbps.
|
||||||
#
|
#
|
||||||
|
run_func_error()
|
||||||
|
{
|
||||||
|
local func="$1"
|
||||||
|
|
||||||
|
remove_pkgdestdir_sighandler ${pkgname}
|
||||||
|
msg_error "${pkgname}-${version}: the $func function didn't complete due to errors or SIGINT!"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_pkgdestdir_sighandler()
|
||||||
|
{
|
||||||
|
local subpkg _pkgname="$1"
|
||||||
|
|
||||||
|
setup_tmpl ${_pkgname}
|
||||||
|
[ -z "$sourcepkg" ] && return 0
|
||||||
|
|
||||||
|
# If there is any problem in the middle of writting the metadata,
|
||||||
|
# just remove all files from destdir of pkg.
|
||||||
|
|
||||||
|
for subpkg in ${subpackages}; do
|
||||||
|
if [ -d "$XBPS_DESTDIR/${subpkg}-${version%_*}" ]; then
|
||||||
|
rm -rf "$XBPS_DESTDIR/${subpkg}-${version%_*}"
|
||||||
|
fi
|
||||||
|
if [ -f ${wrksrc}/.xbps_do_install_${subpkg}_done ]; then
|
||||||
|
rm -f ${wrksrc}/.xbps_do_install_${subpkg}_done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -d "$XBPS_DESTDIR/${sourcepkg}-${version%_*}" ]; then
|
||||||
|
rm -rf "$XBPS_DESTDIR/${sourcepkg}-${version%_*}"
|
||||||
|
fi
|
||||||
|
msg_red "Removed '${sourcepkg}-${version}' files from DESTDIR..."
|
||||||
|
}
|
||||||
|
|
||||||
|
var_is_a_function()
|
||||||
|
{
|
||||||
|
local func="$1"
|
||||||
|
local func_result
|
||||||
|
|
||||||
|
func_result=$(mktemp -t xbps_src_run_func.XXXXXX)
|
||||||
|
type $func > $func_result 2>&1
|
||||||
|
if $(grep -q 'function' $func_result); then
|
||||||
|
rm -f $func_result
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $func_result
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
run_func()
|
run_func()
|
||||||
{
|
{
|
||||||
func="$1"
|
local func="$1"
|
||||||
|
local rval logpipe logfile
|
||||||
|
|
||||||
[ -z "$func" ] && return 1
|
[ -z "$func" ] && return 1
|
||||||
|
|
||||||
if $(type $func | grep -q 'function'); then
|
var_is_a_function $func
|
||||||
$func
|
if [ $? -eq 1 ]; then
|
||||||
return $?
|
logpipe=/tmp/logpipe.$$
|
||||||
|
if [ -d "${wrksrc}" ]; then
|
||||||
|
logfile=${wrksrc}/.xbps_${func}.log
|
||||||
|
else
|
||||||
|
logfile=$(mktemp -t xbps_${func}_${pkgname}.log.XXXXXXXX)
|
||||||
|
fi
|
||||||
|
mkfifo "$logpipe"
|
||||||
|
exec 3>&1
|
||||||
|
tee "$logfile" < "$logpipe" &
|
||||||
|
exec 1>"$logpipe" 2>"$logpipe"
|
||||||
|
set -e
|
||||||
|
trap "run_func_error $func" 0
|
||||||
|
$func 2>&1
|
||||||
|
set +e
|
||||||
|
trap '' 0
|
||||||
|
exec 1>&3 2>&3 3>&-
|
||||||
|
rm -f "$logpipe"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
return 255 # function not found.
|
return 255 # function not found.
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,36 @@
|
||||||
# Runs the "configure" phase for a pkg. This setups the Makefiles or any
|
# Runs the "configure" phase for a pkg. This setups the Makefiles or any
|
||||||
# other stuff required to be able to build binaries or such.
|
# other stuff required to be able to build binaries or such.
|
||||||
#
|
#
|
||||||
|
do_gnu_configure()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Packages using GNU autoconf
|
||||||
|
#
|
||||||
|
env LDFLAGS="$LDFLAGS $conf_ldflags" \
|
||||||
|
${configure_script} --prefix=/usr --sysconfdir=/etc \
|
||||||
|
--infodir=/usr/share/info --mandir=/usr/share/man \
|
||||||
|
${configure_args}
|
||||||
|
}
|
||||||
|
|
||||||
|
do_configure()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Packages using custom configure scripts.
|
||||||
|
#
|
||||||
|
env LDFLAGS="$LDFLAGS $conf_ldflags" ${configure_script} \
|
||||||
|
${configure_args}
|
||||||
|
}
|
||||||
|
|
||||||
|
do_perl_configure()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Packages that are perl modules and use Makefile.PL files.
|
||||||
|
# They are all handled by the helper perl-module.sh.
|
||||||
|
#
|
||||||
|
. $XBPS_HELPERSDIR/perl-module.sh
|
||||||
|
perl_module_build $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
configure_src_phase()
|
configure_src_phase()
|
||||||
{
|
{
|
||||||
local f lver error=0
|
local f lver error=0
|
||||||
|
@ -60,12 +90,8 @@ configure_src_phase()
|
||||||
|
|
||||||
# Run pre_configure func.
|
# Run pre_configure func.
|
||||||
if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then
|
if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then
|
||||||
run_func pre_configure 2>${wrksrc}/.xbps_pre_configure.log
|
run_func pre_configure
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "Package '$pkgname': pre_configure phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_pre_configure.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "Package '$pkgname': pre_configure phase done."
|
msg_normal "Package '$pkgname': pre_configure phase done."
|
||||||
touch -f $XBPS_PRECONFIGURE_DONE
|
touch -f $XBPS_PRECONFIGURE_DONE
|
||||||
fi
|
fi
|
||||||
|
@ -90,52 +116,23 @@ configure_src_phase()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$build_style" in
|
case "$build_style" in
|
||||||
gnu_configure|gnu-configure)
|
gnu_configure|gnu-configure) run_func do_gnu_configure ;;
|
||||||
#
|
configure) run_func do_configure ;;
|
||||||
# Packages using GNU autoconf
|
perl-module|perl_module) run_func do_perl_configure ;;
|
||||||
#
|
|
||||||
env LDFLAGS="$LDFLAGS $conf_ldflags" \
|
|
||||||
${configure_script} --prefix=/usr --sysconfdir=/etc \
|
|
||||||
--infodir=/usr/share/info --mandir=/usr/share/man \
|
|
||||||
${configure_args} || error=$?
|
|
||||||
;;
|
|
||||||
configure)
|
|
||||||
#
|
|
||||||
# Packages using custom configure scripts.
|
|
||||||
#
|
|
||||||
env LDFLAGS="$LDFLAGS $conf_ldflags" ${configure_script} \
|
|
||||||
${configure_args} || error=$?
|
|
||||||
;;
|
|
||||||
perl-module|perl_module)
|
|
||||||
#
|
|
||||||
# Packages that are perl modules and use Makefile.PL files.
|
|
||||||
# They are all handled by the helper perl-module.sh.
|
|
||||||
#
|
|
||||||
. $XBPS_HELPERSDIR/perl-module.sh
|
|
||||||
perl_module_build $pkgname || error=$?
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
#
|
#
|
||||||
# Unknown build_style type won't work :-)
|
# Unknown build_style type won't work :-)
|
||||||
#
|
#
|
||||||
msg_error "package '$pkgname': unknown build_style [$build_style]"
|
msg_error "package '$pkgname': unknown build_style [$build_style]"
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$build_style" != "perl_module" -a "$error" -ne 0 ]; then
|
|
||||||
msg_error "package '$pkgname': configure stage failed!"
|
|
||||||
fi
|
|
||||||
msg_normal "Package '$pkgname ($lver)': configure phase done."
|
msg_normal "Package '$pkgname ($lver)': configure phase done."
|
||||||
|
|
||||||
# Run post_configure func.
|
# Run post_configure func.
|
||||||
if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then
|
if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then
|
||||||
run_func post_configure 2>${wrksrc}/.xbps_post_configure.log
|
run_func post_configure
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
msg_red "Package '$pkgname': post_configure phase failed! errors below:"
|
|
||||||
cat $wrksrc/.xbps_post_configure.log
|
|
||||||
exit 1
|
|
||||||
elif [ $? -eq 0 ]; then
|
|
||||||
msg_normal "Package '$pkgname': post_configure phase done."
|
msg_normal "Package '$pkgname': post_configure phase done."
|
||||||
touch -f $XBPS_POSTCONFIGURE_DONE
|
touch -f $XBPS_POSTCONFIGURE_DONE
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -70,7 +70,7 @@ fetch_distfiles()
|
||||||
|
|
||||||
if [ -n "$nofetch" ]; then
|
if [ -n "$nofetch" ]; then
|
||||||
msg_normal "Package '$pkgname ($lver)': running do_fetch phase."
|
msg_normal "Package '$pkgname ($lver)': running do_fetch phase."
|
||||||
cd ${XBPS_BUILDDIR} && run_func do_fetch 2>/dev/null && return $?
|
cd ${XBPS_BUILDDIR} && run_func do_fetch && return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $XBPS_SRCDISTDIR || return 1
|
cd $XBPS_SRCDISTDIR || return 1
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#-
|
#-
|
||||||
|
|
||||||
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
|
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
|
||||||
|
. ${XBPS_SHUTILSDIR}/common_funcs.sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Installs a pkg by reading its build template file.
|
# Installs a pkg by reading its build template file.
|
||||||
|
@ -62,10 +63,7 @@ install_pkg()
|
||||||
#
|
#
|
||||||
if [ -z "$doing_deps" ]; then
|
if [ -z "$doing_deps" ]; then
|
||||||
install_dependencies_pkg $pkg
|
install_dependencies_pkg $pkg
|
||||||
if [ $? -eq 1 ]; then
|
[ $? -eq 1 ] && return 1
|
||||||
msg_red "cannot install pkgdeps for '$pkg'!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
#
|
#
|
||||||
# At this point all required deps are installed, and
|
# At this point all required deps are installed, and
|
||||||
# only remaining is the origin package; install it.
|
# only remaining is the origin package; install it.
|
||||||
|
@ -110,10 +108,9 @@ install_pkg()
|
||||||
|
|
||||||
# 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} wrksrc=${wrksrc} \
|
wrksrc=${wrksrc} \
|
||||||
${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}
|
||||||
${curpkgn}
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
msg_red "xbps-src-doinst-helper failed for '$pkgname'!"
|
msg_red "xbps-src-doinst-helper failed for '$pkgname'!"
|
||||||
return 1
|
return 1
|
||||||
|
@ -127,11 +124,14 @@ install_pkg()
|
||||||
|
|
||||||
# Always write metadata to package's destdir.
|
# Always write metadata to package's destdir.
|
||||||
. $XBPS_SHUTILSDIR/metadata.sh
|
. $XBPS_SHUTILSDIR/metadata.sh
|
||||||
|
trap 'remove_pkgdestdir_sighandler ${pkgname}' 0 INT
|
||||||
xbps_write_metadata_pkg
|
xbps_write_metadata_pkg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
msg_red "cannot write package metadata for '$pkgname'!"
|
msg_red "cannot write package metadata for '$pkgname'!"
|
||||||
|
trap '' 0 INT
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
trap '' 0 INT
|
||||||
|
|
||||||
[ "$install_destdir_target" = "yes" ] && return 0
|
[ "$install_destdir_target" = "yes" ] && return 0
|
||||||
|
|
||||||
|
@ -142,6 +142,13 @@ install_pkg()
|
||||||
msg_red "cannot stow '$pkgname'!"
|
msg_red "cannot stow '$pkgname'!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Remove $wrksrc if -C not specified.
|
||||||
|
#
|
||||||
|
if [ -d "$wrksrc" -a "$dontrm_builddir" = "no" ]; then
|
||||||
|
remove_tmpl_wrksrc $wrksrc
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -151,11 +151,8 @@ stow_pkg_real()
|
||||||
# Register pkg in plist file.
|
# Register pkg in plist file.
|
||||||
#
|
#
|
||||||
$XBPS_PKGDB_CMD register $pkgname $lver "$short_desc" || return $?
|
$XBPS_PKGDB_CMD register $pkgname $lver "$short_desc" || return $?
|
||||||
|
run_func post_stow
|
||||||
run_func post_stow 2>/dev/null
|
return 0
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_error "Package '$pkgname': post_stow phase failed!"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -191,11 +188,7 @@ unstow_pkg_real()
|
||||||
elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||||
msg_error "$pkgname cannot be removed (permission denied)."
|
msg_error "$pkgname cannot be removed (permission denied)."
|
||||||
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||||
run_func pre_remove 2>/dev/null
|
run_func pre_remove
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_error "Package '$pkgname': pre_remove stage failed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove installed files.
|
# Remove installed files.
|
||||||
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
|
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
|
||||||
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
||||||
|
@ -216,11 +209,7 @@ unstow_pkg_real()
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_func post_remove 2>/dev/null
|
run_func post_remove
|
||||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
|
||||||
msg_error "Package '$pkgname': post_remove phase failed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove metadata dir.
|
# Remove metadata dir.
|
||||||
rm -rf $XBPS_PKGMETADIR/$pkgname
|
rm -rf $XBPS_PKGMETADIR/$pkgname
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue