[darwinbuild-changes] [22] trunk/darwinxref

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


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

Log Message:
-----------
- added experimental darwinports support

Added Paths:
-----------
    trunk/darwinxref/plugins-darwinports/
    trunk/darwinxref/plugins-darwinports/categories.tcl
    trunk/darwinxref/plugins-darwinports/depends_build.tcl
    trunk/darwinxref/plugins-darwinports/depends_lib.tcl
    trunk/darwinxref/plugins-darwinports/description.tcl
    trunk/darwinxref/plugins-darwinports/homepage.tcl
    trunk/darwinxref/plugins-darwinports/loadPortfile.c
    trunk/darwinxref/plugins-darwinports/long_description.tcl
    trunk/darwinxref/plugins-darwinports/maintainers.tcl
    trunk/darwinxref/plugins-darwinports/master_sites.tcl
    trunk/darwinxref/plugins-darwinports/patch_sites.tcl
    trunk/darwinxref/plugins-darwinports/platforms.tcl

Added: trunk/darwinxref/plugins-darwinports/categories.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/categories.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/categories.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName categories
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach cat [DBCopyPropArray $build $project categories] {
+		puts "$cat"
+	}
+}


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

Added: trunk/darwinxref/plugins-darwinports/depends_build.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/depends_build.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/depends_build.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName depends_build
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach dep [DBCopyPropArray $build $project depends_build] {
+		puts "$dep"
+	}
+}


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

Added: trunk/darwinxref/plugins-darwinports/depends_lib.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/depends_lib.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/depends_lib.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName depends_lib
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach dep [DBCopyPropArray $build $project depends_lib] {
+		puts "$dep"
+	}
+}


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

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


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

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


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

Added: trunk/darwinxref/plugins-darwinports/loadPortfile.c
===================================================================
--- trunk/darwinxref/plugins-darwinports/loadPortfile.c	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/loadPortfile.c	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,175 @@
+/*
+ * 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 "DBPluginPriv.h"
+#include <sys/stat.h>
+
+#include <tcl.h>
+
+// XXX
+extern CFStringRef cfstr_tcl(Tcl_Obj* obj);
+extern Tcl_Obj* tcl_cfstr(CFStringRef str);
+extern Tcl_Obj* tcl_cfarray(CFArrayRef);
+
+
+char *DefaultsTrace(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags) {
+	const char* expr = (const char*)clientData;
+	// Only set the default value if the variable has not been explicitly set.
+	if (Tcl_GetVar2(interp, name1, name2, TCL_GLOBAL_ONLY) == NULL) {
+		Tcl_VarEval(interp, "return ", expr, NULL);
+		Tcl_Obj* result = Tcl_GetObjResult(interp);
+			CFStringRef str = cfstr_tcl(result);
+//cfprintf(stderr, "DEFAULT: %s: %@\n", name1, str);
+			CFRelease(str);
+		Tcl_ObjSetVar2(interp, Tcl_NewStringObj(name1, strlen(name1)), NULL, result, TCL_GLOBAL_ONLY);
+	}
+	return NULL;
+}
+
+int UnknownCmd(ClientData data, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]) {
+	CFStringRef project = *((CFStringRef*)data);
+	CFStringRef build = DBGetCurrentBuild();
+	CFStringRef property = cfstr_tcl(objv[1]);
+
+	//////
+	// Special hacks
+	//////
+	if (CFEqual(property, CFSTR("name"))) {
+		*((CFStringRef*)data) = cfstr_tcl(objv[2]);
+		Tcl_ObjSetVar2(interp, objv[1], NULL, objv[2], TCL_GLOBAL_ONLY);
+	}
+
+	CFTypeID type = DBCopyPropType(property);
+	if (type == CFStringGetTypeID()) {
+		// concatenate all the remaining arguments into one string and store it.
+		CFIndex i;
+		CFMutableStringRef newstr = CFStringCreateMutable(NULL, 0);
+		for (i = 2; i < objc; ++i) {
+			CFStringRef str = cfstr_tcl(objv[i]);
+			if (i > 2) CFStringAppend(newstr, CFSTR(" "));
+			CFStringAppend(newstr, str);
+			CFRelease(str);
+		}
+		DBSetPropString(build, project, property, newstr);
+		Tcl_Obj* tcl_newstr = tcl_cfstr(newstr);
+		Tcl_ObjSetVar2(interp, objv[1], NULL, tcl_newstr, TCL_GLOBAL_ONLY);
+		CFRelease(newstr);
+//cfprintf(stderr, "PROPERTY: %@\n", property);
+	} else if (type == CFArrayGetTypeID()) {
+		// add each remaining argument as a new string in an array
+		CFIndex i;
+		CFMutableArrayRef array = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
+		for (i = 2; i < objc; ++i) {
+			CFStringRef str = cfstr_tcl(objv[i]);
+			CFArrayAppendValue(array, str);
+			CFRelease(str);
+		}
+		DBSetPropArray(build, project, property, array);
+		Tcl_Obj* tcl_array = tcl_cfarray(array);
+		Tcl_ObjSetVar2(interp, objv[1], NULL, tcl_array, TCL_GLOBAL_ONLY);
+		CFRelease(array);
+//cfprintf(stderr, "PROPERTY: %@\n", property);
+	} else if (type == CFDictionaryGetTypeID()) {
+		// XXX: not yet supported
+	} else {
+//cfprintf(stderr, "SKIPPED: %@\n", property);
+	}
+	return TCL_OK;
+}
+
+#define DEFAULT(interp, name, value) Tcl_TraceVar2((interp), (name), NULL, TCL_TRACE_READS | TCL_GLOBAL_ONLY, DefaultsTrace, (ClientData)(value))
+
+static int run(CFArrayRef argv) {
+	int res = 0;
+	CFStringRef project = NULL;
+	CFIndex count = CFArrayGetCount(argv);
+	if (count != 1)  return -1;
+	char* filename = strdup_cfstr(CFArrayGetValueAtIndex(argv, 0));
+
+	Tcl_Interp* interp = Tcl_CreateInterp();
+
+	Tcl_CreateObjCommand(interp, "unknown", UnknownCmd, (ClientData)&project, (Tcl_CmdDeleteProc *)NULL);
+
+	DEFAULT(interp, "portdbpath", "/opt/local/var/db/dports");
+	DEFAULT(interp, "portbuildpath", "[file join $portdbpath build XXX-$name]");
+
+
+	DEFAULT(interp, "portname", "$name");
+	DEFAULT(interp, "portversion", "$version");
+	DEFAULT(interp, "portrevision", "$revision");
+	DEFAULT(interp, "portepoch", "$epoch");
+
+	DEFAULT(interp, "revision", "0");
+	DEFAULT(interp, "epoch", "0");
+
+	DEFAULT(interp, "prefix", "/opt/local");
+	DEFAULT(interp, "x11prefix", "/usr/X11R6");
+	DEFAULT(interp, "workdir", "work");
+	DEFAULT(interp, "workpath", "[file join $portbuildpath $workdir]");
+	DEFAULT(interp, "worksrcdir", "$distname");
+	DEFAULT(interp, "worksrcpath", "[file join $workpath $worksrcdir]");
+
+	
+	DEFAULT(interp, "destpath", "${workpath}/${destdir}");
+	DEFAULT(interp, "destroot", "$destpath");
+	DEFAULT(interp, "destdir", "destroot");
+	DEFAULT(interp, "distname", "${name}-${version}");
+	DEFAULT(interp, "extract.suffix", ".tar.gz");
+
+	DBBeginTransaction();
+	if (Tcl_EvalFile(interp, filename) != TCL_OK) {
+		DBRollbackTransaction();
+		Tcl_Obj* result = Tcl_GetObjResult(interp);
+		CFStringRef str = cfstr_tcl(result);
+		cfprintf(stderr, "Tcl error in %s: %@\n", filename, str);
+		CFRelease(str);
+	} else {
+		DBCommitTransaction();
+	}
+	free(filename);
+	return res;
+}
+
+static CFStringRef usage() {
+	return CFRetain(CFSTR("<Portfile>"));
+}
+
+int initialize(int version) {
+	//if ( version < kDBPluginCurrentVersion ) return -1;
+	
+	DBPluginSetType(kDBPluginBasicType);
+	DBPluginSetName(CFSTR("loadPortfile"));
+	DBPluginSetRunFunc(&run);
+	DBPluginSetUsageFunc(&usage);
+	return 0;
+}


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

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


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

Added: trunk/darwinxref/plugins-darwinports/maintainers.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/maintainers.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/maintainers.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName maintainers
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach maint [DBCopyPropArray $build $project maintainers] {
+		puts "$maint"
+	}
+}


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

Added: trunk/darwinxref/plugins-darwinports/master_sites.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/master_sites.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/master_sites.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName master_sites 
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach site [DBCopyPropArray $build $project master_sites] {
+		puts "$site"
+	}
+}


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

Added: trunk/darwinxref/plugins-darwinports/patch_sites.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/patch_sites.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/patch_sites.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName patch_sites 
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach site [DBCopyPropArray $build $project patch_sites] {
+		puts "$site"
+	}
+}


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

Added: trunk/darwinxref/plugins-darwinports/platforms.tcl
===================================================================
--- trunk/darwinxref/plugins-darwinports/platforms.tcl	                        (rev 0)
+++ trunk/darwinxref/plugins-darwinports/platforms.tcl	2006-10-04 08:37:52 UTC (rev 22)
@@ -0,0 +1,15 @@
+DBPluginSetName platforms
+DBPluginSetType property
+DBPluginSetDatatype array
+
+proc usage {} {
+	return {[<project>]}
+}
+
+proc run {args} {
+	set project [lindex $args 0]
+	set build [DBGetCurrentBuild]
+	foreach plat [DBCopyPropArray $build $project platforms] {
+		puts "$plat"
+	}
+}


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

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


More information about the darwinbuild-changes mailing list