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:
parent
1d34eefd93
commit
5d2ed145c1
@ -193,12 +193,23 @@ InstallTransaction::installPackage( const Package* package,
|
|||||||
int fdlog = -1;
|
int fdlog = -1;
|
||||||
string logFile = "";
|
string logFile = "";
|
||||||
string timestamp;
|
string timestamp;
|
||||||
|
|
||||||
string commandName = "prt-get";
|
string commandName = "prt-get";
|
||||||
if ( parser->wasCalledAsPrtCached() ) {
|
if ( parser->wasCalledAsPrtCached() ) {
|
||||||
commandName = "prt-cache";
|
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() ) {
|
if ( m_config->writeLog() ) {
|
||||||
logFile = m_config->logFilePattern();
|
logFile = m_config->logFilePattern();
|
||||||
if ( logFile == "" ) {
|
if ( logFile == "" ) {
|
||||||
@ -235,6 +246,9 @@ InstallTransaction::installPackage( const Package* package,
|
|||||||
if ( fdlog == -1 ) {
|
if ( fdlog == -1 ) {
|
||||||
return LOG_FILE_FAILURE;
|
return LOG_FILE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write( fdlog, message.c_str(), message.length());
|
||||||
|
write( fdlog, "\n", 1);
|
||||||
|
|
||||||
time_t startTime;
|
time_t startTime;
|
||||||
time(&startTime);
|
time(&startTime);
|
||||||
@ -325,18 +339,18 @@ InstallTransaction::installPackage( const Package* package,
|
|||||||
string from = m_pkgDB->getPackageVersion(package->name());
|
string from = m_pkgDB->getPackageVersion(package->name());
|
||||||
string to = package->version() + "-" + package->release();
|
string to = package->version() + "-" + package->release();
|
||||||
if (from == to) {
|
if (from == to) {
|
||||||
summary = commandName + ": " + "reinstalling " +
|
summary = commandName + ": " + "reinstalling " +
|
||||||
package->name() + " " + to;
|
package->name() + " " + to;
|
||||||
} else {
|
} else {
|
||||||
summary = commandName + ": " + "updating " +
|
summary = commandName + ": " + "updating " +
|
||||||
package->name() + " from " + from + " to " + to;
|
package->name() + " from " + from + " to " + to;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
summary = commandName + ": " + "installing " +
|
summary = commandName + ": " + "installing " +
|
||||||
package->name() + " " +
|
package->name() + " " +
|
||||||
package->version() + "-" + package->release();
|
package->version() + "-" + package->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - print and log
|
// - print and log
|
||||||
cout << summary << endl;
|
cout << summary << endl;
|
||||||
if (parser->verbose() > 0) {
|
if (parser->verbose() > 0) {
|
||||||
@ -388,8 +402,8 @@ InstallTransaction::installPackage( const Package* package,
|
|||||||
|
|
||||||
// Close logfile
|
// Close logfile
|
||||||
close ( fdlog );
|
close ( fdlog );
|
||||||
|
|
||||||
if (m_config->removeLogOnSuccess() && !m_config->appendLog() &&
|
if (m_config->removeLogOnSuccess() && !m_config->appendLog() &&
|
||||||
result == SUCCESS) {
|
result == SUCCESS) {
|
||||||
unlink(logFile.c_str());
|
unlink(logFile.c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user