diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-08-20 19:48:27 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-08-20 19:48:27 (EDT) |
commit | b31592685052f937dc92c89cfe976caafbdcd556 (patch) | |
tree | 07dcd88ff37113ca026ae1b2909e5b26e1f37b39 /lib | |
parent | a284e52ee80674946fd2553b785bb3e8662eb690 (diff) |
resolve_deps(): Finish implementing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/local.mk | 1 | ||||
-rw-r--r-- | lib/pkg.sh | 23 |
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/local.mk b/lib/local.mk index 0e8b497..2fc6dfd 100644 --- a/lib/local.mk +++ b/lib/local.mk @@ -5,5 +5,6 @@ pkgdata_sources = \ lib/fd.sh \ lib/control.sh \ lib/feed.sh \ + lib/pkg.sh \ lib/cmd.sh \ lib/profile.sh @@ -22,15 +22,32 @@ _PKG_SM=1 resolve_deps() { - local new_pkgs="${*}" + local new_pkgs="${1}" + local deps="${2}" local all_deps= local new_deps= local pkg= all_deps='' + new_pkgs="${new_pkgs} " while [ "x${new_pkgs}" != 'x' ]; do - all_deps="${all_deps} ${new_pkgs}" + all_deps="${all_deps}${new_pkgs}" new_deps='' for pkg in ${new_pkgs}; do - new_deps="$(sed -n "s/^${pkg} *//p' ")" + case "${pkg}" in + *[!a-z0-9+.-]*) continue;; + esac + new_deps="${new_deps} $(printf '%s' "${deps}" | \ + sed -n "s/^${pkg}: *//p")" + done + new_deps="$(printf '%s\n' ${new_deps} | sort -u)" + new_pkgs='' + for pkg in ${new_deps}; do + if [ "x${all_deps# ${pkg} }" = "x${all_deps}" ]; then + new_pkgs="${new_pkgs}${pkg} " + fi + done + done + + printf '%s\n' "${all_deps% }" } |