From 324dbc62f2593f4f533e60142516c2d0e6c18a72 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 20 Aug 2014 20:36:44 -0400 Subject: cmd_install_find_pkgs(): Resolve dependencies Also reduce the number of open() system calls. --- 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() -- cgit v0.9.1