forked from kiss-community/kiss
kiss-new: Initial dependency solver
This commit is contained in:
parent
2698a51f5e
commit
4a84fe78f5
30
kiss-new
30
kiss-new
@ -103,7 +103,7 @@ pkg_list() {
|
|||||||
# Also warn if a package is missing its version file.
|
# Also warn if a package is missing its version file.
|
||||||
for pkg; do
|
for pkg; do
|
||||||
[ -d "$pkg" ] || {
|
[ -d "$pkg" ] || {
|
||||||
log "Package '$pkg' is not installed."
|
log "Package '$pkg' is not installed." >&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +159,32 @@ pkg_sources() {
|
|||||||
done < "$repo_dir/sources"
|
done < "$repo_dir/sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_depends() {
|
||||||
|
# Resolve all dependencies and install them in the right order.
|
||||||
|
for pkg; do
|
||||||
|
# Find the package's repository files. This needs to keep
|
||||||
|
# happening as we can't store this data in any kind of data
|
||||||
|
# structure.
|
||||||
|
repo_dir=$(pkg_search "$pkg")
|
||||||
|
|
||||||
|
# Package doesn't depend on anything, skip it.
|
||||||
|
[ -f "$repo_dir/depends" ] || continue
|
||||||
|
|
||||||
|
while read -r dep _; do
|
||||||
|
pkg_list "$dep" >/dev/null || {
|
||||||
|
case $missing_deps in
|
||||||
|
# Dependency is already in list, skip it.
|
||||||
|
*" $dep "*) ;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
missing_deps="$missing_deps $dep "
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
done < "$repo_dir/depends"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
pkg_build() {
|
pkg_build() {
|
||||||
# Build packages and turn them into packaged tarballs. This function
|
# Build packages and turn them into packaged tarballs. This function
|
||||||
# also checks checksums, downloads sources and ensure all dependencies
|
# also checks checksums, downloads sources and ensure all dependencies
|
||||||
@ -184,6 +210,8 @@ pkg_build() {
|
|||||||
# Die here as packages without checksums were found above.
|
# Die here as packages without checksums were found above.
|
||||||
[ "$no_checkums" ] &&
|
[ "$no_checkums" ] &&
|
||||||
die "Run '$kiss checksum ${no_checkums% }' to generate checksums."
|
die "Run '$kiss checksum ${no_checkums% }' to generate checksums."
|
||||||
|
|
||||||
|
pkg_depends "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_checksums() {
|
pkg_checksums() {
|
||||||
|
Loading…
Reference in New Issue
Block a user