about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-06 03:51:08 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-06 04:51:42 +0000
commitfe99e1e4900b5fbe8da4aef25bb0dd05eacb25a3 (patch)
treefc373e3c9a8e6565d3289d8d18487e1012bea8f7
parent61fc4c7942a5690f5c3bbae5f953ddc89500c67b (diff)
downloadpublic-inbox-fe99e1e4900b5fbe8da4aef25bb0dd05eacb25a3.tar.gz
It appears most of the mboxes in the archive I've been given are
mboxrd (despite having Content-Length:) and needs the escaping.
-rw-r--r--scripts/import_vger_from_mbox10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/import_vger_from_mbox b/scripts/import_vger_from_mbox
index 44698870..6a00fae3 100644
--- a/scripts/import_vger_from_mbox
+++ b/scripts/import_vger_from_mbox
@@ -11,11 +11,16 @@ use PublicInbox::Import;
 my $usage = "usage: $0 NAME EMAIL DIR <MBOX\n";
 my $dry_run;
 my $version = 2;
+my $variant = 'mboxrd';
 my %opts = (
         'n|dry-run' => \$dry_run,
         'V|version=i' => \$version,
+        'F|format=s' => \$variant,
 );
 GetOptions(%opts) or die $usage;
+if ($variant ne 'mboxrd' && $variant ne 'mboxo') {
+        die "Unsupported mbox variant: $variant\n";
+}
 my $name = shift or die $usage; # git
 my $email = shift or die $usage; # git@vger.kernel.org
 my $mainrepo = shift or die $usage; # /path/to/v2/repo
@@ -45,6 +50,11 @@ sub do_add ($$) {
         my ($im, $msg) = @_;
         $$msg =~ s/(\r?\n)+\z/$1/s;
         my $mime = PublicInbox::MIME->new($msg);
+        if ($variant eq 'mboxrd') {
+                $$msg =~ s/^>(>*From )/$1/sm;
+        } elsif ($variant eq 'mboxo') {
+                $$msg =~ s/^>From /From /sm;
+        }
         $mime = $vger->scrub($mime);
         return unless $im;
         $im->add($mime) or