Improve how build deps are processed, return on errors immediately.

This commit is contained in:
Juan RP 2010-05-12 17:23:35 +02:00
parent 15b6f5be38
commit e675201990
3 changed files with 83 additions and 27 deletions

View file

@ -64,7 +64,7 @@ install_src_phase()
{
local f i subpkg lver spkgrev saved_wrksrc
[ -z $pkgname ] && return 1
[ -z $pkgname ] && return 2
if [ -n "$revision" ]; then
lver="${version}_${revision}"
@ -205,9 +205,9 @@ make_install()
|| msg_error "$pkgname: make install failed!"
}
[ -z "$PKG_TMPLNAME" ] && exit 1
[ -z "$PKG_TMPLNAME" ] && exit 2
setup_tmpl $PKG_TMPLNAME
install_src_phase $pkgname
exit $?
exit 0

View file

@ -36,7 +36,7 @@ install_pkg_deps()
local saved_prevpkg="$(${XBPS_PKGDB_CMD} getpkgdepname $2)"
local j jver jname reqver
[ -z "$curpkg" ] && return 1
[ -z "$curpkg" -o -z "$curpkgname" ] && return 2
if [ -n "$prev_pkg" ]; then
curpkg=$prev_pkg
@ -45,7 +45,7 @@ install_pkg_deps()
msg_normal "Installing $saved_prevpkg dependency: $curpkgname."
setup_tmpl $curpkgname
setup_tmpl "$curpkgname"
check_build_depends_pkg
if [ $? -eq 0 ]; then
msg_normal "Dependency $curpkgname requires:"
@ -68,13 +68,16 @@ install_pkg_deps()
check_pkgdep_matched "${j}"
[ $? -eq 0 ] && continue
[ -n "$prev_pkg" ] && unset prev_pkg
#
# Iterate again, this will check if there are more
# required deps for current pkg.
#
install_pkg_deps $j $curpkg
prev_pkg="$j"
install_pkg_deps "${j}" "${curpkg}"
if [ $? -eq 1 ]; then
msg_red "install_pkg_deps: cannot install '$curpkg' ($j)."
return 1
fi
done
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
@ -84,12 +87,25 @@ install_pkg_deps()
return $?
elif [ $? -eq 1 ]; then
# Package not found, build from source.
install_pkg $curpkgname || return $?
install_pkg "${curpkgname}"
if [ $? -eq 1 ]; then
msg_red "cannot install '$curpkgname'!"
return 1
fi
fi
else
install_pkg $curpkgname
if [ -n "$saved_prevpkg" ]; then
msg_normal "Installing ${curpkgname} required by ${saved_prevpkg}."
else
msg_normal "Installing ${curpkgname}."
fi
install_pkg "${curpkgname}"
if [ $? -eq 1 ]; then
msg_red "install_pkg_deps: cannot install '$curpkgname'!"
return 1
fi
fi
[ -n "$prev_pkg" ] && unset prev_pkg
unset prev_pkg
}
#
@ -99,9 +115,9 @@ install_dependencies_pkg()
{
local pkg="$1" rval pkgdep_list
local lpkgname=$(${XBPS_PKGDB_CMD} getpkgname ${pkg})
local i pkgn iver reqver notinstalled_deps lver
local i j pkgn iver reqver notinstalled_deps lver
[ -z "$pkg" ] && return 1
[ -z "$pkg" ] && return 2
doing_deps=true
@ -147,9 +163,9 @@ install_dependencies_pkg()
fi
fi
for i in ${notinstalled_deps}; do
for j in ${notinstalled_deps}; do
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
install_pkg_with_binpkg "${i}"
install_pkg_with_binpkg "${j}"
rval=$?
if [ $rval -eq 255 ]; then
# xbps-bin returned unexpected error (-1)
@ -159,16 +175,16 @@ install_dependencies_pkg()
continue
fi
fi
pkgn=$($XBPS_PKGDB_CMD getpkgdepname ${i})
check_pkgdep_matched "${i}"
pkgn=$($XBPS_PKGDB_CMD getpkgdepname ${j})
check_pkgdep_matched "${j}"
[ $? -eq 0 ] && continue
setup_tmpl $pkgn
setup_tmpl "$pkgn"
check_build_depends_pkg
if [ $? -eq 1 ]; then
msg_normal "Installing $lpkgname dependency: $pkgn."
if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
install_pkg_with_binpkg "${i}"
install_pkg_with_binpkg "${j}"
rval=$?
if [ $rval -eq 255 ]; then
# xbps-bin returned unexpected error
@ -178,13 +194,25 @@ install_dependencies_pkg()
continue
else
# package not found, build source.
install_pkg $pkgn || return $?
install_pkg "${pkgn}"
if [ $? -eq 1 ]; then
msg_red "cannot install '$pkgn'!"
return 1
fi
fi
else
install_pkg $pkgn
install_pkg "${pkgn}"
if [ $? -eq 1 ]; then
msg_red "cannot install '$pkgn'!"
return 1
fi
fi
else
install_pkg_deps "${i}" $pkg
install_pkg_deps "${j}" "${pkg}"
if [ $? -eq 1 ]; then
msg_red "install_dependencies_pkg: cannot install pkgdeps required by $pkg ($j)."
return 1
fi
fi
done
}

View file

@ -65,6 +65,10 @@ 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
#
# At this point all required deps are installed, and
# only remaining is the origin package; install it.
@ -81,17 +85,29 @@ install_pkg()
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
. $XBPS_SHUTILSDIR/extract_funcs.sh
extract_distfiles || return $?
extract_distfiles
if [ $? -ne 0 ]; then
msg_red "cannot extract distfiles for '$pkgname'!"
return 1
fi
fi
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
. $XBPS_SHUTILSDIR/configure_funcs.sh
configure_src_phase || return $?
configure_src_phase
if [ $? -ne 0 ]; then
msg_red "cannot configure '$pkgname'!"
return 1
fi
fi
if [ ! -f "$XBPS_BUILD_DONE" ]; then
. $XBPS_SHUTILSDIR/build_funcs.sh
build_src_phase || return $?
build_src_phase
if [ $? -ne 0 ]; then
msg_red "cannot build '$pkgname'!"
return 1
fi
fi
# Install pkg into destdir.
@ -100,18 +116,30 @@ install_pkg()
dontrm_builddir=${dontrm_builddir} wrksrc=${wrksrc} \
${fakeroot_cmd} ${fakeroot_cmd_args} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \
${curpkgn} || return $?
${curpkgn}
if [ $? -ne 0 ]; then
msg_red "xbps-src-doinst-helper failed for '$pkgname'!"
return 1
fi
unset_build_vars
# Always write metadata to package's destdir.
. $XBPS_SHUTILSDIR/metadata.sh
xbps_write_metadata_pkg || return $?
xbps_write_metadata_pkg
if [ $? -ne 0 ]; then
msg_red "cannot write package metadata for '$pkgname'!"
return 1
fi
[ "$install_destdir_target" = "yes" ] && return 0
# Stow package into masterdir.
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow || return $?
stow_pkg_handler stow
if [ $? -ne 0 ]; then
msg_red "cannot stow '$pkgname'!"
return 1
fi
}
#