Revision: 961 http://trac.macosforge.org/projects/darwinbuild/changeset/961 Author: mww@apple.com Date: 2011-11-04 15:59:53 -0700 (Fri, 04 Nov 2011) Log Message: ----------- <rdar://problem/10363375> darwinup should rebuild xpc service cache where applicable Modified Paths: -------------- trunk/darwinup/Depot.cpp trunk/darwinup/Depot.h trunk/darwinup/Utils.cpp trunk/darwinup/Utils.h trunk/darwinup/main.cpp Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 + /branches/PR-10363375:959-960 /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 Modified: trunk/darwinup/Depot.cpp =================================================================== --- trunk/darwinup/Depot.cpp 2011-11-04 19:00:16 UTC (rev 960) +++ trunk/darwinup/Depot.cpp 2011-11-04 22:59:53 UTC (rev 961) @@ -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: trunk/darwinup/Depot.h =================================================================== --- trunk/darwinup/Depot.h 2011-11-04 19:00:16 UTC (rev 960) +++ trunk/darwinup/Depot.h 2011-11-04 22:59:53 UTC (rev 961) @@ -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: trunk/darwinup/Utils.cpp =================================================================== --- trunk/darwinup/Utils.cpp 2011-11-04 19:00:16 UTC (rev 960) +++ trunk/darwinup/Utils.cpp 2011-11-04 22:59:53 UTC (rev 961) @@ -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: trunk/darwinup/Utils.h =================================================================== --- trunk/darwinup/Utils.h 2011-11-04 19:00:16 UTC (rev 960) +++ trunk/darwinup/Utils.h 2011-11-04 22:59:53 UTC (rev 961) @@ -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: trunk/darwinup/main.cpp =================================================================== --- trunk/darwinup/main.cpp 2011-11-04 19:00:16 UTC (rev 960) +++ trunk/darwinup/main.cpp 2011-11-04 22:59:53 UTC (rev 961) @@ -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"
participants (1)
-
source_changes@macosforge.org