prt-get: add timestamps to log files

git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1170 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
This commit is contained in:
Johannes Winkelmann 2006-04-07 07:49:13 +00:00
parent ec36dcd199
commit 5634324b65
5 changed files with 27 additions and 7 deletions

View File

@ -1,4 +1,5 @@
* 0.5.12 00.04.2006 Johannes Winkelmann
- Add 'depinst' in 'help' (thanks Simone)
- Fix compilation on OpenBSD
- Show alias info in depends
- don't install alias file and deplist
@ -9,6 +10,7 @@
- print full add command and PACKAGE_DIR info when using install/update -v
- Make 'cat' and 'readme' use $PAGER if set
- update default prt-get.conf to reflect new port hierarchy (core/opt/contrib)
- add timestamps to log files
* 0.5.11 29.05.2005 Johannes Winkelmann
- add --path to 'ls'

3
TODO
View File

@ -4,6 +4,8 @@ $PKGMK_PACKAGE_DIR` to determine PACKAGE_DIR
- allow dependency injection for sysup, with previews
- prefer toolchain (patch in trac)
- dependent --list-orphaned; should simplify pkgfoster
- logging: check for non-root owned symlinks
- logging: reject relative logfile names
==============================================================================
@ -45,7 +47,6 @@ config: go through additional configuration options; add and/or replace
- better reports (installed/failed/not even tried to install)
[ ] message log for prt-get messages ?
[ ] timestamps for the log file
[ ] --quiet mode; suppress output of pkgmk and pkgadd
[ ] prt-get diff stats: "100 Packages with differences"

2
configure vendored
View File

@ -1614,7 +1614,7 @@ fi
# Define the identity of the package.
PACKAGE=prt-get
VERSION=0.5.12pre
VERSION=0.5.12pre2
cat >>confdefs.h <<_ACEOF

View File

@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/prtget.cpp])
AM_INIT_AUTOMAKE(prt-get,0.5.12pre1)
AM_INIT_AUTOMAKE(prt-get,0.5.12pre2)
dnl Determine default prefix

View File

@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
using namespace std;
@ -191,7 +192,13 @@ InstallTransaction::installPackage( const Package* package,
int fdlog = -1;
string logFile = "";
string timestamp;
string commandName = "prt-get";
if ( parser->wasCalledAsPrtCached() ) {
commandName = "prt-cache";
}
if ( m_config->writeLog() ) {
logFile = m_config->logFilePattern();
if ( logFile == "" ) {
@ -228,6 +235,12 @@ InstallTransaction::installPackage( const Package* package,
if ( fdlog == -1 ) {
return LOG_FILE_FAILURE;
}
time_t startTime;
time(&startTime);
timestamp = ctime(&startTime);
timestamp = commandName + ": starting build " + timestamp;
write( fdlog, timestamp.c_str(), timestamp.length());
}
string pkgdir = package->path() + "/" + package->name();
@ -304,10 +317,6 @@ InstallTransaction::installPackage( const Package* package,
package->version() + "-" +
package->release() + ".pkg.tar.gz";
string commandName = "prt-get";
if ( parser->wasCalledAsPrtCached() ) {
commandName = "prt-cache";
}
// - inform the user about what's happening
string fullCommand = commandName + ": " + cmd + " " + args;
@ -328,9 +337,17 @@ InstallTransaction::installPackage( const Package* package,
cout << fullCommand << endl;
}
if ( m_config->writeLog() ) {
time_t endTime;
time(&endTime);
timestamp = ctime(&endTime);
timestamp = commandName + ": build done " + timestamp;
write( fdlog, summary.c_str(), summary.length() );
write( fdlog, "\n", 1 );
write( fdlog, fullCommand.c_str(), fullCommand.length() );
write( fdlog, "\n", 1 );
write( fdlog, timestamp.c_str(), timestamp.length());
write( fdlog, "\n", 1 );
}
Process installProc( cmd, args, fdlog );