I wrote my own tiny versions, just for my edification. First I wrote one in shell, then rewrote it in awk.
The awk version is ~40x faster than the shell version, so I won't bother to post the shell version.
Here's my treegen.awk in case anybody finds it helpful. Caveat: It is extremely minimalistic, so there are no sanity checks for circular dependencies or the like.
#!/usr/bin/awk -f
# usage example: $ treegen.awk labwc.tcz
BEGIN {
LEVEL = 0
LINUX_VERSION = "6.18.2-tinycore64"
MIRROR_PATH = "/path/to/your/local/tinycorelinux/17.x/x86_64/tcz/"
get_dependencies(ARGV[1])
}
function get_dependencies(app, depapp) {
gsub(/KERNEL/,LINUX_VERSION,app)
for (i = 0; i < LEVEL; i++)
printf(" ")
print app
while (getline depapp < MIRROR_PATH app ".dep" > 0) {
# if (depapp ~ /\.tcz/) is there because some .dep files have blank lines.
if (depapp ~ /\.tcz/) {
LEVEL++
get_dependencies(depapp)
}
}
close(MIRROR_PATH app ".dep")
LEVEL--
}
[Edit]: Added comment from next post to code. Rich