[darwinbuild-changes] [959] branches/PR-10363375/darwinup

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 4 12:00:16 PDT 2011


Revision: 959
          http://trac.macosforge.org/projects/darwinbuild/changeset/959
Author:   mww at apple.com
Date:     2011-11-04 12:00:14 -0700 (Fri, 04 Nov 2011)
Log Message:
-----------
xpchelper support.

Modified Paths:
--------------
    branches/PR-10363375/darwinup/Depot.cpp
    branches/PR-10363375/darwinup/Depot.h
    branches/PR-10363375/darwinup/Utils.cpp
    branches/PR-10363375/darwinup/Utils.h
    branches/PR-10363375/darwinup/main.cpp

Modified: branches/PR-10363375/darwinup/Depot.cpp
===================================================================
--- branches/PR-10363375/darwinup/Depot.cpp	2011-11-03 00:02:38 UTC (rev 958)
+++ branches/PR-10363375/darwinup/Depot.cpp	2011-11-04 19:00:14 UTC (rev 959)
@@ -62,6 +62,7 @@
 	m_depot_mode = 0750;
 	m_is_dirty = false;
 	m_modified_extensions = false;
+	m_modified_xpc_services = false;
 }
 
 Depot::Depot(const char* prefix) {
@@ -71,6 +72,7 @@
 	m_build = NULL;
 	m_is_dirty = false;
 	m_modified_extensions = false;
+	m_modified_xpc_services = false;
 	
 	asprintf(&m_prefix, "%s", prefix);
 	join_path(&m_depot_path, m_prefix, "/.DarwinDepot");
@@ -98,6 +100,7 @@
 const char* Depot::prefix()                   { return m_prefix; }
 bool        Depot::is_dirty()                 { return m_is_dirty; }
 bool        Depot::has_modified_extensions()  { return m_modified_extensions; }
+bool        Depot::has_modified_xpc_services(){ return m_modified_xpc_services; }
 
 int Depot::connect() {
 	m_db = new DarwinupDatabase(m_database_path);
@@ -542,6 +545,17 @@
 					this->m_modified_extensions = true;
 				}
 
+				if (!this->m_modified_xpc_services &&
+					(strstr(file->path(), ".xpc/") != NULL)) {
+
+					bool modified = (has_suffix(file->path(), "Info.plist") ||
+									 has_suffix(file->path(), "framework.sb"));
+
+					if (modified) {
+						IF_DEBUG("[analyze]    xpc service detected\n");
+						this->m_modified_xpc_services = true;
+					}
+				}
 			}
 
 			// if file == actual, but actual != preceding, then an external

Modified: branches/PR-10363375/darwinup/Depot.h
===================================================================
--- branches/PR-10363375/darwinup/Depot.h	2011-11-03 00:02:38 UTC (rev 958)
+++ branches/PR-10363375/darwinup/Depot.h	2011-11-04 19:00:14 UTC (rev 959)
@@ -133,6 +133,7 @@
 	
 	bool    is_dirty();
 	bool    has_modified_extensions();
+	bool	has_modified_xpc_services();
 	
 protected:
 
@@ -183,6 +184,7 @@
 	int         m_is_locked;
 	bool        m_is_dirty; // track if we need to update dyld cache
 	bool        m_modified_extensions; // track if we need to touch /S/L/E
+	bool        m_modified_xpc_services; // track if we need to run xpchelper
 
 };
 

Modified: branches/PR-10363375/darwinup/Utils.cpp
===================================================================
--- branches/PR-10363375/darwinup/Utils.cpp	2011-11-03 00:02:38 UTC (rev 958)
+++ branches/PR-10363375/darwinup/Utils.cpp	2011-11-04 19:00:14 UTC (rev 959)
@@ -361,6 +361,42 @@
 	return res;
 }
 
+int update_xpc_services_cache(const char* path) {
+	extern uint32_t verbosity;
+	int res;
+	char* base;
+	res = find_base_system_path(&base, path);
+	if (res) return res;
+
+	if (verbosity) {
+		fprintf(stdout, "Updating xpc services cache for %s ...", base);
+		fflush(stdout);
+	}
+
+	char* toolpath;
+	join_path(&toolpath, base, "/usr/libexec/xpchelper");
+
+	struct stat sb;
+	res = stat(toolpath, &sb);
+	if (res) {
+		return 1;
+	}
+
+	const char* args[] = {
+		toolpath,
+		"--rebuild-cache",
+		"--root", base,
+		NULL
+	};
+	res = exec_with_args(args);
+
+	if (verbosity) fprintf(stdout, "Done updating xpc cache\n");
+
+	free(toolpath);
+	free(base);
+	return res;
+}
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 int build_number_for_path(char** build, const char* path) {
 	int res = 0;

Modified: branches/PR-10363375/darwinup/Utils.h
===================================================================
--- branches/PR-10363375/darwinup/Utils.h	2011-11-03 00:02:38 UTC (rev 958)
+++ branches/PR-10363375/darwinup/Utils.h	2011-11-04 19:00:14 UTC (rev 959)
@@ -80,6 +80,7 @@
 
 int find_base_system_path(char** output, const char* path);
 int update_dyld_shared_cache(const char* path);
+int update_xpc_services_cache(const char* path);
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 int build_number_for_path(char** build, const char* path);

Modified: branches/PR-10363375/darwinup/main.cpp
===================================================================
--- branches/PR-10363375/darwinup/main.cpp	2011-11-03 00:02:38 UTC (rev 958)
+++ branches/PR-10363375/darwinup/main.cpp	2011-11-04 19:00:14 UTC (rev 959)
@@ -280,6 +280,15 @@
 			}
 			free(sle_path);
 		}
+#endif
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+		if (!disable_automation && depot->has_modified_xpc_services() && res == 0) {
+			res = update_xpc_services_cache(path);
+			if (res) fprintf(stderr, "Warning: could not update xpc services cache.\n");
+			res = 0;
+		}
+#endif
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 		if (restart && res == 0) {
 			res = tell_finder_to_restart();
 			if (res) fprintf(stderr, "Warning: tried to tell Finder to restart"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20111104/3af44709/attachment.html>


More information about the darwinbuild-changes mailing list