[darwinbuild-changes] [739] branches/PR-7593824/darwinup
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 5 16:27:10 PST 2010
Revision: 739
http://trac.macosforge.org/projects/darwinbuild/changeset/739
Author: wsiegrist at apple.com
Date: 2010-03-05 16:27:08 -0800 (Fri, 05 Mar 2010)
Log Message:
-----------
Delete tarballs from disk after we uninstall the root.
Modified Paths:
--------------
branches/PR-7593824/darwinup/Depot.cpp
branches/PR-7593824/darwinup/Depot.h
branches/PR-7593824/darwinup/main.cpp
Modified: branches/PR-7593824/darwinup/Depot.cpp
===================================================================
--- branches/PR-7593824/darwinup/Depot.cpp 2010-03-05 23:37:44 UTC (rev 738)
+++ branches/PR-7593824/darwinup/Depot.cpp 2010-03-06 00:27:08 UTC (rev 739)
@@ -713,9 +713,25 @@
return res;
}
-int Depot::prune_archives() {
+// delete the unexpanded tarball from archives storage
+int Depot::prune_archive(Archive* archive) {
int res = 0;
+
+ // clean up database
res = this->m_db->delete_empty_archives();
+ if (res) {
+ fprintf(stderr, "Error: unable to prune archives from database.\n");
+ return res;
+ }
+
+ // clean up disk
+ char path[PATH_MAX];
+ char uuid[37];
+ uuid_unparse_upper(archive->uuid(), uuid);
+ if (res == 0) snprintf(path, PATH_MAX, "%s/%s.tar.bz2", m_archives_path, uuid);
+ if (res == 0) res = unlink(path);
+ if (res) perror(path);
+
return res;
}
@@ -834,7 +850,7 @@
// delete all of the expanded archive backing stores to save disk space
if (res == 0) res = this->prune_directories();
- if (res == 0) res = prune_archives();
+ if (res == 0) res = this->prune_archive(archive);
(void)this->lock(LOCK_SH);
Modified: branches/PR-7593824/darwinup/Depot.h
===================================================================
--- branches/PR-7593824/darwinup/Depot.h 2010-03-05 23:37:44 UTC (rev 738)
+++ branches/PR-7593824/darwinup/Depot.h 2010-03-06 00:27:08 UTC (rev 739)
@@ -139,11 +139,11 @@
int remove(File* file);
int analyze_stage(const char* path, Archive* archive, Archive* rollback, int* rollback_files);
+
+ // removes expand and unexpanded files from archives path
int prune_directories();
+ int prune_archive(Archive* archive);
- // Removes all archive entries which have no corresponding files entries.
- int prune_archives();
-
File* file_superseded_by(File* file);
File* file_preceded_by(File* file);
Modified: branches/PR-7593824/darwinup/main.cpp
===================================================================
--- branches/PR-7593824/darwinup/main.cpp 2010-03-05 23:37:44 UTC (rev 738)
+++ branches/PR-7593824/darwinup/main.cpp 2010-03-06 00:27:08 UTC (rev 739)
@@ -45,7 +45,7 @@
void usage(char* progname) {
fprintf(stderr, "usage: %s [-v] [-p DIR] [command] [args] \n", progname);
- fprintf(stderr, "version: 15 \n");
+ fprintf(stderr, "version: 16 \n");
fprintf(stderr, " \n");
fprintf(stderr, "options: \n");
fprintf(stderr, " -f force operation to succeed at all costs \n");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100305/990486c9/attachment.html>
More information about the darwinbuild-changes
mailing list