Add a function to remove duplicate deps and print the ones that are
installed as well as the ones are not installed. --HG-- extra : convert_revision : 8412f9ed0a59f83932a98da1e1309b7d3044b669
This commit is contained in:
parent
63f8f0912d
commit
15f4d9b5dd
1 changed files with 67 additions and 18 deletions
85
pkgfs.sh
85
pkgfs.sh
|
@ -794,25 +794,19 @@ add_dependency_tolist()
|
||||||
|
|
||||||
for i in $($db_cmd -V btree $PKGFS_BUILD_DEPS_DB ${curpkg%-[0-9]*}); do
|
for i in $($db_cmd -V btree $PKGFS_BUILD_DEPS_DB ${curpkg%-[0-9]*}); do
|
||||||
#
|
#
|
||||||
# origin_deps is used to only show the list of
|
|
||||||
# dependencies for the origin template once.
|
|
||||||
#
|
|
||||||
[ -n "$origin_deps" ] && \
|
|
||||||
echo -n " $i: "
|
|
||||||
#
|
|
||||||
# Check if dep already installed.
|
# Check if dep already installed.
|
||||||
#
|
#
|
||||||
if [ -r "$reg_pkgdb" ]; then
|
if [ -r "$reg_pkgdb" ]; then
|
||||||
check_installed_tmpl $i
|
check_installed_tmpl $i
|
||||||
|
#
|
||||||
|
# If dep is already installed, put it on the
|
||||||
|
# installed deps list and continue.
|
||||||
|
#
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
[ -n "$origin_deps" ] && \
|
installed_deps_list="$i $installed_deps_list"
|
||||||
echo "already installed."
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$origin_deps" ] &&
|
|
||||||
echo "not installed."
|
|
||||||
|
|
||||||
deps_list="$i $deps_list"
|
deps_list="$i $deps_list"
|
||||||
[ -n "$prev_pkg" ] && unset prev_pkg
|
[ -n "$prev_pkg" ] && unset prev_pkg
|
||||||
#
|
#
|
||||||
|
@ -820,7 +814,6 @@ add_dependency_tolist()
|
||||||
#
|
#
|
||||||
check_build_depends_tmpl $i
|
check_build_depends_tmpl $i
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
unset origin_deps
|
|
||||||
add_dependency_tolist $i
|
add_dependency_tolist $i
|
||||||
prev_pkg="$i"
|
prev_pkg="$i"
|
||||||
fi
|
fi
|
||||||
|
@ -828,6 +821,55 @@ add_dependency_tolist()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Removes duplicate deps in the installed or not installed list.
|
||||||
|
#
|
||||||
|
find_dupdeps_inlist()
|
||||||
|
{
|
||||||
|
local action="$1"
|
||||||
|
local tmp_list=
|
||||||
|
local dup=
|
||||||
|
|
||||||
|
[ -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
|
||||||
|
for i in $tmp_list; do
|
||||||
|
[ "$f" = "$i" ] && dup=yes
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -z "$dup" ] && tmp_list="$tmp_list $f"
|
||||||
|
unset dup
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
installed)
|
||||||
|
installed_deps_list="$tmp_list"
|
||||||
|
;;
|
||||||
|
notinstalled)
|
||||||
|
deps_list="$tmp_list"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Installs all dependencies required by a package.
|
# Installs all dependencies required by a package.
|
||||||
#
|
#
|
||||||
|
@ -835,26 +877,33 @@ install_dependency_tmpl()
|
||||||
{
|
{
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
deps_list=
|
deps_list=
|
||||||
origin_deps=yes
|
installed_deps_list=
|
||||||
|
|
||||||
[ -z "$pkg" ] && return 1
|
[ -z "$pkg" ] && return 1
|
||||||
|
|
||||||
doing_deps=true
|
doing_deps=true
|
||||||
|
|
||||||
echo "==> Required dependencies for $(basename $pkg):"
|
|
||||||
|
|
||||||
add_dependency_tolist $pkg
|
add_dependency_tolist $pkg
|
||||||
|
find_dupdeps_inlist installed
|
||||||
|
find_dupdeps_inlist notinstalled
|
||||||
|
|
||||||
|
echo "==> Required dependencies for $(basename $pkg):"
|
||||||
|
for i in ${installed_deps_list}; do
|
||||||
|
echo " $i: already installed."
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in ${deps_list}; do
|
||||||
|
echo " $i: not installed."
|
||||||
|
done
|
||||||
|
|
||||||
for i in ${deps_list}; do
|
for i in ${deps_list}; do
|
||||||
# skip dup deps
|
# skip dup deps
|
||||||
check_installed_tmpl $i
|
|
||||||
[ "$?" -eq 0 ] && continue
|
|
||||||
echo "=> Installing dependency: $i"
|
echo "=> Installing dependency: $i"
|
||||||
install_tmpl ${i%-[0-9]*}
|
install_tmpl ${i%-[0-9]*}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset installed_deps_list
|
||||||
unset deps_list
|
unset deps_list
|
||||||
unset origin_deps
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue