Improve the build deps strategy, this is now pkgsrc-alike.
The list of build dependencies is shown, and if any of them has deps, the list is shown for it and so on. This has the effect of installing the deps in the order that they were specified in the template, at the expense of a minor performance ratio. --HG-- extra : convert_revision : 231ed52da19201bdeab65d0f9db78ab83b51e010
This commit is contained in:
parent
f545a7be72
commit
3b3d788c7c
2 changed files with 75 additions and 111 deletions
1
doc/TODO
1
doc/TODO
|
@ -2,7 +2,6 @@ xbps-src:
|
||||||
* Personalized scripts per template to unpack distfiles.
|
* Personalized scripts per template to unpack distfiles.
|
||||||
* Multiple URLs to download source distribution files, aliases, etc.
|
* Multiple URLs to download source distribution files, aliases, etc.
|
||||||
Something like ${sourceforge} to pick up any specified mirror on the list.
|
Something like ${sourceforge} to pick up any specified mirror on the list.
|
||||||
* More robust and fast dependency checking.
|
|
||||||
* Add support to run the prepost-* scripts, so that the same actions are
|
* Add support to run the prepost-* scripts, so that the same actions are
|
||||||
performed in source/bin packages. Use current postinstall_helpers to
|
performed in source/bin packages. Use current postinstall_helpers to
|
||||||
automatically add triggers, shared by src/bin pkgs. [IN PROGRESS]
|
automatically add triggers, shared by src/bin pkgs. [IN PROGRESS]
|
||||||
|
|
|
@ -34,100 +34,66 @@ run_template()
|
||||||
. $XBPS_TEMPLATESDIR/$pkg/template
|
. $XBPS_TEMPLATESDIR/$pkg/template
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Recursive function that founds dependencies in all required
|
# Recursive function that installs all direct and indirect
|
||||||
# packages.
|
# dependencies of a package.
|
||||||
#
|
#
|
||||||
add_dependency_tolist()
|
install_pkg_deps()
|
||||||
{
|
{
|
||||||
local curpkg="$1"
|
local curpkg="$1"
|
||||||
local curpkgname=
|
local saved_prevpkg=$(xbps-pkgdb getpkgname ${2})
|
||||||
|
local curpkgname=$(xbps-pkgdb getpkgname ${curpkg})
|
||||||
local j=
|
local j=
|
||||||
local jver=
|
local jver=
|
||||||
local jname=
|
local jname=
|
||||||
|
local reqver=
|
||||||
|
|
||||||
[ -z "$curpkg" ] && return 1
|
[ -z "$curpkg" ] && return 1
|
||||||
[ -n "$prev_pkg" ] && curpkg=$prev_pkg
|
[ -n "$prev_pkg" ] && curpkg=$prev_pkg
|
||||||
|
|
||||||
curpkgname=$(xbps-pkgdb getpkgname ${curpkg})
|
run_template $curpkgname
|
||||||
run_template $curpkgname
|
|
||||||
|
|
||||||
for j in ${build_depends}; do
|
check_build_depends_pkg $curpkg
|
||||||
#
|
if [ $? -eq 0 ]; then
|
||||||
# Check if dep already installed.
|
echo "==> Dependency $curpkgname requires:"
|
||||||
#
|
for j in ${build_depends}; do
|
||||||
check_installed_pkg $j
|
jname=$(xbps-pkgdb getpkgname ${j})
|
||||||
#
|
jver=$($XBPS_REGPKGDB_CMD version ${jname})
|
||||||
# If dep is already installed, check one more time
|
reqver=$(xbps-pkgdb getpkgversion ${j})
|
||||||
# if all its deps are there and continue.
|
check_installed_pkg $j
|
||||||
#
|
if [ $? -eq 0 ]; then
|
||||||
if [ $? -eq 0 ]; then
|
echo " $jname >= $reqver: found $jname-$jver."
|
||||||
#install_builddeps_required_pkg $j
|
else
|
||||||
installed_deps_list="$j $installed_deps_list"
|
echo " $jname >= $reqver: not found."
|
||||||
continue
|
fi
|
||||||
fi
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
deps_list="$j $deps_list"
|
for j in ${build_depends}; do
|
||||||
[ -n "$prev_pkg" ] && unset prev_pkg
|
#
|
||||||
#
|
# Check if dep already installed.
|
||||||
# Check if dependency needs more deps.
|
#
|
||||||
#
|
check_installed_pkg $j
|
||||||
check_build_depends_pkg $j
|
[ $? -eq 0 ] && continue
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
add_dependency_tolist $j
|
|
||||||
prev_pkg="$j"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
[ -n "$prev_pkg" ] && unset prev_pkg
|
||||||
# Removes duplicate deps in the installed or not installed list.
|
#
|
||||||
#
|
# Check if dependency needs more deps.
|
||||||
find_dupdeps_inlist()
|
#
|
||||||
{
|
check_build_depends_pkg $j
|
||||||
local action="$1"
|
if [ $? -eq 0 ]; then
|
||||||
local tmp_list=
|
install_pkg_deps $j $curpkg
|
||||||
local dup=
|
prev_pkg="$j"
|
||||||
local f=
|
|
||||||
|
|
||||||
[ -z "$action" ] && return 1
|
|
||||||
|
|
||||||
case "$action" in
|
|
||||||
installed)
|
|
||||||
list=$installed_deps_list
|
|
||||||
;;
|
|
||||||
notinstalled)
|
|
||||||
list=$deps_list
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
for f in $list; do
|
|
||||||
if [ -z "$tmp_list" ]; then
|
|
||||||
tmp_list="$f"
|
|
||||||
else
|
else
|
||||||
for i in $tmp_list; do
|
echo "==> Installing $curpkgname dependency: $j"
|
||||||
[ "$f" = "$i" ] && dup=yes
|
jname=$(xbps-pkgdb getpkgname ${j})
|
||||||
done
|
install_pkg $jname
|
||||||
|
|
||||||
[ -z "$dup" ] && tmp_list="$tmp_list $f"
|
|
||||||
unset dup
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
case "$action" in
|
echo "==> Installing $saved_prevpkg dependency: $curpkg"
|
||||||
installed)
|
install_pkg $curpkgname
|
||||||
installed_deps_list="$tmp_list"
|
|
||||||
;;
|
|
||||||
notinstalled)
|
|
||||||
deps_list="$tmp_list"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -136,51 +102,50 @@ find_dupdeps_inlist()
|
||||||
install_dependencies_pkg()
|
install_dependencies_pkg()
|
||||||
{
|
{
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
|
local lpkgname=$(xbps-pkgdb getpkgname ${pkg})
|
||||||
local i=
|
local i=
|
||||||
local ipkgname=
|
local ipkgname=
|
||||||
local iversion=
|
local iversion=
|
||||||
local reqname=
|
|
||||||
local reqvers=
|
local reqvers=
|
||||||
deps_list=
|
local notinstalled_deps=
|
||||||
installed_deps_list=
|
|
||||||
|
|
||||||
[ -z "$pkg" ] && return 1
|
[ -z "$pkg" ] && return 1
|
||||||
|
|
||||||
doing_deps=true
|
doing_deps=true
|
||||||
|
|
||||||
echo "==> Calculating dependency list for $pkgname-$version... "
|
echo "==> Required build dependencies for $pkgname-$version... "
|
||||||
add_dependency_tolist $pkg
|
for i in ${build_depends}; do
|
||||||
find_dupdeps_inlist installed
|
ipkgname=$(xbps-pkgdb getpkgname ${i})
|
||||||
find_dupdeps_inlist notinstalled
|
iversion=$($XBPS_REGPKGDB_CMD version $ipkgname)
|
||||||
|
reqvers=$(xbps-pkgdb getpkgversion ${i})
|
||||||
|
check_installed_pkg $i
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo " $ipkgname >= $reqvers: found $ipkgname-$iversion."
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo " $ipkgname >= $reqvers: not found."
|
||||||
|
notinstalled_deps="$notinstalled_deps $i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
[ -z "$deps_list" -a -z "$installed_deps_list" ] && return 0
|
if [ -z "$notinstalled_deps" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
msg_normal "Required minimal deps for $(basename $pkg):"
|
for i in ${notinstalled_deps}; do
|
||||||
for i in ${installed_deps_list}; do
|
|
||||||
ipkgname=$(xbps-pkgdb getpkgname ${i})
|
ipkgname=$(xbps-pkgdb getpkgname ${i})
|
||||||
iversion=$($XBPS_REGPKGDB_CMD version $ipkgname)
|
run_template $ipkgname
|
||||||
reqvers=$(xbps-pkgdb getpkgversion ${i})
|
|
||||||
echo " $ipkgname >= $reqvers: found $ipkgname-$iversion."
|
|
||||||
done
|
|
||||||
|
|
||||||
for i in ${deps_list}; do
|
|
||||||
reqname=$(xbps-pkgdb getpkgname ${i})
|
|
||||||
reqvers=$(xbps-pkgdb getpkgversion ${i})
|
|
||||||
echo " $reqname >= $reqvers: not found."
|
|
||||||
done
|
|
||||||
|
|
||||||
for i in ${deps_list}; do
|
|
||||||
# skip dup deps
|
|
||||||
check_installed_pkg $i
|
check_installed_pkg $i
|
||||||
[ $? -eq 0 ] && continue
|
[ $? -eq 0 ] && continue
|
||||||
# continue installing deps
|
|
||||||
msg_normal "Installing $pkg dependency: $i."
|
|
||||||
ipkgname=$(xbps-pkgdb getpkgname ${i})
|
|
||||||
install_pkg $ipkgname
|
|
||||||
done
|
|
||||||
|
|
||||||
unset installed_deps_list
|
check_build_depends_pkg $i
|
||||||
unset deps_list
|
if [ $? -eq 1 ]; then
|
||||||
|
echo "==> Installing $lpkgname dependency: $ipkgname"
|
||||||
|
install_pkg $ipkgname
|
||||||
|
else
|
||||||
|
install_pkg_deps $i $pkg
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_builddeps_required_pkg()
|
install_builddeps_required_pkg()
|
||||||
|
@ -197,7 +162,7 @@ install_builddeps_required_pkg()
|
||||||
for dep in ${build_depends}; do
|
for dep in ${build_depends}; do
|
||||||
check_installed_pkg $dep
|
check_installed_pkg $dep
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
msg_normal "Installing $pkg dependency: $dep."
|
msg_normal "Installing $pkgname dependency: $dep."
|
||||||
depname=$(xbps-pkgdb getpkgname ${dep})
|
depname=$(xbps-pkgdb getpkgname ${dep})
|
||||||
install_pkg $depname
|
install_pkg $depname
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue