From a3220baf03076979229498bea49267493f1460ad Mon Sep 17 00:00:00 2001 From: jlam Date: Sat, 21 Jan 2006 22:16:13 +0000 Subject: 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. --- mk/scripts/depends-depth-first.awk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mk') diff --git a/mk/scripts/depends-depth-first.awk b/mk/scripts/depends-depth-first.awk index 3a56145304e..ff82427e2cd 100755 --- a/mk/scripts/depends-depth-first.awk +++ b/mk/scripts/depends-depth-first.awk @@ -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 } -- cgit v1.2.3