about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-25 09:50:01 +0000
committerEric Wong <e@80x24.org>2016-04-25 09:50:32 +0000
commitfe3d2447badd595df784541556311137b920b0a2 (patch)
tree6e37ab61406654680fd6757593cf810370055ecb /lib
parent51c59323fffbfbb6ebc60f58da905e88ac323da5 (diff)
downloadpublic-inbox-fe3d2447badd595df784541556311137b920b0a2.tar.gz
By converting to using ourt git-fast-import-based Import
module.  This should allow us to be more easily installed.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Filter.pm7
-rw-r--r--lib/PublicInbox/Import.pm14
-rw-r--r--lib/PublicInbox/MDA.pm12
3 files changed, 14 insertions, 19 deletions
diff --git a/lib/PublicInbox/Filter.pm b/lib/PublicInbox/Filter.pm
index 10173ad1..8b78a441 100644
--- a/lib/PublicInbox/Filter.pm
+++ b/lib/PublicInbox/Filter.pm
@@ -28,13 +28,6 @@ sub run {
 
         my $content_type = $mime->header('Content-Type') || 'text/plain';
 
-        # kill potentially bad/confusing headers
-        # Note: ssoma already does this, but since we mangle the message,
-        # we should do this before it gets to ssoma.
-        foreach my $d (qw(status lines content-length)) {
-                $mime->header_set($d);
-        }
-
         if ($content_type =~ m!\btext/plain\b!i) {
                 return 1; # yay, nothing to do
         } elsif ($content_type =~ $MIME_HTML) {
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 8a40fb53..8dd11d03 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -195,6 +195,20 @@ sub done {
         my $pid = delete $self->{pid} or die 'BUG: missing {pid} when done';
         waitpid($pid, 0) == $pid or die 'fast-import did not finish';
         $? == 0 or die "fast-import failed: $?";
+
+        # for compatibility with existing ssoma installations
+        # we can probably remove this entirely by 2020
+        my $git_dir = $self->{git}->{git_dir};
+        my $index = "$git_dir/ssoma.index";
+        # XXX: change the following scope to: if (-e $index) # in 2018 or so..
+        unless ($ENV{FAST}) {
+                local $ENV{GIT_INDEX_FILE} = $index;
+                system('git', "--git-dir=$git_dir", qw(read-tree -m -v -i),
+                        $self->{ref}) == 0 or
+                        die "failed to update $git_dir/ssoma.index: $?\n";
+        }
+
+
         my $lockfh = delete $self->{lockfh} or die "BUG: not locked: $!";
         flock($lockfh, LOCK_UN) or die "unlock failed: $!";
         close $lockfh or die "close lock failed: $!";
diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm
index 2d3b9bd8..b1471022 100644
--- a/lib/PublicInbox/MDA.pm
+++ b/lib/PublicInbox/MDA.pm
@@ -10,7 +10,6 @@ use Email::Address;
 use Date::Parse qw(strptime);
 use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
 use constant MAX_MID_SIZE => 244; # max term size - 1 in Xapian
-use constant cmd => qw/ssoma-mda -1/;
 
 # drop plus addressing for matching
 sub __drop_plus {
@@ -84,15 +83,4 @@ sub set_list_headers {
         }
 }
 
-# returns a 3-element array: name, email, date
-sub author_info {
-        my ($class, $mime) = @_;
-
-        my $from = $mime->header('From');
-        my @from = Email::Address->parse($from);
-        my $name = $from[0]->name;
-        my $email = $from[0]->address;
-        ($name, $email, $mime->header('Date'));
-}
-
 1;