[darwinbuild-changes] [48] trunk/darwinxref/plugins

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


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

Log Message:
-----------
- added plugins: currentBuild, darwin, macosx, mergeBuild
- don't print "(null)" when values are not found in the database

Modified Paths:
--------------
    trunk/darwinxref/plugins/dependencies.c
    trunk/darwinxref/plugins/original.c
    trunk/darwinxref/plugins/source_sites.c
    trunk/darwinxref/plugins/target.c
    trunk/darwinxref/plugins/version.c

Added Paths:
-----------
    trunk/darwinxref/plugins/currentBuild.tcl
    trunk/darwinxref/plugins/darwin.tcl
    trunk/darwinxref/plugins/macosx.tcl
    trunk/darwinxref/plugins/mergeBuild.c

Added: trunk/darwinxref/plugins/currentBuild.tcl
===================================================================
--- trunk/darwinxref/plugins/currentBuild.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins/currentBuild.tcl	2006-10-04 08:41:41 UTC (rev 48)
@@ -0,0 +1,10 @@
+DBPluginSetName currentBuild
+DBPluginSetType basic
+
+proc usage {} {
+	return {}
+}
+
+proc run {args} {
+	puts [DBGetCurrentBuild]
+}


Property changes on: trunk/darwinxref/plugins/currentBuild.tcl
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/darwinxref/plugins/darwin.tcl
===================================================================
--- trunk/darwinxref/plugins/darwin.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins/darwin.tcl	2006-10-04 08:41:41 UTC (rev 48)
@@ -0,0 +1,13 @@
+DBPluginSetName darwin
+DBPluginSetType property
+DBPluginSetDatatype string
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	puts [DBCopyPropString $build $project darwin]
+}


Property changes on: trunk/darwinxref/plugins/darwin.tcl
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/darwinxref/plugins/dependencies.c
===================================================================
--- trunk/darwinxref/plugins/dependencies.c	2005-07-09 00:14:02 UTC (rev 47)
+++ trunk/darwinxref/plugins/dependencies.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -104,6 +104,6 @@
 			}
 			++type;
 		}
+		CFRelease(dependencies);
 	}
-	CFRelease(dependencies);
 }

Added: trunk/darwinxref/plugins/macosx.tcl
===================================================================
--- trunk/darwinxref/plugins/macosx.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins/macosx.tcl	2006-10-04 08:41:41 UTC (rev 48)
@@ -0,0 +1,13 @@
+DBPluginSetName macosx
+DBPluginSetType property
+DBPluginSetDatatype string
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	puts [DBCopyPropString $build $project macosx]
+}


Property changes on: trunk/darwinxref/plugins/macosx.tcl
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/darwinxref/plugins/mergeBuild.c
===================================================================
--- trunk/darwinxref/plugins/mergeBuild.c	                        (rev 0)
+++ trunk/darwinxref/plugins/mergeBuild.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ * 
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include "DBPlugin.h"
+
+static void addValues(const void* key, const void* value, void* context);
+
+int run(CFArrayRef argv) {
+	int res = 0;
+	CFIndex count = CFArrayGetCount(argv);
+	if (count != 2)  return -1;
+	
+	CFStringRef oldbuild = CFArrayGetValueAtIndex(argv, 0);
+	CFStringRef newbuild = CFArrayGetValueAtIndex(argv, 1);
+
+	if (!DBHasBuild(oldbuild)) cfprintf(stderr, "Error: no such build: %@\n", oldbuild);
+	if (!DBHasBuild(newbuild)) cfprintf(stderr, "Error: no such build: %@\n", newbuild);
+
+	CFPropertyListRef oldplist = DBCopyBuildPlist(oldbuild);
+	CFPropertyListRef newplist = DBCopyBuildPlist(newbuild);
+
+	CFDictionaryRef oldprojects = CFDictionaryGetValue(oldplist, CFSTR("projects"));
+	CFDictionaryRef newprojects = CFDictionaryGetValue(newplist, CFSTR("projects"));
+		
+	CFArrayRef names = dictionaryGetSortedKeys(newprojects);
+
+	CFIndex i;
+	count = CFArrayGetCount(names);
+	for (i = 0; i < count; ++i) {
+		CFStringRef name = CFArrayGetValueAtIndex(names, i);
+		CFDictionaryRef oldproj = CFDictionaryGetValue(oldprojects, name);
+		CFDictionaryRef newproj = CFDictionaryGetValue(newprojects, name);
+
+		if (oldproj && newproj) {
+			CFDictionaryApplyFunction(oldproj, addValues, (void*)newproj);
+		}
+	}
+	DBSetPlist(newbuild, newplist);
+	CFRelease(oldplist);
+	CFRelease(newplist);
+	
+	return res;
+}
+
+static void addValues(const void* key, const void* value, void* context) {
+	CFDictionaryAddValue((CFMutableDictionaryRef)context, (CFStringRef)key, (CFTypeRef)value);
+}
+
+static CFStringRef usage() {
+	return CFRetain(CFSTR("<old build> <new build>"));
+}
+
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
+	
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("mergeBuild"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
+}


Property changes on: trunk/darwinxref/plugins/mergeBuild.c
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/darwinxref/plugins/original.c
===================================================================
--- trunk/darwinxref/plugins/original.c	2005-07-09 00:14:02 UTC (rev 47)
+++ trunk/darwinxref/plugins/original.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -37,7 +37,7 @@
 	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = CFArrayGetValueAtIndex(argv, 0);
 	CFStringRef original = DBCopyPropString(build, project, CFSTR("original"));
-	cfprintf(stdout, "%@\n", original);
+	if (original) cfprintf(stdout, "%@\n", original);
 	return 0;
 }
 

Modified: trunk/darwinxref/plugins/source_sites.c
===================================================================
--- trunk/darwinxref/plugins/source_sites.c	2005-07-09 00:14:02 UTC (rev 47)
+++ trunk/darwinxref/plugins/source_sites.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -41,7 +41,7 @@
 		project = CFArrayGetValueAtIndex(argv, 0);
 	}
 	CFArrayRef source_sites = DBCopyPropArray(build, project, CFSTR("source_sites"));
-	count = CFArrayGetCount(source_sites);
+	count = source_sites ? CFArrayGetCount(source_sites) : 0;
 	if (count == 0) {
 		source_sites = DBCopyPropArray(build, NULL, CFSTR("source_sites"));
 		count = CFArrayGetCount(source_sites);

Modified: trunk/darwinxref/plugins/target.c
===================================================================
--- trunk/darwinxref/plugins/target.c	2005-07-09 00:14:02 UTC (rev 47)
+++ trunk/darwinxref/plugins/target.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -37,7 +37,7 @@
 	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef project = CFArrayGetValueAtIndex(argv, 0);
 	CFStringRef target = DBCopyPropString(build, project, CFSTR("target"));
-	cfprintf(stdout, "%@\n", target);
+	if (target) cfprintf(stdout, "%@\n", target);
 	return 0;
 }
 

Modified: trunk/darwinxref/plugins/version.c
===================================================================
--- trunk/darwinxref/plugins/version.c	2005-07-09 00:14:02 UTC (rev 47)
+++ trunk/darwinxref/plugins/version.c	2006-10-04 08:41:41 UTC (rev 48)
@@ -35,7 +35,7 @@
 void printProjectVersion(CFStringRef project) {
 	CFStringRef build = DBGetCurrentBuild();
 	CFStringRef version = DBCopyPropString(build, project, CFSTR("version"));
-	cfprintf(stdout, "%@-%@\n", project, version);
+	if (version) cfprintf(stdout, "%@-%@\n", project, version);
 }
 
 static int run(CFArrayRef argv) {

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


More information about the darwinbuild-changes mailing list