[darwinbuild-changes] [777] branches/PR-7748469/darwinup
source_changes at macosforge.org
source_changes at macosforge.org
Sat Mar 13 13:34:13 PST 2010
Revision: 777
http://trac.macosforge.org/projects/darwinbuild/changeset/777
Author: wsiegrist at apple.com
Date: 2010-03-13 13:34:13 -0800 (Sat, 13 Mar 2010)
Log Message:
-----------
Uninstall children before parents to fix getting "!" status letters
Modified Paths:
--------------
branches/PR-7748469/darwinup/DB.cpp
branches/PR-7748469/darwinup/DB.h
branches/PR-7748469/darwinup/Depot.cpp
Modified: branches/PR-7748469/darwinup/DB.cpp
===================================================================
--- branches/PR-7748469/darwinup/DB.cpp 2010-03-13 20:53:34 UTC (rev 776)
+++ branches/PR-7748469/darwinup/DB.cpp 2010-03-13 21:34:13 UTC (rev 777)
@@ -386,12 +386,18 @@
return DB_ERROR;
}
-int DarwinupDatabase::get_files(uint8_t*** data, uint32_t* count, Archive* archive) {
- int res = this->get_all_ordered("files__archive",
+int DarwinupDatabase::get_files(uint8_t*** data, uint32_t* count, Archive* archive, bool reverse) {
+ int order = ORDER_BY_ASC;
+ const char* name = "files_archive";
+ if (reverse) {
+ order = ORDER_BY_DESC;
+ name = "files_archive_reverse";
+ }
+ int res = this->get_all_ordered(name,
data, count,
this->m_files_table,
this->m_files_table->column(8), // order by path
- ORDER_BY_ASC,
+ order,
1,
this->m_files_table->column(1),
'=', archive->serial());
Modified: branches/PR-7748469/darwinup/DB.h
===================================================================
--- branches/PR-7748469/darwinup/DB.h 2010-03-13 20:53:34 UTC (rev 776)
+++ branches/PR-7748469/darwinup/DB.h 2010-03-13 21:34:13 UTC (rev 777)
@@ -87,7 +87,7 @@
int get_file_serials(uint64_t** serials, uint32_t* count);
int get_file_serial_from_archive(Archive* archive, const char* path,
uint64_t** serial);
- int get_files(uint8_t*** data, uint32_t* count, Archive* archive);
+ int get_files(uint8_t*** data, uint32_t* count, Archive* archive, bool reverse);
int file_offset(int column);
int update_file(uint64_t serial, Archive* archive, uint32_t info, mode_t mode,
uid_t uid, gid_t gid, Digest* digest, const char* path);
Modified: branches/PR-7748469/darwinup/Depot.cpp
===================================================================
--- branches/PR-7748469/darwinup/Depot.cpp 2010-03-13 20:53:34 UTC (rev 776)
+++ branches/PR-7748469/darwinup/Depot.cpp 2010-03-13 21:34:13 UTC (rev 777)
@@ -324,6 +324,30 @@
return c;
}
+struct InstallContext {
+ InstallContext(Depot* d, Archive* a) {
+ depot = d;
+ archive = a;
+ files_modified = 0;
+ files_added = 0;
+ files_removed = 0;
+ files_to_remove = new SerialSet();
+ reverse_files = false;
+ }
+
+ ~InstallContext() {
+ delete files_to_remove;
+ }
+
+ Depot* depot;
+ Archive* archive;
+ uint64_t files_modified;
+ uint64_t files_added;
+ uint64_t files_removed;
+ SerialSet* files_to_remove; // for uninstall
+ bool reverse_files; // for uninstall
+};
+
int Depot::iterate_archives(ArchiveIteratorFunc func, void* context) {
int res = 0;
uint32_t count = 0;
@@ -341,7 +365,8 @@
int res = DB_OK;
uint8_t** filelist;
uint32_t count;
- res = this->m_db->get_files(&filelist, &count, archive);
+ bool reverse = ((InstallContext*)context)->reverse_files;
+ res = this->m_db->get_files(&filelist, &count, archive, reverse);
if (FOUND(res)) {
for (uint32_t i=0; i < count; i++) {
File* file = this->m_db->make_file(filelist[i]);
@@ -542,30 +567,6 @@
return res;
}
-
-
-struct InstallContext {
- InstallContext(Depot* d, Archive* a) {
- depot = d;
- archive = a;
- files_modified = 0;
- files_added = 0;
- files_removed = 0;
- files_to_remove = new SerialSet();
- }
-
- ~InstallContext() {
- delete files_to_remove;
- }
-
- Depot* depot;
- Archive* archive;
- uint64_t files_modified;
- uint64_t files_added;
- uint64_t files_removed;
- SerialSet* files_to_remove; // for uninstall
-};
-
int Depot::backup_file(File* file, void* ctx) {
InstallContext* context = (InstallContext*)ctx;
int res = 0;
@@ -954,6 +955,7 @@
}
InstallContext context(this, archive);
+ context.reverse_files = true; // uninstall children before parents
if (res == 0) res = this->iterate_files(archive, &Depot::uninstall_file, &context);
if (!dryrun) {
@@ -1197,7 +1199,7 @@
uint8_t** filelist;
uint8_t* data;
uint32_t count;
- res = this->m_db->get_files(&filelist, &count, archive);
+ res = this->m_db->get_files(&filelist, &count, archive, false);
if (FOUND(res)) {
for (uint32_t i=0; i < count; i++) {
File* file = this->m_db->make_file(filelist[i]);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100313/39ae6138/attachment.html>
More information about the darwinbuild-changes
mailing list