r1253 - tools/prt-get/trunk/src
Author: jw Date: 2006-04-14 10:34:17 +0200 (Fri, 14 Apr 2006) New Revision: 1253 Modified: tools/prt-get/trunk/src/installtransaction.cpp Log: prt-get: print a short summary before installing a package Modified: tools/prt-get/trunk/src/installtransaction.cpp =================================================================== --- tools/prt-get/trunk/src/installtransaction.cpp 2006-04-13 21:43:04 UTC (rev 1252) +++ tools/prt-get/trunk/src/installtransaction.cpp 2006-04-14 08:34:17 UTC (rev 1253) @@ -193,12 +193,23 @@ int fdlog = -1; string logFile = ""; string timestamp; - + string commandName = "prt-get"; if ( parser->wasCalledAsPrtCached() ) { commandName = "prt-cache"; } + // - initial information about the package to be build + string message; + message = commandName + ": "; + if (update) { + message += "updating "; + } else { + message += "installing "; + } + message += package->path() + "/" + package->name(); + cout << message << endl; + if ( m_config->writeLog() ) { logFile = m_config->logFilePattern(); if ( logFile == "" ) { @@ -235,6 +246,9 @@ if ( fdlog == -1 ) { return LOG_FILE_FAILURE; } + + write( fdlog, message.c_str(), message.length()); + write( fdlog, "\n", 1); time_t startTime; time(&startTime); @@ -325,18 +339,18 @@ string from = m_pkgDB->getPackageVersion(package->name()); string to = package->version() + "-" + package->release(); if (from == to) { - summary = commandName + ": " + "reinstalling " + + summary = commandName + ": " + "reinstalling " + package->name() + " " + to; } else { - summary = commandName + ": " + "updating " + + summary = commandName + ": " + "updating " + package->name() + " from " + from + " to " + to; } } else { - summary = commandName + ": " + "installing " + + summary = commandName + ": " + "installing " + package->name() + " " + package->version() + "-" + package->release(); - } - + } + // - print and log cout << summary << endl; if (parser->verbose() > 0) { @@ -388,8 +402,8 @@ // Close logfile close ( fdlog ); - - if (m_config->removeLogOnSuccess() && !m_config->appendLog() && + + if (m_config->removeLogOnSuccess() && !m_config->appendLog() && result == SUCCESS) { unlink(logFile.c_str()); }
participants (1)
-
crux@crux.nu