1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-09-28 12:22:39 -06:00

kiss: initial depends clean up

This commit is contained in:
Dylan Araps 2021-07-27 20:42:43 +03:00
parent 354bc63cc3
commit 8ee6a3948d
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

14
kiss
View File

@ -542,10 +542,11 @@ pkg_extract() {
pkg_depends() { pkg_depends() {
# Resolve all dependencies and generate an ordered list. The deepest # Resolve all dependencies and generate an ordered list. The deepest
# dependencies are listed first and then the parents in reverse order. # dependencies are listed first and then the parents in reverse order.
contains "$deps" "$1" || { ! contains "$deps" "$1" || return 0
# Filter out non-explicit, already installed packages. # Filter out non-explicit, already installed packages.
null "$3" || ok "$2" || contains "$explicit" "$1" || null "$3" || ok "$2" || contains "$explicit" "$1" ||
! [ -d "$sys_db/$1" ] || return ! [ -d "$sys_db/$1" ] || return 0
# Detect circular dependencies and bail out. # Detect circular dependencies and bail out.
# Looks for multiple repeating patterns of (dep dep_parent) (5 is max). # Looks for multiple repeating patterns of (dep dep_parent) (5 is max).
@ -554,18 +555,16 @@ pkg_depends() {
*" ${4##* } "*" $1 "\ *" ${4##* } "*" $1 "\
*" ${4##* } "*" $1 "\ *" ${4##* } "*" $1 "\
*" ${4##* } "*" $1 "\ *" ${4##* } "*" $1 "\
*" ${4##* } "*" $1 "\ *" ${4##* } "*" $1 "*)
*)
die "Circular dependency detected $1 <> ${4##* }" die "Circular dependency detected $1 <> ${4##* }"
esac esac
# Packages which exist and have depends.
! _pkg_find "$1" || ! [ -e "$repo_dir/depends" ] || ! _pkg_find "$1" || ! [ -e "$repo_dir/depends" ] ||
# Recurse through the dependencies of the child packages. # Recurse through the dependencies of the child packages.
while read -r dep dep_type || ok "$dep"; do while read -r dep dep_type || ok "$dep"; do
ok "${dep##\#*}" || continue ! ok "${dep##\#*}" || pkg_depends "$dep" '' "$3" "$4 $1" "$dep_type"
pkg_depends "$dep" '' "$3" "$4 $1" "$dep_type"
done < "$repo_dir/depends" || : done < "$repo_dir/depends" || :
# Add parent to dependencies list. # Add parent to dependencies list.
@ -573,7 +572,6 @@ pkg_depends() {
deps="$deps $1" deps="$deps $1"
fi fi
} }
}
pkg_order() { pkg_order() {
# Order a list of packages based on dependence and take into account # Order a list of packages based on dependence and take into account