Update of /cvsroot/mhonarc/mharc/bin
In directory subversions:/tmp/cvs-serv481/bin
Modified Files:
mk-procmailrc web-archive
Log Message:
* [bug #4319]: Fixed mainly in MHArc::ListDef to remember order
definitions are read. Added get_names method to allow scripts
to retrieve archives in the order defined.
* lib/common.mrc.in.dist,
lib/mrc/_lang_en.mrc:
. Changed the value of BOOKMARK-LINK-LABEL custom resource variable
to "Permanent Link". This appears to be more descriptive
and less ambiguous than "Bookmark Link".
* bin/web-archive:
. Added support for the following lists.def options:
All-Lists-Name: Archive name to use in all-lists index
Language: Language of archive
Hide-From-All-Lists: Do not list archive in all-lists index
See the mk-procmailrc manpage for more information about these
options.
* bin/mk-procmailrc:
. Archives can now be defined solely by Procmail-Condition, without
the requirement of defining an Address or From-Address option.
This provides the greatest flexibility.
Index: mk-procmailrc
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/mk-procmailrc,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** mk-procmailrc 10 Jan 2003 21:58:00 -0000 1.22
--- mk-procmailrc 16 Jul 2003 00:49:57 -0000 1.23
***************
*** 45,48 ****
--- 45,51 ----
use MHArc::Util qw( usage );
+ my $Verbose = 0;
+ my $Vfh = \*STDOUT;
+
MAIN: {
my @htaccess = ();
***************
*** 67,70 ****
--- 70,75 ----
usage(2) if $opt{'man'};
+ $Verbose = $opt{'verbose'};
+
my $basedir = $opt{'home'} ||
$config->{'SW_ROOT'} ||
***************
*** 106,113 ****
--- 111,120 ----
if (!defined($out_file) || ($out_file eq "") || ($out_file eq '-')) {
$outfh = \*STDOUT;
+ $Vfh = \*STDERR;
} else {
open(OUTFILE, ">$out_file") ||
die qq/ERROR: Unable to create "$out_file": $!\n/;
$outfh = \*OUTFILE;
+ $Vfh = \*STDOUT;;
}
***************
*** 169,215 ****
my ($str);
! foreach $name (sort keys %$listdef) {
if (defined($listdef->{$name}{'address'})) {
@addr = @{$listdef->{$name}{'address'}};
- } else {
- @addr = ( );
}
if (defined($listdef->{$name}{'from-address'})) {
@from_addr = @{$listdef->{$name}{'from-address'}};
- } else {
- @from_addr = ( )
}
! if (!scalar(@addr) && !scalar(@from_addr)) {
# no addresses defined
! warn qq/Warning: No addresses defined for '$name'\n/;
next;
}
# create procmail regex for list
! $pm_conditions = '* (';
! if (scalar(@addr)) {
! $pm_conditions .= '^TO_';
! $pm_conditions .= '(' if (scalar(@addr) > 1);
! $pm_conditions .= join('|', @addr);
! $pm_conditions .= ')' if (scalar(@addr) > 1);
! $pm_conditions .= '|(^(Delivered-To:|List-Post:).*';
! $pm_conditions .= '(' if (scalar(@addr) > 1);
! $pm_conditions .= join('|', @addr);
! $pm_conditions .= ')' if (scalar(@addr) > 1);
! $pm_conditions .= ')';
! }
! if (scalar(@from_addr)) {
! $pm_conditions .= '|(' if (scalar(@addr));
! $pm_conditions .= '^From:(.*[^-a-zA-Z0-9_.])?';
! $pm_conditions .= '(' if (scalar(@from_addr) > 1);
! $pm_conditions .= join('|', @from_addr);
! $pm_conditions .= ')' if (scalar(@from_addr) > 1);
! $pm_conditions .= ')' if (scalar(@addr));
}
- $pm_conditions .= ')';
if (defined($listdef->{$name}{'procmail-condition'})) {
foreach $str (@{$listdef->{$name}{'procmail-condition'}}) {
! $pm_conditions .= "\n$str";
}
}
--- 176,228 ----
my ($str);
! foreach $name ($listdef->get_names) {
! print $Vfh "Generating rule for $name...\n" if $Verbose;
! @addr = ( );
! @from_addr = ( );
!
if (defined($listdef->{$name}{'address'})) {
@addr = @{$listdef->{$name}{'address'}};
}
if (defined($listdef->{$name}{'from-address'})) {
@from_addr = @{$listdef->{$name}{'from-address'}};
}
!
! if (!scalar(@addr) && !scalar(@from_addr) &&
! !defined($listdef->{$name}{'procmail-condition'})) {
# no addresses defined
! warn qq/Warning: No addresses or conditions defined for '$name'\n/;
next;
}
+ $pm_conditions = '';
+
# create procmail regex for list
! if (scalar(@addr) || scalar(@from_addr)) {
! $pm_conditions .= '* (';
! if (scalar(@addr)) {
! $pm_conditions .= '^TO_';
! $pm_conditions .= '(' if (scalar(@addr) > 1);
! $pm_conditions .= join('|', @addr);
! $pm_conditions .= ')' if (scalar(@addr) > 1);
! $pm_conditions .= '|(^(Delivered-To:|List-Post:).*';
! $pm_conditions .= '(' if (scalar(@addr) > 1);
! $pm_conditions .= join('|', @addr);
! $pm_conditions .= ')' if (scalar(@addr) > 1);
! $pm_conditions .= ')';
! }
! if (scalar(@from_addr)) {
! $pm_conditions .= '|(' if (scalar(@addr));
! $pm_conditions .= '^From:(.*[^-a-zA-Z0-9_.])?';
! $pm_conditions .= '(' if (scalar(@from_addr) > 1);
! $pm_conditions .= join('|', @from_addr);
! $pm_conditions .= ')' if (scalar(@from_addr) > 1);
! $pm_conditions .= ')' if (scalar(@addr));
! }
! $pm_conditions .= ')' . "\n";
}
if (defined($listdef->{$name}{'procmail-condition'})) {
foreach $str (@{$listdef->{$name}{'procmail-condition'}}) {
! $pm_conditions .= "$str\n";
}
}
***************
*** 250,255 ****
## $name (CVS)
:0
! $pm_conditions
! * ^Subject: $cvs_prefix
{$noarchive
:0
--- 263,267 ----
## $name (CVS)
:0
! $pm_conditions\* ^Subject: $cvs_prefix
{$noarchive
:0
***************
*** 272,277 ****
## $name
:0
! $pm_conditions
! {$noarchive
HAVEMATCH=yes
--- 284,288 ----
## $name
:0
! $pm_conditions\{$noarchive
HAVEMATCH=yes
***************
*** 338,341 ****
--- 349,353 ----
if ($outfh != \*STDOUT) {
close($outfh);
+ print $Vfh qq/Procmail rcfile written to "$out_file"\n/;
}
***************
*** 395,403 ****
=item Name
! Starts, and defines, the name of an archive. This name serves as
! the directory name containing archive data and the short-title for
! archive pages. A common practice is to use the list address, but this
! is not required, especially if the archive is a combination of multiple
! lists, or it is prefered to use a more abstract name for simplicity.
=item Address
--- 407,428 ----
=item Name
! Starts, and defines, the name of an archive. This name serves
! as the directory name containing archive data and the list title
! (the C<$LIST-TITLE$> MHonArc resource variable) for archive pages.
! A common practice is to use the list address, but this is not required,
! especially if the archive is a combination of multiple lists, or it
! is prefered to use a more abstract name for simplicity.
!
! The name also is used when the L<web-archive> script looks for an
! archive specific MHonArc resource settings. If the following
! resource file exists,
!
! $MHA_RC_DIR/<name>.mrc
!
! where C<$MHA_RC_DIR> is the value of the MHA_RC_DIR C<config.sh> variable
! and C<E<lt>nameE<gt>> is the name of the archive, L<web-archive> will
! pass the resource file to MHonArc when processing the HTML archive.
! This provides a convenient way to provide list-specific customization
! to the archive.
=item Address
***************
*** 408,411 ****
--- 433,474 ----
to migration) or the archive is a collection of multiple lists.
+ B<NOTE:> The address is technically treated as part of
+ a procmail regular expression. Take the following as an example:
+
+ Address: mharc-users(_at_)mhonarc(_dot_)org
+
+ In regular expressions, the '.' character represents any character.
+ Therefore, the following strings would match the above specification:
+
+ mharc-users(_at_)mhonarc#org
+ mharc-users(_at_)mhonarcXorg
+ mharc-users(_at_)mhonarc@org
+
+ In practice, this technicality will generally have no affect, but if
+ you want to be pendantic, do the following:
+
+ Address: mharc-users(_at_)mhonarc\(_dot_)org
+
+ The '\' tells procmail to treat the '.' literally.
+
+ Because the actual address string given is treated as part of a regular
+ expression, you can specify a range of addresses with a single option.
+ For example,
+
+ mharc-[^(_at_)]*@mhonarc\.org
+
+ will match the following addresses:
+
+ mharc-users(_at_)mhonarc(_dot_)org
+ mharc-rules(_at_)mhonarc(_dot_)org
+ mharc-rocks(_at_)mhonarc(_dot_)org
+ mharc-is-the-best(_at_)mhonarc(_dot_)org
+ ...
+
+ =item All-Lists-Name
+
+ Label to use for Name column of all-lists index. If not specified,
+ the name provided by the C<Name> option is used.
+
=item Check-No-Archive
***************
*** 465,468 ****
--- 528,575 ----
collection of multiple lists.
+ =item Hide-From-All-Lists
+
+ Boolean option (C<0> or C<1>) if archive should not be listed in
+ the all-lists index.
+ If set to C<1>, the archive will not be shown.
+ The default value for this option is C<0>.
+
+ =item Language
+
+ Sets the language of the archive. This option is used by L<web-archive>
+ to determine if language-specific resource files will passed to
+ MHonArc by default. For example,
+
+ Language: en-us
+
+ Will cause L<web-archive> to check for the following resource files:
+
+ $MHA_RC_DIR/_lang.en_us
+ $MHA_RC_DIR/_lang.en
+
+ where C<$MHA_RC_DIR> is the C<config.sh> variable that defines
+ the directory containing list-specific MHonArc resource files.
+
+ The language is specified using a language tag as defined in
+ <a href="http://www.faqs.org/rfcs/rfc1766.html">RFC 1766</a>.
+ Generally a language tag comprises of a the spoken language with
+ an option countries specification. For example,
+
+ fr
+
+ denotes French, while
+
+ fr-ca
+
+ denotes Canadian French. The following,
+
+ en
+
+ denotes English, while the following denotes American English and
+ British English, respectively,
+
+ en-us
+ en-uk
+
=item MHonArc-Options
***************
*** 476,480 ****
Use this option if your HTML archives have been customized to obscure
! address to prevent address harvesting.
=item No-Search
--- 583,587 ----
Use this option if your HTML archives have been customized to obscure
! addresses to prevent address harvesting.
=item No-Search
***************
*** 484,487 ****
--- 591,597 ----
custom MHonArc resource variable will be set to the empty string.
+ B<NOTE:> Disable searching will diable some navigational features
+ that are dependent upon the search index.
+
=item Period
***************
*** 495,501 ****
--- 605,633 ----
C<!>, et. al. This option can be specified multiple times.
+ C<Procmail-Condition> can also be used inplace of C<Address> and
+ C<From-Address> to provide arbitrary matching rules for archiving
+ messages. This is useful for rare cases where messages to be archived
+ cannot be determined by receipient or from addresses.
+
B<CAUTION:> Exercise caution when using this option, especially if
C<CVS-Commits> is true. When C<CVS-commits> is true, an additionaly
rule already exists to check for the C<CVS-Subject-Prefix> setting.
+
+ =back
+
+ =head2 lists.def Notes
+
+ =over
+
+ =item *
+
+ Every archive defined must define at least one C<Address>, C<From>,
+ or C<Procmail-Condition> option.
+
+ =item *
+
+ The order of archive definitions is mirrored in the generated procmail
+ rcfile. This is important to properly honor the sematics of archives
+ with the C<Final> option specified.
=back
Index: web-archive
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/web-archive,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** web-archive 10 Jan 2003 21:58:37 -0000 1.41
--- web-archive 16 Jul 2003 00:49:57 -0000 1.42
***************
*** 201,204 ****
--- 201,205 ----
if ($editallidx) {
+ # Just updating all-lists index
update_archive_index(
'-config' => $config,
***************
*** 224,229 ****
--- 225,232 ----
# Get list of archives to process
if (@ARGV) {
+ # list of archives specified on the command-line
@dirs = @ARGV;
} else {
+ # read mbox dir to get list
@dirs = grep { (-d "$MBOX_DIR/$_") &&
($_ ne '.') &&
***************
*** 344,347 ****
--- 347,351 ----
if (!$editrootidx) {
+ # define arguments to mhonarc
my @mhaargs = (
'-modtime',
***************
*** 364,367 ****
--- 368,376 ----
);
+ my @langrc = get_lang_rc($MHA_RC_DIR, '_lang', $listdef->{$listname});
+ foreach (@langrc) {
+ push(@mhaargs, '-rcfile', $_);
+ }
+
if (-e "$MHA_RC_DIR/$list.mrc") {
push(@mhaargs, '-rcfile', "$MHA_RC_DIR/$list.mrc");
***************
*** 577,580 ****
--- 586,613 ----
}
+ sub get_lang_rc {
+ my $root_dir = shift;
+ my $basename = shift;
+ my $def = shift;
+
+ my $lang;
+ return () unless defined($def->{'language'}) &&
+ ($lang = $def->{'language'}[0]) =~ /\S/;
+ $lang =~ s/\s+//g;
+ my @tags = split(/[\-_]/, @lang);
+ my @files = ( );
+ my @tries = ( );
+
+ my($file, $tag);
+ my $curbase = join('/', $root_dir, $basename);
+ foreach $tag (split(/[\-_]/, @lang) {
+ $curbase .= '_' . $tag;
+ $file = join('.', $curbase, '.mrc');
+ push(@files, $file) if (-r $file);
+ }
+ @files;
+ }
+
+
sub read_template {
my $fh = shift;
***************
*** 782,785 ****
--- 815,819 ----
foreach $listname (keys %$listdef) {
next if $listname =~ /^\./; # skip hidden archives
+ next if $listdef->{'hide-from-all-lists'}[0];
foreach $list ($listname, "$listname.CVS") {
***************
*** 816,820 ****
$last_updated = format_date($time, $time_fmt);
$last_updated =~ s/ /\ /g;
! my $short_title = entify($listname);
my $description = entify($listdef->{$listname}{'description'}[0] ||
$listname);
--- 850,855 ----
$last_updated = format_date($time, $time_fmt);
$last_updated =~ s/ /\ /g;
! my $short_title = entify($listdef->{$listname}{'all-lists-name'}[0] ||
! $listname);
my $description = entify($listdef->{$listname}{'description'}[0] ||
$listname);
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV