summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-01-21 22:16:13 +0000
committerjlam <jlam@pkgsrc.org>2006-01-21 22:16:13 +0000
commita3220baf03076979229498bea49267493f1460ad (patch)
tree83a08591fae337f2d1e93c4e5fdcc3ee4fc8ef31 /mk
parent7d1635064dc43c600519c009f8ec04b2fc6ee795 (diff)
downloadpkgsrc-a3220baf03076979229498bea49267493f1460ad.tar.gz
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.
Diffstat (limited to 'mk')
-rwxr-xr-xmk/scripts/depends-depth-first.awk8
1 files changed, 6 insertions, 2 deletions
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
}