Update of /cvsroot/mhonarc/mharc/bin
In directory subversions:/tmp/cvs-serv31959/bin
Modified Files:
mbox-month-pack mhonarc-check mk-procmailrc
Added Files:
extract-mesg-date
Log Message:
* lib/config.sh.dist:
. FIX: Default PROCMAIL_PATH setting uses $SW_ROOT/bin instead of
$HOME/bin. Installations should update local config.sh
to reflect change.
. Added MHONARC_LIB: Directory pathname to where MHonArc libraries
are installed. If MHonArc libraries are in a location not included
in perl's library search path, this variable should be set to
that location.
. Added MSGID_CACHE_SIZE: Maximum size, in bytes, of msgid cache
for detecting duplicate messages.
. Reorganized file to put key variables at top of file and to
provide a comment description before each variable.
* bin/mk-procmailrc:
. "Cleaned-up" the procmailrc file generated. The "Extraneous
copy flag" warnings should be gone. Also, rules changed to
use new bin/extract-mesg-date to determine which raw mailbox
to file to instead of the current time. This insures that
messages go into the proper period mailbox regardless of when
incoming mail is processed.
* bin/extract-mesg-date:
. NEW: New utility to print out the date of a message. This
program is mainly used in newer procmailrc format generated
by mk-procmailrc.
***** Error reading new file: [Errno 2] No such file or directory: 'extract-mesg-date'
Index: mbox-month-pack
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/mbox-month-pack,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** mbox-month-pack 12 Jul 2002 04:56:28 -0000 1.1
--- mbox-month-pack 17 Jul 2002 21:59:36 -0000 1.2
***************
*** 26,33 ****
package MHArc::mbox_month_pack;
! use Pod::Usage;
use Getopt::Long;
! # For MHonArc date/time utilities
require 'mhamain.pl';
--- 26,41 ----
package MHArc::mbox_month_pack;
! my $Dir;
! BEGIN {
! $Dir = `dirname $0`; chomp $Dir;
! }
! use lib "$Dir/../lib"; # Add relative lib to search path
! use MHArc::Config;
! my $config = MHArc::Config->load("$Dir/../lib/config.sh");
!
use Getopt::Long;
+ use MHArc::Util qw( usage );
! # For MHonArc date/time utilities and message head parsing
require 'mhamain.pl';
***************
*** 51,55 ****
# Grap command-line options
! GetOptions(
"debug!" => \$debug,
"msgsep=s" => \$msgsep,
--- 59,63 ----
# Grap command-line options
! my $clstatus = GetOptions(
"debug!" => \$debug,
"msgsep=s" => \$msgsep,
***************
*** 60,64 ****
"help" => \$help,
"man" => \$man
! ) || usage(0);
usage(1) if $help;
usage(2) if $man;
--- 68,73 ----
"help" => \$help,
"man" => \$man
! );
! usage(0) unless $clstatus;
usage(1) if $help;
usage(2) if $man;
***************
*** 103,107 ****
# Grab message header and date.
! ($header, $fields) = read_mail_header($fh);
#dump_header(\*STDOUT, $fields) if $debug;
--- 112,116 ----
# Grab message header and date.
! ($fields, $header) = read_mail_header($fh);
#dump_header(\*STDOUT, $fields) if $debug;
***************
*** 154,184 ****
sub read_mail_header {
! my($handle) = shift;
! my $label = '';
! my $header = '';
! my $fields = { };
! local $/ = "\n";
!
! my($value, $tmp);
! while (($tmp = <$handle>) !~ /^[\r]?$/) {
! $header .= $tmp;
! ## Delete eol characters
! $tmp =~ s/[\r\n]//g;
! ## Check for continuation of a field
! if ($tmp =~ s/^\s//) {
! $fields->{$label}[-1] .= $tmp if $label;
! next;
! }
! ## Separate head from field text
! if ($tmp =~ /^([^:\s]+):\s*([\s\S]*)$/) {
! ($label, $value) = (lc($1), $2);
! if (defined($fields->{$label})) {
! push(@{$fields->{$label}}, $value);
! } else {
! $fields->{$label} = [ $value ];
! }
! }
! }
! ($header, $fields);
}
--- 163,167 ----
sub read_mail_header {
! readmail::MAILread_file_header(@_);
}
***************
*** 215,232 ****
}
- sub usage {
- require Pod::Usage;
- my $verbose = shift;
- if ($verbose == 0) {
- Pod::Usage::pod2usage(-verbose => $verbose);
- } else {
- my $pager = $ENV{'PAGER'} || 'more';
- local(*PAGER);
- my $fh = (-t STDOUT && open(PAGER, "|$pager")) ? \*PAGER : \*STDOUT;
- Pod::Usage::pod2usage(-verbose => $verbose,
- -output => $fh);
- }
- }
-
sub dump_header {
my $fh = shift;
--- 198,201 ----
***************
*** 322,329 ****
=item *
! Pre-existing gzipped monthly, and yearly, mailbox files are not recognized
! when splitting input. If you want output to be appended to existing
! compressed mailboxes, you must uncompress them first before invoking
! this program.
=back
--- 291,298 ----
=item *
! Appending to pre-existing gzipped monthly, and yearly, mailbox files
! are not recognized when splitting input. If you want output to be
! appended to existing compressed mailboxes, you must uncompress them
! first before invoking this program.
=back
Index: mhonarc-check
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/mhonarc-check,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** mhonarc-check 7 Mar 2002 00:14:46 -0000 1.2
--- mhonarc-check 17 Jul 2002 21:59:36 -0000 1.3
***************
*** 26,29 ****
--- 26,37 ----
package MHArc::mhonarc_check;
+ my $Dir;
+ BEGIN {
+ $Dir = `dirname $0`; chomp $Dir;
+ }
+ use lib "$Dir/../lib"; # Add relative lib to search path
+ use MHArc::Config;
+ my $config = MHArc::Config->load("$Dir/../lib/config.sh");
+
eval {
require 'mhamain.pl';
***************
*** 32,41 ****
print qq/Unable to load MHonArc: $(_at_)\n/;
print <<'EOT';
!
! * If MHonArc is installed, you may need to set the PERL5LIB
! * environment variable if you installed the MHonArc library
! * files in a non-standard location.
!
EOT
exit 1;
--- 40,51 ----
print qq/Unable to load MHonArc: $(_at_)\n/;
print <<'EOT';
! * If MHonArc is installed, you may need to set the MHONARC_LIB
! * variable in lib/config.sh to the directory pathname location
! * of MHonArc's library files.
! * @INC setting:
EOT
+ foreach (@INC) {
+ print qq/\t$_\n/;
+ }
exit 1;
Index: mk-procmailrc
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/mk-procmailrc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** mk-procmailrc 12 Jul 2002 04:51:37 -0000 1.12
--- mk-procmailrc 17 Jul 2002 21:59:36 -0000 1.13
***************
*** 44,51 ****
my %opt = ( );
my $clstatus = GetOptions(\%opt,
- 'home=s',
- 'procmail-path=s',
'catch-archive=s',
'disable-catch-archive!',
'help',
--- 44,53 ----
my %opt = ( );
my $clstatus = GetOptions(\%opt,
'catch-archive=s',
'disable-catch-archive!',
+ 'home=s',
+ 'mbox-dir=s',
+ 'msgid-cache-size=i',
+ 'procmail-path=s',
'help',
***************
*** 59,64 ****
--- 61,72 ----
$config->{'SW_ROOT'} ||
"$Dir/..";
+ my $mbox_dir = $opt{'mbox-dir'} ||
+ $config->{'MBOX_DIR'} ||
+ join('/',$basedir,'mbox');
my $procmail_path = $opt{'procmail-path'} ||
$config->{'PROCMAIL_PATH'};
+ my $cache_size = $opt{'msgid-cache-size'} ||
+ $config->{'MSGID_CACHE_SIZE'} ||
+ 16384;
my $catch_arc = $opt{'catch-archive'} ||
$config->{'CATCH_ARCHIVE'} ||
***************
*** 74,77 ****
--- 82,88 ----
my $listdef = MHArc::ListDef->new($file);
+ my $extract_date_prg =
+ join('/', $config->{'SW_ROOT'}, 'bin', 'extract-mesg-date');
+
## Print procmailrc header
print <<EOT;
***************
*** 100,119 ****
## Root path to mail folders
! MBOXROOT=\$BASEDIR/mbox
!
! ## Current month: used as filename to store messages
! MONTHFOLDER=`date +"%Y-%m"`
!
! ## Current year: used as filename to store messages
! YEARFOLDER=`date +"%Y"`
## Flag if a list was matched
HAVEMATCH=no
- ## Avoid duplication messages
- :0 Wh: \$BASEDIR/msgid.lock
- | formail -D 8192 \$BASEDIR/msgid.cache
-
##======================================================================
EOT
--- 111,126 ----
## Root path to mail folders
! MBOXROOT=$mbox_dir
## Flag if a list was matched
HAVEMATCH=no
##======================================================================
+ ## Start Rules
+ ##======================================================================
+
+ ## Avoid duplicate messages
+ :0 Wh: \$BASEDIR/msgid.lock
+ | formail -D $cache_size \$BASEDIR/msgid.cache
EOT
***************
*** 127,131 ****
$pm_conditions,
$pm_copy,
! $folder_name);
my (@addr);
my ($str);
--- 134,138 ----
$pm_conditions,
$pm_copy,
! $time_fmt);
my (@addr);
my ($str);
***************
*** 160,166 ****
$period = 'month' if ($name eq $catch_arc);
if ($period eq 'year') {
! $folder_name = '$YEARFOLDER';
} else {
! $folder_name = '$MONTHFOLDER';
}
--- 167,173 ----
$period = 'month' if ($name eq $catch_arc);
if ($period eq 'year') {
! $time_fmt = '%Y';
} else {
! $time_fmt = '%Y-%m';
}
***************
*** 182,191 ****
* ^Subject: $cvs_prefix
{
! :0 Wic
! * ? test ! -d \$MBOXROOT/$name.CVS
! | mkdir -m 755 -p \$MBOXROOT/$name.CVS
:0:
! \$MBOXROOT/$name.CVS/$folder_name
}
--- 189,200 ----
* ^Subject: $cvs_prefix
{
! :0 Wi
! CMDEXEC_=| mkdir -m 755 -p \$MBOXROOT/$name.CVS
!
! :0 Wi
! MESGDATE_=| $extract_date_prg -fmt '$time_fmt'
:0:
! \$MBOXROOT/$name.CVS/\$MESGDATE_
}
***************
*** 200,212 ****
$pm_conditions
{
! :0 Wic
HAVEMATCH=|echo yes
! :0 Wic
! * ? test ! -d \$MBOXROOT/$name
! | mkdir -m 755 -p \$MBOXROOT/$name
:0$pm_copy:
! \$MBOXROOT/$name/$folder_name
}
--- 209,223 ----
$pm_conditions
{
! :0 Wi
HAVEMATCH=|echo yes
! :0 Wi
! CMDEXC_=| mkdir -m 755 -p \$MBOXROOT/$name
!
! :0 Wi
! MESGDATE_=| $extract_date_prg -fmt '$time_fmt'
:0$pm_copy:
! \$MBOXROOT/$name/\$MESGDATE_
}
***************
*** 226,231 ****
| mkdir -m 755 -p \$MBOXROOT/$catch_arc
:0
! \$MBOXROOT/$catch_arc/\$MONTHFOLDER
}
--- 237,245 ----
| mkdir -m 755 -p \$MBOXROOT/$catch_arc
+ :0 Wi
+ MESGDATE_=| $extract_date_prg -fmt '%Y-%m'
+
:0
! \$MBOXROOT/$catch_arc/\$MESGDATE_
}
***************
*** 235,239 ****
print <<'EOT';
##======================================================================
! ## Fallback: Discard message
##======================================================================
:0
--- 249,253 ----
print <<'EOT';
##======================================================================
! ## Discard message at the end
##======================================================================
:0
***************
*** 417,426 ****
=over
- =item C<-home> I<pathname>
-
- Root pathname of archiving software and data. If not specified,
- C<SW_ROOT> variable in C<config.sh> is used, else the parent directory
- that contains this program is used.
-
=item C<-catch-archive> I<name>
--- 431,434 ----
***************
*** 446,452 ****
--- 454,480 ----
Print out usage information.
+ =item C<-home> I<pathname>
+
+ Root pathname of archiving software and data. If not specified,
+ C<SW_ROOT> variable in C<config.sh> is used, else the parent directory
+ that contains this program is used.
+
=item C<-man>
Print out entire manpage.
+
+ =item C<-mbox-dir> I<pathname>
+
+ Root pathname containing raw mailbox archives. If not specified,
+ C<MBOX_DIR> variable in C<config.sh> is used, else C<I<-home>/mbox>
+ is used.
+
+ =item C<-msgid-cache-size> I<number-of-bytes>
+
+ The maximum size, in bytes, of the message-id cache. The message-id
+ cache is used to avoid processing duplicate messages.
+
+ If this option is not specified, the C<MSGID_CACHE_SIZE> variable
+ in C<config.sh> is used, else 16384 will be used.
=item C<-procmail-path> I<pathname-list>
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV