aboutsummaryrefslogtreecommitdiff
path: root/kiss-new
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 07:42:27 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 07:42:27 +0000
commit4b171150d6b4c111bc5daca39c76f5504bbad46d (patch)
treeae295a82320158161c7a14bf12111439898d3372 /kiss-new
parent4f66e2adc38a12da3d8dd345013075e9cd76077a (diff)
downloadcpt-4b171150d6b4c111bc5daca39c76f5504bbad46d.tar.gz
kiss-new: Initial dependency solver
FossilOrigin-Name: 65c145f86da78d214e14a6831470f4f36a5aae1ad56f8086af248b3e1e5bc0fc
Diffstat (limited to 'kiss-new')
-rwxr-xr-xkiss-new30
1 files changed, 29 insertions, 1 deletions
diff --git a/kiss-new b/kiss-new
index f229c0c..c4916e0 100755
--- a/kiss-new
+++ b/kiss-new
@@ -103,7 +103,7 @@ pkg_list() {
# Also warn if a package is missing its version file.
for pkg; do
[ -d "$pkg" ] || {
- log "Package '$pkg' is not installed."
+ log "Package '$pkg' is not installed." >&2
return 1
}
@@ -159,6 +159,32 @@ pkg_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() {
# Build packages and turn them into packaged tarballs. This function
# also checks checksums, downloads sources and ensure all dependencies
@@ -184,6 +210,8 @@ pkg_build() {
# Die here as packages without checksums were found above.
[ "$no_checkums" ] &&
die "Run '$kiss checksum ${no_checkums% }' to generate checksums."
+
+ pkg_depends "$@"
}
pkg_checksums() {