xbps-src: fix fetch phase with depends, performance improvements.

- The fetch phase *must* run after installing pkg dependencies,
  otherwise it could fail if we need them for fetching.

- Performance improvements for xbps-src. Only source shutils files
  at the start, not every time we use a function.
This commit is contained in:
Juan RP 2011-07-02 17:04:08 +02:00
parent 12b16e75a0
commit 7984b39928
10 changed files with 10 additions and 63 deletions

View file

@ -212,14 +212,17 @@ if [ -n "${_MASTERDIR}" ]; then
fi
. @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh
set_defvars
for f in $(echo @@XBPS_INSTALL_SHAREDIR@@/shutils/*.sh); do
if [ -r "$f" -a "$(basename $f)" != "chroot.sh" ]; then
. $f
fi
done
#
# Check for required utilities in host system.
#
check_reqhost_utils
. $XBPS_SHUTILSDIR/common_funcs.sh
#
# Fix up some vars when XBPS_USE_CAPABILITIES is set.
#
@ -263,8 +266,6 @@ export PATH="$MYPATH"
#
case "$target" in
bootstrap)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
[ ! -d $XBPS_SRCPKGDIR/base-chroot ] && \
msg_error "Cannot find $XBPS_SRCPKGDIR/base-chroot directory!\n"
cd $XBPS_SRCPKGDIR/base-chroot && _ORIGINPKG="$(basename_cwd)"
@ -285,8 +286,6 @@ build|configure)
_ORIGINPKG="${_pkgname}"
setup_tmpl ${_ORIGINPKG}
# If pkg has dependencies, install them first.
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
. $XBPS_SHUTILSDIR/builddep_funcs.sh
install_dependencies_pkg "$pkgname-$version"
if [ $? -ne 0 ]; then
msg_red "cannot install required deps for $pkgname.\n"
@ -294,28 +293,21 @@ build|configure)
fi
# All deps were installed, continue with the origin pkg...
setup_tmpl ${_ORIGINPKG}
. $XBPS_SHUTILSDIR/fetch_funcs.sh
fetch_distfiles
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
. $XBPS_SHUTILSDIR/extract_funcs.sh
extract_distfiles
fi
if [ "$target" = "configure" ]; then
. $XBPS_SHUTILSDIR/configure_funcs.sh
configure_src_phase
else
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
. $XBPS_SHUTILSDIR/configure_funcs.sh
configure_src_phase
fi
. $XBPS_SHUTILSDIR/build_funcs.sh
build_src_phase
fi
fi
;;
build-pkg)
. $XBPS_SHUTILSDIR/make-binpkg.sh
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
if [ -n "${_PACKAGEDIR}" ]; then
export XBPS_PACKAGESDIR=${_PACKAGEDIR}
fi
@ -337,8 +329,6 @@ build-pkg)
fi
;;
checkvers)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
. $XBPS_SHUTILSDIR/check_installed_packages.sh
check_installed_packages
;;
chroot)
@ -346,7 +336,6 @@ chroot)
xbps_chroot_handler chroot dummy
;;
clean)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd)
@ -355,24 +344,19 @@ clean)
remove_tmpl_wrksrc $wrksrc
;;
extract|fetch|info)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd)
fi
setup_tmpl ${_pkgname}
if [ "$target" = "info" ]; then
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
info_tmpl
exit $?
fi
. $XBPS_SHUTILSDIR/fetch_funcs.sh
fetch_distfiles $update_checksum
. $XBPS_SHUTILSDIR/extract_funcs.sh
extract_distfiles
;;
install|install-destdir)
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd)
@ -386,7 +370,6 @@ install|install-destdir)
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
else
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
setup_tmpl ${_ORIGINPKG}
install_pkg $pkgname
fi
@ -396,7 +379,6 @@ list|listfiles)
$XBPS_BIN_CMD list
exit $?
fi
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
list_pkg_files $2
;;
make-repoidx)
@ -411,7 +393,6 @@ make-repoidx)
[ $? -eq 0 ] && echo "=> done."
;;
remove)
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd)
@ -426,13 +407,11 @@ remove)
;;
stow)
stow_flag=yes
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
if [ -z "${_pkgname}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
_pkgname=$(basename_cwd)
fi
setup_tmpl ${_pkgname}
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow
;;
unstow)
@ -442,7 +421,6 @@ unstow)
_pkgname=$(basename_cwd)
fi
setup_tmpl ${_pkgname}
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler unstow
;;
*)