diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cmd/install.sh | 26 | ||||
-rw-r--r-- | lib/feed.sh | 27 |
2 files changed, 34 insertions, 19 deletions
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}" +} diff --git a/lib/feed.sh b/lib/feed.sh index 884cd0d..21f0f77 100644 --- a/lib/feed.sh +++ b/lib/feed.sh @@ -23,11 +23,11 @@ _FEED_SM=1 use fd use control -feed_pkg_cb= feed_dep_fields= +feed_pkg_cb= +feed_deps_cb= +feed_fname_cb= feed_pkgs= -feed_deps_fd= -feed_fnames_fd= feed_pkg_include= feed_pkg= feed_deps= @@ -46,26 +46,21 @@ feed_find_pkgs() local feed_idx="${1}" local dep_fields="${2}" local pkg_cb="${3}" - local deps_file="${4}" - local fnames_file="${5}" + local deps_cb="${4}" + local fname_cb="${5}" - feed_pkg_cb="${pkg_cb}" feed_dep_fields=" $(printf '%s ' ${dep_fields})" - feed_pkgs='' - - fopen "${deps_file}" 'a' - feed_deps_fd=${FD} - fopen "${fnames_file}" 'a' - feed_fnames_fd=${FD} + feed_pkg_cb="${pkg_cb}" + feed_deps_cb="${deps_cb}" + feed_fname_cb="${fname_cb}" + feed_pkgs='' feed_pkg_include='false' feed_pkg='' feed_deps='' parse_control "${feed_idx}" feed_field_cb feed_para_cb 'Package' - fclose ${feed_deps_fd} - printf '%s\n' "${feed_pkgs# }" return 0 @@ -79,7 +74,7 @@ feed_field_cb() if [ "x${name}" = 'xPackage' ]; then feed_pkg="${value}" elif [ "x${name}" = 'xFilename' ]; then - printf '%s %s\n' "${feed_pkg}" "${value}" >&${feed_fnames_fd} + ${feed_fname_cb} "${feed_pkg}" "${value}" elif [ "x${feed_dep_fields#* ${name} }" != "x${feed_dep_fields}" ]; then feed_deps="${feed_deps}${value}, " fi @@ -114,7 +109,7 @@ feed_para_cb() done unset IFS - printf '%s%s\n' "${feed_pkg}" "${new_deps}" >&${feed_deps_fd} + ${feed_deps_cb} "${feed_pkg}" "${new_deps# }" feed_pkg_include='false' feed_pkg='' |