[darwinbuild-changes] [78] trunk

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


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

Log Message:
-----------
- move the xref.db database file inside .build

Modified Paths:
--------------
    trunk/darwinbuild/darwinbuild
    trunk/darwinxref/DBDataStore.c
    trunk/darwinxref/Makefile

Modified: trunk/darwinbuild/darwinbuild
===================================================================
--- trunk/darwinbuild/darwinbuild	2005-07-13 06:05:59 UTC (rev 77)
+++ trunk/darwinbuild/darwinbuild	2006-10-04 08:43:06 UTC (rev 78)
@@ -83,6 +83,7 @@
 ###
 
 PREFIX=/usr/local
+XREFDB=.build/xref.db
 build=""
 depsbuild=""
 CHROOTED="YES"
@@ -119,8 +120,8 @@
 	echo "$build" > .build/build
 	while [ "$build" != "" ]; do
 		Download .build "$build".plist http://darwinsource.opendarwin.org/plists/
-		$PREFIX/bin/darwinxref -f.xref.db "-b$build" loadIndex .build/"$build".plist
-		build=$($PREFIX/bin/darwinxref -f.xref.db "-b$build" inherits)
+		$PREFIX/bin/darwinxref "-f$XREFDB" "-b$build" loadIndex .build/"$build".plist
+		build=$($PREFIX/bin/darwinxref "-f$XREFDB" "-b$build" inherits)
 	done
 	exit 0
 fi
@@ -169,7 +170,7 @@
 
 BuildRoot="$DARWIN_BUILDROOT/BuildRoot"
 mkdir -p "$BuildRoot"
-export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/.xref.db"
+export DARWINXREF_DB_FILE="$DARWIN_BUILDROOT/$XREFDB"
 
 ###
 ### Check and see wether there is a sources directory set in the

Modified: trunk/darwinxref/DBDataStore.c
===================================================================
--- trunk/darwinxref/DBDataStore.c	2005-07-13 06:05:59 UTC (rev 77)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 08:43:06 UTC (rev 78)
@@ -58,12 +58,18 @@
 	char* errmsg; \
 	va_start(args, fmt); \
 	sqlite3* db = _DBPluginGetDataStorePtr(); \
-	char *query = sqlite3_vmprintf(fmt, args); \
-	res = sqlite3_exec(db, query, callback, context, &errmsg); \
-	if (res != SQLITE_OK) { \
-		fprintf(stderr, "Error: %s (%d)\n  SQL: %s\n", errmsg, res, query); \
+	if (db) { \
+		char *query = sqlite3_vmprintf(fmt, args); \
+		res = sqlite3_exec(db, query, callback, context, &errmsg); \
+		if (res != SQLITE_OK) { \
+			fprintf(stderr, "Error: %s (%d)\n  SQL: %s\n", errmsg, res, query); \
+		} \
+		sqlite3_free(query); \
+	} else { \
+		fprintf(stderr, "Error: database not open.\n"); \
+		res = SQLITE_ERROR; \
 	} \
-	sqlite3_free(query);
+	va_end(args);
 
 int SQL(const char* fmt, ...) {
 	int res;
@@ -164,17 +170,20 @@
 void SQL_NOERR(char* sql) {
 	char* errmsg;
 	sqlite3* db = _DBPluginGetDataStorePtr();
-	int res = sqlite3_exec(db, sql, NULL, NULL, &errmsg);
-	if (res != SQLITE_OK && res != SQLITE_ERROR) {
-		fprintf(stderr, "Error: %s (%d)\n", errmsg, res);
-	} else {
-		res = 0;
+	if (db) {
+		int res = sqlite3_exec(db, sql, NULL, NULL, &errmsg);
+		if (res != SQLITE_OK && res != SQLITE_ERROR) {
+			fprintf(stderr, "Error: %s (%d)\n", errmsg, res);
+		}
 	}
 }
 
 int DBDataStoreInitialize(const char* datafile) {
-	sqlite3_open(datafile, (sqlite3**)&__DBDataStore);
-	if (__DBDataStore == NULL) return -1;
+	int res = sqlite3_open(datafile, (sqlite3**)&__DBDataStore);
+	if (res != SQLITE_OK) {
+		sqlite3_close(__DBDataStore);
+		__DBDataStore = NULL;
+	}
 
 	char* table = "CREATE TABLE properties (build TEXT, project TEXT, property TEXT, key TEXT, value TEXT)";
 	char* index = "CREATE INDEX properties_index ON properties (build, project, property, key, value)";

Modified: trunk/darwinxref/Makefile
===================================================================
--- trunk/darwinxref/Makefile	2005-07-13 06:05:59 UTC (rev 77)
+++ trunk/darwinxref/Makefile	2006-10-04 08:43:06 UTC (rev 78)
@@ -17,7 +17,7 @@
 
 ### todo: --with-plugin-path configuration
 CFLAGS+= \
-	-DDEFAULT_DB_FILE=\".xref.db\" \
+	-DDEFAULT_DB_FILE=\".build/xref.db\" \
 	-DDEFAULT_PLUGIN_PATH=\"$(DATDIR)/plugins\"
 
 ### todo: --with-tcl-plugins configuration

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


More information about the darwinbuild-changes mailing list