Using this file, I would like to print a tree of package dependencies, given a single base package. For example, take the Bash package
@ bash
# few lines removed
requires: coreutils libintl8 libncursesw10 libreadline7 _update-info-dir cygwin
I would like find-like output of the required packages, partial example
bash
bash coreutils
bash coreutils libattr1
bash coreutils libattr1 libintl8
bash coreutils libattr1 libintl8 libiconv2
bash coreutils libattr1 libintl8 _autorebase
bash coreutils libattr1 libintl8 _autorebase rebase
bash coreutils libattr1 libintl8 _autorebase rebase dash
bash coreutils libattr1 libintl8 _autorebase rebase dash cygwin
bash coreutils libattr1 libintl8 _autorebase rebase dash cygwin base-cygwin
I have this command but it does not recurse
#!awk -f
$1 == "@" {
pkg = $2
}
$1 == "requires:" {
for (i=2; i<=NF; i++)
reqs[pkg][i-1] = $i
}
END {
query = "bash"
for (pkg in reqs[query]) {
print reqs[query][pkg]
}
}