pkgfs.sh: misc bugs fixed and performance improvements.

- Fixed a bug with XBPS_MAKEJOBS that only worked for the first package.
- Fixed a bug in dependency handling when pkg A depends on B, and
  package C that needs B wasn't installed, so it was skipped.
- Improvement to not source the template file if it's currently sourced.

--HG--
extra : convert_revision : 27b7e95b2360258db8da92063f173da7558be9ba
This commit is contained in:
Juan RP 2008-10-13 10:28:51 +02:00
parent ef4a64bdba
commit cdf77cd1ad
1 changed files with 21 additions and 9 deletions

30
xbps.sh
View File

@ -274,7 +274,9 @@ setup_tmpl()
local pkg="$1" local pkg="$1"
if [ -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then if [ -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl if [ "$pkgname" != "$pkg" ]; then
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
fi
prepare_tmpl prepare_tmpl
else else
echo "*** ERROR: cannot find \`$pkg´ template file ***" echo "*** ERROR: cannot find \`$pkg´ template file ***"
@ -712,7 +714,7 @@ build_src_phase()
unset rbbf unset rbbf
[ -z "$make_build_target" ] && make_build_target= [ -z "$make_build_target" ] && make_build_target=
[ -n "$XBPS_MAKEJOBS" ] && XBPS_MAKEJOBS="-j$XBPS_MAKEJOBS" [ -n "$XBPS_MAKEJOBS" ] && makejobs="-j$XBPS_MAKEJOBS"
# Export make_env vars. # Export make_env vars.
for f in ${make_env}; do for f in ${make_env}; do
@ -722,18 +724,21 @@ build_src_phase()
# #
# Build package via make. # Build package via make.
# #
${make_cmd} ${XBPS_MAKEJOBS} ${make_build_args} ${make_build_target} ${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "*** ERROR building (make stage) \`$pkg' ***" echo "*** ERROR building (make stage) \`$pkg' ***"
exit 1 exit 1
fi fi
unset makejobs
# #
# Run template stuff before installing. # Run template stuff before installing.
# #
local rbif="$XBPS_TEMPLATESDIR/$pkgname-runstuff-before-install.sh" local rbif="$XBPS_TEMPLATESDIR/$pkgname-runstuff-before-install.sh"
[ -f $rbif ] && . $rbif [ -f $rbif ] && . $rbif
[ -n "$run_stuff_before_install_cmd" ] && ${run_stuff_before_install_cmd} [ -n "$run_stuff_before_install_cmd" ] && \
${run_stuff_before_install_cmd}
unset rbif unset rbif
$touch_cmd -f $XBPS_BUILD_DONE $touch_cmd -f $XBPS_BUILD_DONE
@ -866,10 +871,11 @@ add_dependency_tolist()
if [ -r "$XBPS_REGPKG_DB" ]; then if [ -r "$XBPS_REGPKG_DB" ]; then
check_installed_pkg $i ${i##[aA-zZ]*-} check_installed_pkg $i ${i##[aA-zZ]*-}
# #
# If dep is already installed, put it on the # If dep is already installed, check one more time
# installed deps list and continue. # if all its deps are there and continue.
# #
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_builddeps_required_pkg $i
installed_deps_list="$i $installed_deps_list" installed_deps_list="$i $installed_deps_list"
continue continue
fi fi
@ -1006,7 +1012,9 @@ check_installed_pkg()
[ -z "$pkg" -o -z "$reqver" -o ! -r $XBPS_REGPKG_DB ] && return 1 [ -z "$pkg" -o -z "$reqver" -o ! -r $XBPS_REGPKG_DB ] && return 1
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
fi
reqver="$(echo $reqver | $sed_cmd 's|[[:punct:]]||g;s|[[:alpha:]]||g')" reqver="$(echo $reqver | $sed_cmd 's|[[:punct:]]||g;s|[[:alpha:]]||g')"
@ -1261,7 +1269,9 @@ stow_pkg()
if [ -n "$stow_flag" ]; then if [ -n "$stow_flag" ]; then
pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl
run_file $pkg if [ "$pkgname" != "$pkg" ]; then
run_file $pkg
fi
pkg=$pkgname-$version pkg=$pkgname-$version
# #
# You cannot stow a meta-template. # You cannot stow a meta-template.
@ -1330,7 +1340,9 @@ unstow_pkg()
exit 1 exit 1
fi fi
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl if [ "$pkgname" != "$pkg" ]; then
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
fi
# #
# You cannot unstow a meta-template. # You cannot unstow a meta-template.