[darwinbuild-changes] [798] branches/PR-7798586/darwinup
source_changes at macosforge.org
source_changes at macosforge.org
Sat Mar 27 19:49:34 PDT 2010
Revision: 798
http://trac.macosforge.org/projects/darwinbuild/changeset/798
Author: wsiegrist at apple.com
Date: 2010-03-27 19:49:32 -0700 (Sat, 27 Mar 2010)
Log Message:
-----------
Be smarter about dyld cache updating by tracking when we dirty the target
Modified Paths:
--------------
branches/PR-7798586/darwinup/Depot.cpp
branches/PR-7798586/darwinup/Depot.h
branches/PR-7798586/darwinup/main.cpp
Modified: branches/PR-7798586/darwinup/Depot.cpp
===================================================================
--- branches/PR-7798586/darwinup/Depot.cpp 2010-03-28 02:36:15 UTC (rev 797)
+++ branches/PR-7798586/darwinup/Depot.cpp 2010-03-28 02:49:32 UTC (rev 798)
@@ -60,6 +60,7 @@
m_lock_fd = -1;
m_is_locked = 0;
m_depot_mode = 0750;
+ m_is_dirty = false;
}
Depot::Depot(const char* prefix) {
@@ -67,7 +68,8 @@
m_is_locked = 0;
m_depot_mode = 0750;
m_build = NULL;
-
+ m_is_dirty = false;
+
asprintf(&m_prefix, "%s", prefix);
join_path(&m_depot_path, m_prefix, "/.DarwinDepot");
join_path(&m_database_path, m_depot_path, "/Database-V100");
@@ -92,6 +94,7 @@
const char* Depot::archives_path() { return m_archives_path; }
const char* Depot::downloads_path() { return m_downloads_path; }
const char* Depot::prefix() { return m_prefix; }
+bool Depot::is_dirty() { return m_is_dirty; }
int Depot::connect() {
m_db = new DarwinupDatabase(m_database_path);
@@ -458,6 +461,7 @@
// after saving actual in the rollback archive.
// i.e. user changes since last installation
if (actual_flags != FILE_INFO_IDENTICAL) {
+ this->m_is_dirty = true;
if (INFO_TEST(actual->info(), FILE_INFO_NO_ENTRY)) {
state = 'A';
} else {
@@ -854,6 +858,7 @@
File* preceding = context->depot->file_preceded_by(file);
assert(preceding != NULL);
if (INFO_TEST(preceding->info(), FILE_INFO_NO_ENTRY)) {
+ context->depot->m_is_dirty = true;
state = 'R';
IF_DEBUG("[uninstall] removing file\n");
if (!dryrun && actual && res == 0) res = actual->remove();
@@ -862,6 +867,7 @@
// if it's different from what's already there
uint32_t flags = File::compare(file, preceding);
if (INFO_TEST(flags, FILE_INFO_DATA_DIFFERS)) {
+ context->depot->m_is_dirty = true;
state = 'U';
IF_DEBUG("[uninstall] restoring\n");
if (!dryrun && res == 0) {
@@ -871,6 +877,7 @@
} else if (INFO_TEST(flags, FILE_INFO_MODE_DIFFERS) ||
INFO_TEST(flags, FILE_INFO_GID_DIFFERS) ||
INFO_TEST(flags, FILE_INFO_UID_DIFFERS)) {
+ context->depot->m_is_dirty = true;
state = 'M';
if (!dryrun && res == 0) {
res = preceding->install_info(context->depot->m_prefix);
@@ -1011,7 +1018,6 @@
"============ ======= =================\n");
}
-
int Depot::verify(Archive* archive) {
int res = 0;
this->archive_header();
Modified: branches/PR-7798586/darwinup/Depot.h
===================================================================
--- branches/PR-7798586/darwinup/Depot.h 2010-03-28 02:36:15 UTC (rev 797)
+++ branches/PR-7798586/darwinup/Depot.h 2010-03-28 02:49:32 UTC (rev 798)
@@ -118,6 +118,8 @@
void archive_header();
+ bool is_dirty();
+
protected:
// Serialize access to the Depot via flock(2).
@@ -165,6 +167,7 @@
char* m_build;
int m_lock_fd;
int m_is_locked;
+ bool m_is_dirty; // track if we need to update dyld cache
};
#endif
Modified: branches/PR-7798586/darwinup/main.cpp
===================================================================
--- branches/PR-7798586/darwinup/main.cpp 2010-03-28 02:36:15 UTC (rev 797)
+++ branches/PR-7798586/darwinup/main.cpp 2010-03-28 02:49:32 UTC (rev 798)
@@ -151,7 +151,6 @@
// list handles args optional and in special ways
if (strcmp(argv[0], "list") == 0) {
- update_dyld = false;
res = depot->initialize(false);
if (res == -2) {
// we are not asking to write,
@@ -170,7 +169,6 @@
} else if (argc == 1) {
// other commands which take no arguments
if (strcmp(argv[0], "dump") == 0) {
- update_dyld = false;
if (depot->initialize(false)) exit(11);
depot->dump();
} else {
@@ -195,21 +193,19 @@
// uninstall old archive
if (res == 0) res = depot->uninstall(old);
} else if (strcmp(argv[0], "files") == 0) {
- update_dyld = false;
if (i==1 && depot->initialize(false)) exit(12);
res = depot->process_archive(argv[0], argv[i]);
} else if (strcmp(argv[0], "uninstall") == 0) {
if (i==1 && depot->initialize(true)) exit(15);
res = depot->process_archive(argv[0], argv[i]);
} else if (strcmp(argv[0], "verify") == 0) {
- update_dyld = false;
if (i==1 && depot->initialize(true)) exit(16);
res = depot->process_archive(argv[0], argv[i]);
} else {
usage(progname);
}
}
- if (update_dyld && res == 0) {
+ if (update_dyld && depot->is_dirty() && res == 0) {
res = update_dyld_shared_cache(path);
if (res) fprintf(stderr, "Warning: could not update dyld cache.\n");
res = 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100327/073147f4/attachment.html>
More information about the darwinbuild-changes
mailing list