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,8 +23,6 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
install_pkg_from_repos()
{
local cmd rval pkgdepname pkg="$1"
@@ -91,7 +89,6 @@ autoremove_pkg_dependencies()
continue
fi
# remove pkg.
. ${XBPS_SHUTILSDIR}/pkgtarget_funcs.sh
msg_warn "removing package $pkgname installed from source...\n"
remove_pkg
fi

View File

@@ -54,7 +54,6 @@ if [ "${chroot_cmd}" = "chroot" ]; then
fi
fi
. $XBPS_SHUTILSDIR/builddep_funcs.sh
check_installed_pkg base-chroot-0.11
if [ $? -ne 0 ]; then
echo "${XBPS_MASTERDIR} has not been prepared for chroot operations."

View File

@@ -141,7 +141,6 @@ msg_red()
msg_error()
{
msg_red "$@"
. $XBPS_SHUTILSDIR/builddep_funcs.sh
autoremove_pkg_dependencies
exit 1

View File

@@ -66,7 +66,6 @@ configure_src_phase()
# Apply patches if requested by template file
if [ ! -f $XBPS_APPLYPATCHES_DONE ]; then
. $XBPS_SHUTILSDIR/patch_funcs.sh
apply_tmpl_patches
fi

View File

@@ -49,7 +49,6 @@ xbps_write_metadata_pkg()
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
pkgname=${subpkg}
set_tmpl_common_vars
. ${XBPS_SHUTILSDIR}/verify_rundeps.sh
verify_rundeps ${DESTDIR}
xbps_write_metadata_pkg_real
done
@@ -66,7 +65,6 @@ xbps_write_metadata_pkg()
fi
setup_tmpl ${sourcepkg}
# Verify pkg deps.
. ${XBPS_SHUTILSDIR}/verify_rundeps.sh
verify_rundeps ${DESTDIR}
xbps_write_metadata_pkg_real
}
@@ -412,7 +410,6 @@ _EOF
# Create the INSTALL/REMOVE scripts if package uses them
# or uses any available trigger.
#
. ${XBPS_SHUTILSDIR}/metadata_scripts.sh; \
xbps_write_metadata_scripts_pkg install; \
xbps_write_metadata_scripts_pkg remove; \
} || return $?

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

View File

@@ -23,8 +23,6 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
. ${XBPS_SHUTILSDIR}/builddep_funcs.sh
stow_pkg_handler()
{
local action="$1" subpkg spkgrev

View File

@@ -23,8 +23,6 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh
strip_files()
{
local subpkg

View File

@@ -66,7 +66,6 @@ info_tmpl()
done
echo "$long_desc"
echo
. $XBPS_SHUTILSDIR/builddep_funcs.sh
check_build_depends_pkg
if [ $? -eq 0 ]; then
echo "This package requires the following build-time dependencies:"
@@ -284,8 +283,6 @@ set_tmpl_common_vars()
{
[ -z "$pkgname" ] && return 1
. ${XBPS_SHUTILSDIR}/install_files.sh
FILESDIR=$XBPS_SRCPKGDIR/$pkgname/files
PATCHESDIR=$XBPS_SRCPKGDIR/$pkgname/patches
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}