[darwinbuild-changes] [754] branches/PR-7593824/darwinup

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 9 15:56:14 PST 2010


Revision: 754
          http://trac.macosforge.org/projects/darwinbuild/changeset/754
Author:   wsiegrist at apple.com
Date:     2010-03-09 15:56:11 -0800 (Tue, 09 Mar 2010)
Log Message:
-----------
Add build to archive list. Shorten date list. Refactor common display printing.

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

Modified: branches/PR-7593824/darwinup/Depot.cpp
===================================================================
--- branches/PR-7593824/darwinup/Depot.cpp	2010-03-09 22:39:02 UTC (rev 753)
+++ branches/PR-7593824/darwinup/Depot.cpp	2010-03-09 23:56:11 UTC (rev 754)
@@ -916,14 +916,22 @@
 	return 0;
 }
 
+void Depot::archive_header() {
+	fprintf(stdout, "%-6s %-36s  %-12s  %-7s  %s\n", 
+			"Serial", "UUID", "Date", "Build", "Name");
+	fprintf(stdout, "====== ====================================  "
+			"============  =======  =================\n");	
+}
+
+
 int Depot::verify(Archive* archive) {
 	int res = 0;
-	fprintf(stdout, "%-6s %-36s  %-23s  %s\n", "Serial", "UUID", "Date Installed", "Name");
-	fprintf(stdout, "====== ====================================  =======================  =================\n");
+	this->archive_header();
 	list_archive(archive, stdout);	
-	fprintf(stdout, "=======================================================================================\n");
+	hr();
 	if (res == 0) res = this->iterate_files(archive, &Depot::verify_file, NULL);
-	fprintf(stdout, "=======================================================================================\n\n");
+	hr();
+	fprintf(stdout, "\n");
 	return res;
 }
 
@@ -937,17 +945,17 @@
 	struct tm local;
 	time_t seconds = archive->date_installed();
 	localtime_r(&seconds, &local);
-	strftime(date, sizeof(date), "%F %T %Z", &local);
+	strftime(date, sizeof(date), "%b %e %H:%M", &local);
 
-	fprintf((FILE*)context, "%-6llu %-36s  %-23s  %s\n", serial, uuid, date, archive->name());
+	fprintf((FILE*)context, "%-6llu %-36s  %-12s  %-7s  %s\n", 
+			serial, uuid, date, archive->build(), archive->name());
 	
 	return 0;
 }
 
 int Depot::list() {
 	int res = 0;
-	fprintf(stdout, "%-6s %-36s  %-23s  %s\n", "Serial", "UUID", "Date Installed", "Name");
-	fprintf(stdout, "====== ====================================  =======================  =================\n");
+	this->archive_header();
 	if (res == 0) res = this->iterate_archives(&Depot::list_archive, stdout);
 	return res;
 }
@@ -961,12 +969,12 @@
 
 int Depot::files(Archive* archive) {
 	int res = 0;
-	fprintf(stdout, "%-6s %-36s  %-23s  %s\n", "Serial", "UUID", "Date Installed", "Name");
-	fprintf(stdout, "====== ====================================  =======================  =================\n");
+	this->archive_header();
 	list_archive(archive, stdout);
-	fprintf(stdout, "=======================================================================================\n");
+	hr();
 	if (res == 0) res = this->iterate_files(archive, &Depot::print_file, stdout);
-	fprintf(stdout, "=======================================================================================\n\n");
+	hr();
+	fprintf(stdout, "\n");
 	return res;
 }
 
@@ -974,9 +982,10 @@
 	Depot* depot = (Depot*)context;
 	int res = 0;
 	list_archive(archive, stdout);
-	fprintf(stdout, "=======================================================================================\n");
+	hr();
 	if (res == 0) res = depot->iterate_files(archive, &Depot::print_file, stdout);
-	fprintf(stdout, "=======================================================================================\n\n");
+	hr();
+	fprintf(stdout, "\n");
 	return res;
 }
 
@@ -984,8 +993,7 @@
 	extern uint32_t verbosity;
 	verbosity = 0xFFFFFFFF; // dump is intrinsically a debug command
 	int res = 0;
-	fprintf(stdout, "%-6s %-36s  %-23s  %s\n", "Serial", "UUID", "Date Installed", "Name");
-	fprintf(stdout, "====== ====================================  =======================  =================\n");
+	this->archive_header();
 	if (res == 0) res = this->iterate_archives(&Depot::dump_archive, this);
 	return res;
 }
@@ -1025,12 +1033,11 @@
 		fprintf(stderr, "The following archive%s in an inconsistent state and must be uninstalled "
 						"before proceeding:\n\n", inactive->count > 1 ? "s are" : " is");
 		uint32_t i;
-		fprintf(stderr, "%-6s %-36s  %-23s  %s\n", "Serial", "UUID", "Date Installed", "Name");
-		fprintf(stderr, "====== ====================================  =======================  =================\n");
+		this->archive_header();
 		for (i = 0; i < inactive->count; ++i) {
 			Archive* archive = this->archive(inactive->values[i]);
 			if (archive) {
-				list_archive(archive, stderr);
+				list_archive(archive, stdout);
 				delete archive;
 			}
 		}

Modified: branches/PR-7593824/darwinup/Depot.h
===================================================================
--- branches/PR-7593824/darwinup/Depot.h	2010-03-09 22:39:02 UTC (rev 753)
+++ branches/PR-7593824/darwinup/Depot.h	2010-03-09 23:56:11 UTC (rev 754)
@@ -151,6 +151,8 @@
 
 	int		check_consistency();
 
+	void    archive_header();
+	
 	DarwinupDatabase* m_db;
 	
 	mode_t		m_depot_mode;

Modified: branches/PR-7593824/darwinup/Utils.cpp
===================================================================
--- branches/PR-7593824/darwinup/Utils.cpp	2010-03-09 22:39:02 UTC (rev 753)
+++ branches/PR-7593824/darwinup/Utils.cpp	2010-03-09 23:56:11 UTC (rev 754)
@@ -352,3 +352,8 @@
 	fprintf(f, "\n");
 }
 
+void hr() {
+	fprintf(stdout, "=============================================="
+			"=======================================\n");	
+}
+

Modified: branches/PR-7593824/darwinup/Utils.h
===================================================================
--- branches/PR-7593824/darwinup/Utils.h	2010-03-09 22:39:02 UTC (rev 753)
+++ branches/PR-7593824/darwinup/Utils.h	2010-03-09 23:56:11 UTC (rev 754)
@@ -80,6 +80,9 @@
 
 void __data_hex(FILE* f, uint8_t* data, uint32_t size);
 
+// print a horizontal line to stdout
+void hr();
+
 inline int INFO_TEST(uint32_t word, uint32_t flag) { return ((word & flag) != 0); }
 inline int INFO_SET(uint32_t word, uint32_t flag) { return (word | flag); }
 inline int INFO_CLR(uint32_t word, uint32_t flag) { return (word & (~flag)); }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100309/c2897a04/attachment-0001.html>


More information about the darwinbuild-changes mailing list