From 5d2ed145c1972deff9eb98c02c9abdb48a785680 Mon Sep 17 00:00:00 2001 From: Johannes Winkelmann Date: Fri, 14 Apr 2006 08:34:17 +0000 Subject: [PATCH] prt-get: print a short summary before installing a package git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1253 0b5ae1c7-2405-0410-a7fc-ba219f786e1e --- src/installtransaction.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/installtransaction.cpp b/src/installtransaction.cpp index 35bc9b6..73bc825 100644 --- a/src/installtransaction.cpp +++ b/src/installtransaction.cpp @@ -193,12 +193,23 @@ InstallTransaction::installPackage( const Package* package, 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 @@ InstallTransaction::installPackage( const Package* package, 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 @@ InstallTransaction::installPackage( const Package* package, 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 @@ InstallTransaction::installPackage( const Package* package, // Close logfile close ( fdlog ); - - if (m_config->removeLogOnSuccess() && !m_config->appendLog() && + + if (m_config->removeLogOnSuccess() && !m_config->appendLog() && result == SUCCESS) { unlink(logFile.c_str()); }