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
This commit is contained in:
Johannes Winkelmann 2006-04-14 08:34:17 +00:00
parent 1d34eefd93
commit 5d2ed145c1
1 changed files with 22 additions and 8 deletions

View File

@ -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());
}