summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-08-20 20:36:44 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-08-20 20:36:44 (EDT)
commit324dbc62f2593f4f533e60142516c2d0e6c18a72 (patch)
treeee57f67234cfd3eb89f81c8141c11f857b35c082 /lib
parentcaca6d6da28be37485c367ebcaa2abd46ec0ab34 (diff)
cmd_install_find_pkgs(): Resolve dependencies
Also reduce the number of open() system calls.
Diffstat (limited to 'lib')
-rw-r--r--lib/cmd/install.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh
index 02f09bc..c84161d 100644
--- a/lib/cmd/install.sh
+++ b/lib/cmd/install.sh
@@ -21,6 +21,7 @@ use getopt
use feed
use profile
use fd
+use pkg
cmd_install_optstring='a:P:m:'
cmd_install_deps=
@@ -100,6 +101,7 @@ cmd_install_find_pkgs()
local plat="${4}"
local chroot="${5}"
local opkg_conf_fd=
+ local pkgs_fd=
local feed_idx=
local feed=
@@ -110,14 +112,16 @@ cmd_install_find_pkgs()
cmd_install_deps=
cmd_install_fnames=
+ fopen "${chroot}/.prokit/packages" 'w'
+ pkgs_fd=${FD}
+
while read -r feed_idx feed; do
printf 'src %s %s\n' "${feed_idx}" "${feed}" >&${opkg_conf_fd}
feed_download "${feed}" \
>"${chroot}/var/lib/opkg/lists/${feed_idx}"
feed_find_pkgs "${chroot}/var/lib/opkg/lists/${feed_idx}" \
"$(profile_dep_fields)" profile_include_pkg \
- cmd_install_deps_cb cmd_install_fname_cb \
- >>"${chroot}/.prokit/packages"
+ cmd_install_deps_cb cmd_install_fname_cb >&${pkgs_fd}
done <<-EOF
$(profile_feeds "${mirror}" "${arch}" "${plat}" "${suite}")
EOF
@@ -125,6 +129,10 @@ cmd_install_find_pkgs()
printf '\ndest root /\n' >&${opkg_conf_fd}
printf 'arch %s 1\n' 'all' "${arch}" 'src' >&${opkg_conf_fd}
fclose ${opkg_conf_fd}
+ fclose ${pkgs_fd}
+
+ resolve_deps "$(cat "${chroot}/.prokit/packages")" \
+ "${cmd_install_deps}" | xargs printf '%s\n' | sort -u
}
cmd_install_deps_cb()