]> Sergey Matveev's repositories - public-inbox.git/blobdiff - scripts/import_vger_from_mbox
dsdeflate: shorten scope of initial buffer
[public-inbox.git] / scripts / import_vger_from_mbox
index 369dac79824a30b73a5d6cac836c3194f17f946e..c33e42e45c2823e1e87e9a2139fea60efc132468 100644 (file)
@@ -1,22 +1,20 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
 use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
-use PublicInbox::MIME;
 use PublicInbox::InboxWritable;
-use PublicInbox::V2Writable;
-use PublicInbox::Import;
-use PublicInbox::MDA;
 my $usage = "usage: $0 NAME EMAIL DIR <MBOX\n";
 my $dry_run;
 my $version = 2;
 my $variant = 'mboxrd';
+my $filter = 'PublicInbox::Filter::Vger';
 my %opts = (
        'n|dry-run' => \$dry_run,
        'V|version=i' => \$version,
        'F|format=s' => \$variant,
+       'filter=s' => \$filter,
 );
 GetOptions(%opts) or die $usage;
 if ($variant ne 'mboxrd' && $variant ne 'mboxo') {
@@ -24,20 +22,21 @@ if ($variant ne 'mboxrd' && $variant ne 'mboxo') {
 }
 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
+my $inboxdir = shift or die $usage; # /path/to/v2/repo
 my $ibx = {
-       mainrepo => $mainrepo,
+       inboxdir => $inboxdir,
        name => $name,
        version => $version,
-       -primary_address => $email,
-       filter => 'PublicInbox::Filter::Vger',
+       address => [ $email ],
+       filter => $filter,
 };
 $ibx = PublicInbox::Inbox->new($ibx);
 unless ($dry_run) {
        if ($version >= 2) {
+               require PublicInbox::V2Writable;
                PublicInbox::V2Writable->new($ibx, 1)->init_inbox(0);
        } else {
-               system(qw(git init --bare -q), $mainrepo) == 0 or die;
+               system(qw(git init --bare -q), $inboxdir) == 0 or die;
        }
 }
 $ibx = PublicInbox::InboxWritable->new($ibx);