Author: mvidner
Date: Tue Apr 8 18:15:32 2008
New Revision: 46256
URL: http://svn.opensuse.org/viewcvs/yast?rev=46256&view=rev
Log:
Compress (gzip) the rotated y2logs (fate#300637).
Modified:
trunk/core/VERSION
trunk/core/liby2util-r/src/y2log.cc
trunk/core/package/yast2-core.changes
Modified: trunk/core/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=46256&r1=46255&r2=46256&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Tue Apr 8 18:15:32 2008
@@ -1 +1 @@
-2.16.44
+2.16.45
Modified: trunk/core/liby2util-r/src/y2log.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2util-r/src/y2log.cc?rev=46256&r1=46255&r2=46256&view=diff
==============================================================================
--- trunk/core/liby2util-r/src/y2log.cc (original)
+++ trunk/core/liby2util-r/src/y2log.cc Tue Apr 8 18:15:32 2008
@@ -8,6 +8,7 @@
* Thomas Roelz
* Michal Svec
* Arvin Schnell
+ * Martin Vidner
*
* $Id$
*/
@@ -373,14 +374,20 @@
return string (logname);
}
+static string old (const string & filename, int i, const char * suffix) {
+ char numbuf[8];
+ sprintf (numbuf, "%d", i);
+ return filename + "-" + numbuf + suffix;
+}
/**
* Maintain logfiles
+ * We do all of this ourselves because during the installation
+ * logrotate does not run
*/
static void shift_log_files(string filename)
{
struct stat buf;
- char numbuf[8];
if( stat(filename.c_str(), &buf) )
return;
@@ -388,18 +395,23 @@
if( buf.st_size <= maxlogsize )
return;
- /* Delete the last logfile, rename existing ones */
- sprintf (numbuf, "%d", maxlognum - 1);
- remove ((filename + "-" + numbuf).c_str());
+ static const char * gz = ".gz";
+ // Delete the last logfile
+ remove (old (filename, maxlognum - 1, "" ).c_str());
+ remove (old (filename, maxlognum - 1, gz).c_str());
+ // rename existing ones
for( int f = maxlognum-2; f > 0; f-- )
{
- sprintf (numbuf, "%d", f);
- string oldname = filename + "-" + numbuf;
- sprintf (numbuf, "%d", f+1);
- rename (oldname.c_str(), (filename + "-" + numbuf).c_str());
+ rename (old (filename, f, "").c_str(), old (filename, f+1, "").c_str());
+ rename (old (filename, f, gz).c_str(), old (filename, f+1, gz).c_str());
}
- rename( filename.c_str(), (filename + "-1").c_str() );
+
+ // rename and compress first one
+ rename( filename.c_str(), old (filename, 1, "").c_str() );
+ // fate#300637: compress!
+ // may fail, but so what
+ system( ("nice -n 20 gzip " + old (filename, 1, "") + " &").c_str());
}
Modified: trunk/core/package/yast2-core.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=46256&r1=46255&r2=46256&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Tue Apr 8 18:15:32 2008
@@ -1,8 +1,10 @@
-------------------------------------------------------------------
-Tue Apr 8 12:38:03 CEST 2008 - mvidner@suse.cz
+Tue Apr 8 18:14:44 CEST 2008 - mvidner@suse.cz
+- Compress (gzip) the rotated y2logs, in the background (fate#300637).
- y2base: Added -I and -M options to add search paths for includes and
modules (fate#2306).
+- 2.16.45
-------------------------------------------------------------------
Sun Apr 06 13:34:20 CEST 2008 - aschnell@suse.de
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org