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

@ -23,9 +23,6 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
. ${XBPS_SHUTILSDIR}/common_funcs.sh
#
# Installs a pkg by reading its build template file.
#
@ -44,17 +41,9 @@ install_pkg()
pkg="$curpkgn-$version"
[ -n "$INSTALLING_DEPS" ] && setup_tmpl $curpkgn
#
# Fetch distfiles before checking its dependencies.
#
. $XBPS_SHUTILSDIR/fetch_funcs.sh
fetch_distfiles
#
# Refuse to install the same package that is already installed.
#
. $XBPS_SHUTILSDIR/builddep_funcs.sh
check_installed_pkg "$pkg"
if [ $? -eq 1 -o $? -eq 0 ]; then
instver="$($XBPS_PKGDB_CMD version $pkgname)"
@ -79,12 +68,15 @@ install_pkg()
msg_normal "Installing '$pkgname'...\n"
fi
#
# Fetch distfiles before checking its dependencies.
#
fetch_distfiles
#
# Fetch, extract, build and install into the destination directory.
#
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
. $XBPS_SHUTILSDIR/extract_funcs.sh
extract_distfiles
if [ $? -ne 0 ]; then
msg_red "cannot extract distfiles for '$pkgname'!\n"
@ -93,7 +85,6 @@ install_pkg()
fi
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
. $XBPS_SHUTILSDIR/configure_funcs.sh
configure_src_phase
if [ $? -ne 0 ]; then
msg_red "cannot configure '$pkgname'!\n"
@ -102,7 +93,6 @@ install_pkg()
fi
if [ ! -f "$XBPS_BUILD_DONE" ]; then
. $XBPS_SHUTILSDIR/build_funcs.sh
build_src_phase
if [ $? -ne 0 ]; then
msg_red "cannot build '$pkgname'!\n"
@ -121,12 +111,10 @@ install_pkg()
# Strip binaries/libraries.
if [ -z "$noarch" ]; then
. $XBPS_SHUTILSDIR/strip_files.sh
strip_files
fi
# Always write metadata to package's destdir.
. $XBPS_SHUTILSDIR/metadata.sh
trap 'remove_pkgdestdir_sighandler ${pkgname}' INT
xbps_write_metadata_pkg
if [ $? -ne 0 ]; then
@ -139,7 +127,6 @@ install_pkg()
[ "$install_destdir_target" = "yes" ] && return 0
# Stow package into masterdir.
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler stow
if [ $? -ne 0 ]; then
msg_red "cannot stow '$pkgname'!\n"
@ -174,7 +161,6 @@ install_pkg()
# Autoremove packages installed as dependencies if
# XBPS_PREFER_BINPKG_DEPS is set.
#
. ${XBPS_SHUTILSDIR}/builddep_funcs.sh
autoremove_pkg_dependencies
return $?
@ -205,7 +191,6 @@ remove_pkg()
[ -z $pkgname ] && msg_error "unexistent package, aborting.\n"
ver=$($XBPS_PKGDB_CMD version $pkgname)
. $XBPS_SHUTILSDIR/stow_funcs.sh
stow_pkg_handler unstow || return $?
for subpkg in ${subpackages}; do