--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags Mon Sep 07 00:03:22 2009 +0200
@@ -0,0 +1,1 @@
+bb1b17fee8c389d6e45a7e7b7c9f1c1dc514e9bf stable
--- a/debian/changelog Thu Mar 26 09:23:27 2009 +0100
+++ b/debian/changelog Mon Sep 07 00:03:22 2009 +0200
@@ -1,3 +1,10 @@
+logbuch (0.28-2) stable; urgency=low
+
+ * new upstream
+ * corrected the depends in control file
+
+ -- Christian Arnold <arnold@schlittermann.de> Thu, 26 Mar 2009 09:16:40 +0100
+
logbuch (0.28-1) stable; urgency=low
* new upstream
--- a/debian/control Thu Mar 26 09:23:27 2009 +0100
+++ b/debian/control Mon Sep 07 00:03:22 2009 +0200
@@ -8,7 +8,7 @@
Package: logbuch
Architecture: all
Suggests: mercurial
-Depends: ${perl:Depends}, libdbi-perl, libdbd-mysql-perl
- libmailtools-perl, libfile-which-perl, libclass-accessor-perl
+Depends: ${perl:Depends}, libdbi-perl, libdbd-mysql-perl, libmailtools-perl,
+ libfile-which-perl, libclass-accessor-perl
Description: Logbuch for server maintainance
A simple script for tracking server changes in a logfile
--- a/log.pl Thu Mar 26 09:23:27 2009 +0100
+++ b/log.pl Mon Sep 07 00:03:22 2009 +0200
@@ -13,7 +13,27 @@
start special file processing (assuming output
from apt, with text (default: APT: upgrade) going
to the first line)
+ --logfile=s use this(!) logfile
#
+# something about charsets
+# * We assume the LOG file is always UTF-8!
+# (I know, it's not true for historical entries, may be we can
+# build some tool to convert the file line-by-line, or at least
+# entry-by-entry -- and our database too.
+# * The mail is sent always as UTF-8!
+# * The current charset could be found using "langinfo CODESET"
+# (hopefully - needs to be tested)
+# Conclusion:
+# - On opening/reading the log file: convert from UTF-8 -> current codeset
+# - If this fails, issue a warning, use "head <something>" to show the
+# last LOG entry directly and then fire up the editor with an
+# empty file (or just added notice why we do not show the old
+# messages)
+# - After editing: convert the current messsage to from the current
+# codeset UTF-8
+# - The same is for message on command line (but this is more easy, we
+# do not have to cope with the old message log
+
use strict;
use warnings;
@@ -25,6 +45,8 @@
use Mail::Mailer;
use DBI;
use MIME::QuotedPrint;
+use I18N::Langinfo qw(langinfo CODESET);
+use Text::Iconv;
use Logbuch::HG;
@@ -51,15 +73,15 @@
my $USER = "logbuch";
my $PW = "HIDDEN";
-my $LOG = "$ENV{HOME}/LOG";
my $EDITOR = $ENV{VISUAL} || $ENV{EDITOR} || "vim";
-my $MAGIC = "#--- all changes below are ignored ---#\n";
+my $MAGIC = "#--- all changes below are ignored ---#\n";
my $opt_db = 1;
my $opt_mail = 1;
my $opt_message = "";
my $opt_apt = "";
my $opt_initdir = "";
+my $opt_file = "$ENV{HOME}/LOG";
my $Dbh;
@@ -76,6 +98,7 @@
"message=s" => \$opt_message,
"type=s" => \$opt_apt,
"init-dir=s" => \$opt_initdir,
+ "file=s" => \$opt_file,
) or die eval "\"$USAGE\"";
if ($opt_message =~ /^@(.*)/) {
@@ -141,9 +164,7 @@
}
# Temporärfile öffnen
- my ($fh, $file);
- END { unlink $file if $file; }
- ($fh, $file) = tempfile(DIR => "/tmp");
+ my ($fh, $file) = tempfile(DIR => "/tmp", UNLINK => 1);
my $auto_message =
(not $hg_status_text)
@@ -162,12 +183,12 @@
$auto_message,
"\n", $MAGIC, "\n";
- if (!-e $LOG) {
- open(X, $_ = ">>$LOG") or die "Can't open $_: $!\n";
+ if (!-e $opt_file) {
+ open(X, $_ = ">>$opt_file") or die "Can't open $_: $!\n";
close X;
}
- open(IN, $_ = $LOG) or die "Can't open $_: $!\n";
+ open(IN, $_ = $opt_file) or die "Can't open $_: $!\n";
print $fh <IN>;
close IN;
@@ -249,12 +270,12 @@
}
# Und jetzt das aus der alten Datei dort anhängen
- open(IN, $_ = $LOG) or die "Can't open $_: $!\n";
+ open(IN, $_ = $opt_file) or die "Can't open $_: $!\n";
print $fh <IN>;
close $fh;
close IN;
- move $file, $LOG;
+ move $file, $opt_file;
}
--- a/modules Thu Mar 26 09:23:27 2009 +0100
+++ b/modules Mon Sep 07 00:03:22 2009 +0200
@@ -5,5 +5,7 @@
File::Temp
File::Which
Getopt::Long
+I18N::Langinfo
Mail::Mailer
MIME::QuotedPrint
+Text::Iconv