diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-04-14 08:34:17 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-04-14 08:34:17 +0000 |
commit | 5d2ed145c1972deff9eb98c02c9abdb48a785680 (patch) | |
tree | d961e850e8038db6e11053dac8d63641550aace3 | |
parent | 1d34eefd93584804f20b4a4c37062e02d3873556 (diff) | |
download | prt-get-5d2ed145c1972deff9eb98c02c9abdb48a785680.tar.gz prt-get-5d2ed145c1972deff9eb98c02c9abdb48a785680.tar.xz |
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
-rw-r--r-- | src/installtransaction.cpp | 30 |
1 files 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()); } |