While walking the dependency graph, push the dependencies onto the

stack in the reverse order that show-depends-pkgpaths outputs them.
This makes the top element of the stack the first child dependency
that was marked as "pushed".  This change orders the default "postfix"
output of this script in such a way that for any package listed in
the output, there is no earlier package that depends on it.

In other words, you can take the default output and install from first
to last and never need to install any dependencies, because any
dependencies are guaranteed to have already been installed earlier.
This commit is contained in:
jlam 2006-01-21 22:16:13 +00:00
parent d04be0cdcb
commit ae4a2129c3

View file

@ -1,6 +1,6 @@
#!/usr/bin/awk -f
#
# $NetBSD: depends-depth-first.awk,v 1.4 2006/01/21 21:46:24 jlam Exp $
# $NetBSD: depends-depth-first.awk,v 1.5 2006/01/21 22:16:13 jlam Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@ -221,10 +221,14 @@ function main( cmd, depends_pkgpath, dir, pkgpath) {
while (cmd | getline depends_pkgpath) {
if (status[depends_pkgpath] == "") {
status[depends_pkgpath] = "pushed"
push(dir_stack, depends_pkgpath)
push(tmp_stack, depends_pkgpath)
}
}
close(cmd)
while (!empty(tmp_stack)) {
push(dir_stack, top(tmp_stack))
pop(tmp_stack)
}
}
exit 0
}