From a284e52ee80674946fd2553b785bb3e8662eb690 Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pj@pehjota.net>
Date: Wed, 20 Aug 2014 16:42:58 -0400
Subject: feed_find_pkgs(): Take callbacks, not file names

---
(limited to 'lib/cmd')

diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh
index efbd551..02f09bc 100644
--- a/lib/cmd/install.sh
+++ b/lib/cmd/install.sh
@@ -23,6 +23,8 @@ use profile
 use fd
 
 cmd_install_optstring='a:P:m:'
+cmd_install_deps=
+cmd_install_fnames=
 
 cmd_install_main()
 {
@@ -105,14 +107,16 @@ cmd_install_find_pkgs()
 	fopen "${chroot}/etc/opkg/opkg.conf" 'w'
 	opkg_conf_fd=${FD}
 
+	cmd_install_deps=
+	cmd_install_fnames=
+
 	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' \
-			"${chroot}/.prokit/${feed_idx}.depends" \
-			"${chroot}/.prokit/${feed_idx}.filenames" \
+			"$(profile_dep_fields)" profile_include_pkg \
+			cmd_install_deps_cb cmd_install_fname_cb \
 			>>"${chroot}/.prokit/packages"
 	done <<-EOF
 		$(profile_feeds "${mirror}" "${arch}" "${plat}" "${suite}")
@@ -122,3 +126,19 @@ cmd_install_find_pkgs()
 	printf 'arch %s 1\n' 'all' "${arch}" 'src' >&${opkg_conf_fd}
 	fclose ${opkg_conf_fd}
 }
+
+cmd_install_deps_cb()
+{
+	local pkg="${1}"
+	local deps="${2}"
+
+	cmd_install_deps="${cmd_install_deps}${pkg}: ${deps}${LF}"
+}
+
+cmd_install_fname_cb()
+{
+	local pkg="${1}"
+	local fname="${2}"
+
+	cmd_install_fnames="${cmd_install_fnames}${pkg} ${fname}${LF}"
+}
--
cgit v0.9.1