[darwinbuild-changes] [77] trunk/darwinxref/plugins/dependencies.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:43:04 PDT 2006


Revision: 77
          http://trac.macosforge.org/projects/darwinbuild/changeset/77
Author:   ssen
Date:     2006-10-04 01:43:04 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Indent the dependency information, which makes it a lot more
useful for manual inspection and determining why a dependency
was pulled in. Since this output is typicall parsed by
a shell script, the extra spaces shouldn't matter, but we can
make this an option if necessary

Modified Paths:
--------------
    trunk/darwinxref/plugins/dependencies.c

Modified: trunk/darwinxref/plugins/dependencies.c
===================================================================
--- trunk/darwinxref/plugins/dependencies.c	2005-07-13 04:33:51 UTC (rev 76)
+++ trunk/darwinxref/plugins/dependencies.c	2006-10-04 08:43:04 UTC (rev 77)
@@ -32,7 +32,7 @@
 
 #include "DBPlugin.h"
 
-void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project);
+void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project, int indentLevel);
 
 
 static int run(CFArrayRef argv) {
@@ -44,15 +44,15 @@
 	CFStringRef type = CFArrayGetValueAtIndex(argv, 0);
 	if (CFEqual(type, CFSTR("-run"))) {
 		CFStringRef types[] = { CFSTR("lib"), CFSTR("run"), NULL };
-		printDependencies(types, types, NULL, DBGetCurrentBuild(), project);
+		printDependencies(types, types, NULL, DBGetCurrentBuild(), project, 0);
 	} else if (CFEqual(type, CFSTR("-build"))) {
 		CFStringRef types[] = { CFSTR("lib"), CFSTR("run"), CFSTR("build"), NULL };
 		CFStringRef recursive[] = { CFSTR("lib"), CFSTR("run"), NULL };
-		printDependencies(types, recursive, NULL, DBGetCurrentBuild(), project);
+		printDependencies(types, recursive, NULL, DBGetCurrentBuild(), project, 0);
 	} else if (CFEqual(type, CFSTR("-header"))) {
 		CFStringRef types[] = { CFSTR("header"), NULL };
 		CFStringRef recursive[] = { NULL };
-		printDependencies(types, recursive, NULL, DBGetCurrentBuild(), project);
+		printDependencies(types, recursive, NULL, DBGetCurrentBuild(), project, 0);
 	} else {
 		return -1;
 	}
@@ -75,7 +75,7 @@
 }
 
 
-void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project) {
+void printDependencies(CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project, int indentLevel) {
 	if (!visited) visited = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
 	
 	CFDictionaryRef dependencies = DBCopyPropDictionary(build, project, CFSTR("dependencies"));
@@ -95,9 +95,13 @@
 				for (i = 0; i < count; ++i) {
 					CFStringRef newproject = CFArrayGetValueAtIndex(array, i);
 					if (!CFSetContainsValue(visited, newproject)) {
-						cfprintf(stdout, "%@\n", newproject);
+					  // use the indent level as a minimum
+					  // precision for the string ""
+						cfprintf(stdout, "%*s%@\n",
+							 indentLevel, "",
+							 newproject);
 						CFSetAddValue(visited, newproject);
-						printDependencies(recursiveTypes, recursiveTypes, visited, build, newproject);
+						printDependencies(recursiveTypes, recursiveTypes, visited, build, newproject, indentLevel+1);
 					}
 				}
 				

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/18200b66/attachment-0001.html


More information about the darwinbuild-changes mailing list