[darwinbuild-changes] [752] branches/PR-7593824/darwinup

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 9 13:55:55 PST 2010


Revision: 752
          http://trac.macosforge.org/projects/darwinbuild/changeset/752
Author:   wsiegrist at apple.com
Date:     2010-03-09 13:55:54 -0800 (Tue, 09 Mar 2010)
Log Message:
-----------
Record build when inserting archives. Switch to PlistBuddy to avoid spawning Perl with every run.

Modified Paths:
--------------
    branches/PR-7593824/darwinup/DB.cpp
    branches/PR-7593824/darwinup/DB.h
    branches/PR-7593824/darwinup/Depot.cpp
    branches/PR-7593824/darwinup/Depot.h
    branches/PR-7593824/darwinup/Utils.cpp

Modified: branches/PR-7593824/darwinup/DB.cpp
===================================================================
--- branches/PR-7593824/darwinup/DB.cpp	2010-03-09 19:43:26 UTC (rev 751)
+++ branches/PR-7593824/darwinup/DB.cpp	2010-03-09 21:55:54 UTC (rev 752)
@@ -112,7 +112,7 @@
 }
 
 uint64_t DarwinupDatabase::insert_archive(uuid_t uuid, uint32_t info, const char* name, 
-										  time_t date_added) {
+										  time_t date_added, char* build) {
 	
 	int res = this->insert(this->m_archives_table,
 						   (uint8_t*)uuid,
@@ -120,7 +120,8 @@
 						   name,
 						   (uint64_t)date_added,
 						   (uint64_t)0,
-						   (uint64_t)info);
+						   (uint64_t)info,
+						   build);
 	if (res != SQLITE_OK) {
 		fprintf(stderr, "Error: unable to insert archive %s: %s \n",
 				name, this->error());

Modified: branches/PR-7593824/darwinup/DB.h
===================================================================
--- branches/PR-7593824/darwinup/DB.h	2010-03-09 19:43:26 UTC (rev 751)
+++ branches/PR-7593824/darwinup/DB.h	2010-03-09 21:55:54 UTC (rev 752)
@@ -74,7 +74,7 @@
 	int      deactivate_archive(uint64_t serial);
 	int      update_archive(uint64_t serial, uuid_t uuid, const char* name,
 							time_t date_added, uint32_t active, uint32_t info);
-	uint64_t insert_archive(uuid_t uuid, uint32_t info, const char* name, time_t date);
+	uint64_t insert_archive(uuid_t uuid, uint32_t info, const char* name, time_t date, char* build);
 	int      delete_empty_archives();
 	int      delete_archive(Archive* archive);
 	int      delete_archive(uint64_t serial);

Modified: branches/PR-7593824/darwinup/Depot.cpp
===================================================================
--- branches/PR-7593824/darwinup/Depot.cpp	2010-03-09 19:43:26 UTC (rev 751)
+++ branches/PR-7593824/darwinup/Depot.cpp	2010-03-09 21:55:54 UTC (rev 752)
@@ -54,6 +54,7 @@
 	m_database_path = NULL;
 	m_archives_path = NULL;
 	m_downloads_path = NULL;
+	m_build = NULL;
 	m_db = NULL;
 	m_lock_fd = -1;
 	m_is_locked = 0;
@@ -64,6 +65,7 @@
 	m_lock_fd = -1;
 	m_is_locked = 0;
 	m_depot_mode = 0750;
+	m_build = NULL;
 
 	asprintf(&m_prefix, "%s", prefix);
 	join_path(&m_depot_path, m_prefix, "/.DarwinDepot");
@@ -138,7 +140,9 @@
 		if (res) return res;
 		res = this->lock(LOCK_SH);
 		if (res) return res;
-		m_is_locked = 1;		
+		m_is_locked = 1;
+		res = build_number_for_path(&m_build, m_prefix);
+		if (res) return res;
 	}
 
 	int exists = is_regular_file(m_database_path);
@@ -1107,9 +1111,10 @@
 	// Don't insert an archive that is already in the database
 	assert(archive->serial() == 0);
 	archive->m_serial = m_db->insert_archive(archive->uuid(),
-											  archive->info(),
-											  archive->name(),
-											  archive->date_installed());
+											 archive->info(),
+											 archive->name(),
+											 archive->date_installed(),
+											 m_build);
 	return archive->m_serial == 0;
 }
 

Modified: branches/PR-7593824/darwinup/Depot.h
===================================================================
--- branches/PR-7593824/darwinup/Depot.h	2010-03-09 19:43:26 UTC (rev 751)
+++ branches/PR-7593824/darwinup/Depot.h	2010-03-09 21:55:54 UTC (rev 752)
@@ -159,6 +159,7 @@
 	char*		m_database_path;
 	char*		m_archives_path;
 	char*		m_downloads_path;
+	char*       m_build;
 	int		    m_lock_fd;
 	int         m_is_locked;
 };

Modified: branches/PR-7593824/darwinup/Utils.cpp
===================================================================
--- branches/PR-7593824/darwinup/Utils.cpp	2010-03-09 19:43:26 UTC (rev 751)
+++ branches/PR-7593824/darwinup/Utils.cpp	2010-03-09 21:55:54 UTC (rev 752)
@@ -297,12 +297,12 @@
 		return res;
 	}
 	
-	// use xpath to read version plist
+	// read version plist to get build number
 	snprintf(system, PATH_MAX, "%s/System/Library/CoreServices/SystemVersion.plist", parent);
 	const char* args[] = {
-		"/usr/bin/xpath",
+		"/usr/libexec/PlistBuddy",
+		"-c", "Print ProductBuildVersion",
 		system,
-		"/plist/dict/key[text()='ProductBuildVersion']/following-sibling::*[1]/text()",
 		NULL
 	};
 	int pfd[2];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100309/393eb674/attachment-0001.html>


More information about the darwinbuild-changes mailing list