From 7984b39928958a9f8c9acce176f3fc5a986c105d Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 2 Jul 2011 17:04:08 +0200 Subject: [PATCH] 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. --- xbps-src/shutils/builddep_funcs.sh | 3 --- xbps-src/shutils/chroot.sh.in | 1 - xbps-src/shutils/common_funcs.sh | 1 - xbps-src/shutils/configure_funcs.sh | 1 - xbps-src/shutils/metadata.sh | 3 --- xbps-src/shutils/pkgtarget_funcs.sh.in | 25 ++++---------------- xbps-src/shutils/stow_funcs.sh | 2 -- xbps-src/shutils/strip_files.sh | 2 -- xbps-src/shutils/tmpl_funcs.sh.in | 3 --- xbps-src/xbps-src.sh.in | 32 ++++---------------------- 10 files changed, 10 insertions(+), 63 deletions(-) diff --git a/xbps-src/shutils/builddep_funcs.sh b/xbps-src/shutils/builddep_funcs.sh index c23a6030a83..344a002bdaf 100644 --- a/xbps-src/shutils/builddep_funcs.sh +++ b/xbps-src/shutils/builddep_funcs.sh @@ -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 diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index 21554100cc8..ae7b7849654 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -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." diff --git a/xbps-src/shutils/common_funcs.sh b/xbps-src/shutils/common_funcs.sh index 770ce22cbd5..32ef1d4fea8 100644 --- a/xbps-src/shutils/common_funcs.sh +++ b/xbps-src/shutils/common_funcs.sh @@ -141,7 +141,6 @@ msg_red() msg_error() { msg_red "$@" - . $XBPS_SHUTILSDIR/builddep_funcs.sh autoremove_pkg_dependencies exit 1 diff --git a/xbps-src/shutils/configure_funcs.sh b/xbps-src/shutils/configure_funcs.sh index 4d3b3fd5e4c..5565dc99e00 100644 --- a/xbps-src/shutils/configure_funcs.sh +++ b/xbps-src/shutils/configure_funcs.sh @@ -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 diff --git a/xbps-src/shutils/metadata.sh b/xbps-src/shutils/metadata.sh index b06f567edd5..7e931d09887 100644 --- a/xbps-src/shutils/metadata.sh +++ b/xbps-src/shutils/metadata.sh @@ -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 $? diff --git a/xbps-src/shutils/pkgtarget_funcs.sh.in b/xbps-src/shutils/pkgtarget_funcs.sh.in index 9d8b7da8d5a..b93ae396cc9 100644 --- a/xbps-src/shutils/pkgtarget_funcs.sh.in +++ b/xbps-src/shutils/pkgtarget_funcs.sh.in @@ -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 diff --git a/xbps-src/shutils/stow_funcs.sh b/xbps-src/shutils/stow_funcs.sh index c3952ad2d62..1eb99d8860d 100644 --- a/xbps-src/shutils/stow_funcs.sh +++ b/xbps-src/shutils/stow_funcs.sh @@ -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 diff --git a/xbps-src/shutils/strip_files.sh b/xbps-src/shutils/strip_files.sh index 5d3debc514a..e78d7f17487 100644 --- a/xbps-src/shutils/strip_files.sh +++ b/xbps-src/shutils/strip_files.sh @@ -23,8 +23,6 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #- -. ${XBPS_SHUTILSDIR}/tmpl_funcs.sh - strip_files() { local subpkg diff --git a/xbps-src/shutils/tmpl_funcs.sh.in b/xbps-src/shutils/tmpl_funcs.sh.in index 0978b9e0ced..5dd8c80505d 100644 --- a/xbps-src/shutils/tmpl_funcs.sh.in +++ b/xbps-src/shutils/tmpl_funcs.sh.in @@ -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} diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index a4e8681083d..212b4632896 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -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 ;; *)