[darwinbuild-changes] [286] trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 02:02:20 PDT 2006


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

Log Message:
-----------
embed project plists as xar subdocs when packaging.
Submitted by:  bbraun@

Modified Paths:
--------------
    trunk/CHANGES
    trunk/darwinbuild/packageRoots.sh

Added Paths:
-----------
    trunk/darwinxref/plugins/exportProject.c

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2005-09-30 01:09:51 UTC (rev 285)
+++ trunk/CHANGES	2006-10-04 09:02:20 UTC (rev 286)
@@ -2,6 +2,9 @@
 -----------------------------------
 
 Release 0.X.Y [now]
+	- darwinbuild: add support to packageRoots -x to embed project
+	  plists as xar subdocs (bbraun)
+	- darwinxref: add exportProject verb (bbraun)
 	- darwinbuild: Add support for "src_foo.c.add" patches as overlays
 	- updated Makfile to honor DSTROOT
 	- darwinxref: Added additive and subtractive dependencies

Modified: trunk/darwinbuild/packageRoots.sh
===================================================================
--- trunk/darwinbuild/packageRoots.sh	2005-09-30 01:09:51 UTC (rev 285)
+++ trunk/darwinbuild/packageRoots.sh	2006-10-04 09:02:20 UTC (rev 286)
@@ -118,7 +118,7 @@
 		;;
 	    xar)
 		FILE="$DARWIN_BUILDROOT/Packages/$PROJ$SFX.xar"
-		ARGS="-c -f"
+		ARGS="-s /tmp/$PROJ.$$.xml -n darwinbuild -c -f"
 		SRCARG="."
 		;;
 	    *)
@@ -131,10 +131,15 @@
 	if [ -n "$build_version" -a \
 	    "$SOURCEDIR" -nt "$FILE" ]; then
 	    echo "$PROJVERS~$build_version"
+	    $VERBOSE cd "$DARWIN_BUILDROOT"
+	    cd "$DARWIN_BUILDROOT"
+	    $VERBOSE "$DARWINXREF" exportProject -xml $PROJ 
+	    "$DARWINXREF" exportProject -xml $PROJ > /tmp/$PROJ.$$.xml
 	    $VERBOSE cd "$SOURCEDIR"
 	    cd "$SOURCEDIR"
 	    $VERBOSE $TOOL $ARGS "$FILE" "$SRCARG"
 	    $NORUN $TOOL $ARGS "$FILE" "$SRCARG"
+	    rm -f /tmp/$PROJ.$$.xml
 	fi
 	done
 }

Added: trunk/darwinxref/plugins/exportProject.c
===================================================================
--- trunk/darwinxref/plugins/exportProject.c	                        (rev 0)
+++ trunk/darwinxref/plugins/exportProject.c	2006-10-04 09:02:20 UTC (rev 286)
@@ -0,0 +1,108 @@
+/*
+ * 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"
+#include <CoreFoundation/CoreFoundation.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static int run(CFArrayRef argv) {
+	int res = 0;
+	CFIndex count = CFArrayGetCount(argv);
+	if (count > 2)  return -1;
+	int xml = 0, i;
+	CFMutableDictionaryRef dict, preplist;
+	CFDictionaryRef project;
+	char *cproj;
+	CFStringRef projname;
+	CFArrayRef builds;
+	const void *ssites, *bsites;
+	CFStringRef build = DBGetCurrentBuild();
+
+	if (count == 2) {
+		CFStringRef arg = CFArrayGetValueAtIndex(argv, 0);
+		xml = CFEqual(arg, CFSTR("-xml"));
+		// -xml is the only supported option
+		if (!xml) return -1;
+		projname = CFArrayGetValueAtIndex(argv, 1);
+	} else if (count == 1 ) {
+		projname = CFArrayGetValueAtIndex(argv, 0);
+	} else
+		return -1;
+
+	builds = DBCopyBuildInheritance(build);
+	dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks);
+
+	preplist = (CFMutableDictionaryRef)DBCopyProjectPlist(build, NULL);
+	ssites = CFDictionaryGetValue(preplist, CFSTR("source_sites"));
+	bsites = CFDictionaryGetValue(preplist, CFSTR("binary_sites"));
+
+	preplist = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks);
+	for( i = 0; i < CFArrayGetCount(builds); i++ ) {
+		build = CFArrayGetValueAtIndex(builds, i);
+		project = DBCopyProjectPlist(build, projname);
+		if( CFDictionaryGetCount(project) > 0 )
+			break;
+	}
+	if( CFDictionaryGetCount(project) < 1 )
+		return -1;
+	CFDictionaryAddValue(dict, projname, project);
+	CFRelease(project);
+	CFDictionarySetValue(preplist, CFSTR("build"), build);
+	CFDictionarySetValue(preplist, CFSTR("projects"), dict);
+	if(ssites) CFDictionarySetValue(preplist, CFSTR("source_sites"), ssites);
+	if(bsites) CFDictionarySetValue(preplist, CFSTR("binary_sites"), bsites);
+
+	CFPropertyListRef plist = preplist;
+	if (xml) {
+		CFDataRef data = CFPropertyListCreateXMLData(NULL, plist);
+		res = write(STDOUT_FILENO, CFDataGetBytePtr(data), CFDataGetLength(data));
+	} else {
+		res = writePlist(stdout, plist, 0);
+	}
+	return res;
+}
+
+static CFStringRef usage() {
+	return CFRetain(CFSTR("[-xml] project"));
+}
+
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
+	
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("exportProject"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
+}
+


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

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


More information about the darwinbuild-changes mailing list