]> Sergey Matveev's repositories - public-inbox.git/commitdiff
Merge remote-tracking branch 'origin/purge'
authorEric Wong <e@80x24.org>
Thu, 31 Jan 2019 21:08:48 +0000 (21:08 +0000)
committerEric Wong <e@80x24.org>
Thu, 31 Jan 2019 21:08:48 +0000 (21:08 +0000)
* origin/purge:
  implement public-inbox-purge tool
  v2writable: read epoch on purge
  v2writable: cleanup processes when done
  v2writable: purge ignores non-existent git epoch directories
  v2writable: ->purge returns undef on no-op
  import: purge: reap fast-export process
  hoist out resolve_repo_dir from -index

1  2 
MANIFEST
script/public-inbox-index

diff --combined MANIFEST
index e6272066a00fbe83af8fe855387da010ffdf14df,886ae6b22dbf14f32750c8844bf891517d641f2e..c4a9349faea7ead56d6514ceb4bb804b58cf5245
+++ b/MANIFEST
@@@ -26,9 -26,6 +26,9 @@@ MANIFES
  Makefile.PL
  README
  TODO
 +contrib/css/216dark.css
 +contrib/css/216light.css
 +contrib/css/README
  contrib/selinux/el7/publicinbox.fc
  contrib/selinux/el7/publicinbox.te
  examples/README
@@@ -38,7 -35,6 +38,7 @@@ examples/apache2_perl.con
  examples/apache2_perl_old.conf
  examples/cgi-webrick.rb
  examples/cgit-commit-filter.lua
 +examples/highlight.psgi
  examples/logrotate.conf
  examples/public-inbox-config
  examples/public-inbox-httpd.socket
@@@ -55,6 -51,7 +55,7 @@@ examples/unsubscribe.milte
  examples/unsubscribe.psgi
  examples/varnish-4.vcl
  lib/PublicInbox/Address.pm
+ lib/PublicInbox/Admin.pm
  lib/PublicInbox/AltId.pm
  lib/PublicInbox/Config.pm
  lib/PublicInbox/ContentId.pm
@@@ -75,7 -72,6 +76,7 @@@ lib/PublicInbox/GitHTTPBackend.p
  lib/PublicInbox/HTTP.pm
  lib/PublicInbox/HTTPD.pm
  lib/PublicInbox/HTTPD/Async.pm
 +lib/PublicInbox/HlMod.pm
  lib/PublicInbox/Hval.pm
  lib/PublicInbox/Import.pm
  lib/PublicInbox/Inbox.pm
@@@ -106,23 -102,18 +107,23 @@@ lib/PublicInbox/SearchIdxPart.p
  lib/PublicInbox/SearchMsg.pm
  lib/PublicInbox/SearchThread.pm
  lib/PublicInbox/SearchView.pm
 +lib/PublicInbox/SolverGit.pm
  lib/PublicInbox/Spamcheck.pm
  lib/PublicInbox/Spamcheck/Spamc.pm
  lib/PublicInbox/Spawn.pm
  lib/PublicInbox/SpawnPP.pm
  lib/PublicInbox/Unsubscribe.pm
 +lib/PublicInbox/UserContent.pm
  lib/PublicInbox/V2Writable.pm
  lib/PublicInbox/View.pm
 +lib/PublicInbox/ViewDiff.pm
 +lib/PublicInbox/ViewVCS.pm
  lib/PublicInbox/WWW.pm
  lib/PublicInbox/WWW.pod
  lib/PublicInbox/WatchMaildir.pm
  lib/PublicInbox/WwwAtomStream.pm
  lib/PublicInbox/WwwAttach.pm
 +lib/PublicInbox/WwwHighlight.pm
  lib/PublicInbox/WwwStream.pm
  lib/PublicInbox/WwwText.pm
  sa_config/Makefile
@@@ -137,6 -128,7 +138,7 @@@ script/public-inbox-ini
  script/public-inbox-learn
  script/public-inbox-mda
  script/public-inbox-nntpd
+ script/public-inbox-purge
  script/public-inbox-watch
  script/public-inbox.cgi
  scripts/dc-dlvr
@@@ -151,6 -143,7 +153,7 @@@ scripts/slrnspool2maildi
  scripts/ssoma-replay
  scripts/xhdr-num2mid
  t/address.t
+ t/admin.t
  t/altid.t
  t/altid_v2.t
  t/cgi.t
@@@ -173,7 -166,6 +176,7 @@@ t/git-http-backend.psg
  t/git-http-backend.t
  t/git.fast-import-data
  t/git.t
 +t/hl_mod.t
  t/html_index.t
  t/httpd-corner.psgi
  t/httpd-corner.t
@@@ -196,7 -188,6 +199,7 @@@ t/nntp.
  t/nntpd.t
  t/nulsubject.t
  t/over.t
 +t/perf-msgview.t
  t/perf-nntpd.t
  t/perf-threading.t
  t/plack.t
@@@ -208,13 -199,11 +211,14 @@@ t/psgi_multipart_not.
  t/psgi_search.t
  t/psgi_text.t
  t/psgi_v2.t
+ t/purge.t
  t/qspawn.t
  t/reply.t
  t/search-thr-index.t
  t/search.t
 +t/solve/0001-simple-mod.patch
 +t/solve/0002-rename-with-modifications.patch
 +t/solver_git.t
  t/spamcheck_spamc.t
  t/spawn.t
  t/thread-cycle.t
index 2ae92757cac6607ec9c6658df3c221c5900dcddb,32121f6d9a5650edc566803e41107d339f8978e6..5adb6e741eff8f2578a780bd40738cd7c42ee7a6
@@@ -9,12 -9,13 +9,13 @@@
  use strict;
  use warnings;
  use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
- use Cwd 'abs_path';
  my $usage = "public-inbox-index REPO_DIR";
  use PublicInbox::Config;
+ use PublicInbox::Admin qw(resolve_repo_dir);
  my $config = eval { PublicInbox::Config->new } || eval {
        warn "public-inbox unconfigured for serving, indexing anyways...\n";
 -      {}
 +      undef;
  };
  eval { require PublicInbox::SearchIdx };
  if ($@) {
@@@ -35,35 -36,6 +36,6 @@@ die "--jobs must be positive\n" if defi
  
  my @dirs;
  
- sub resolve_repo_dir {
-       my ($cd) = @_;
-       my $prefix = defined $cd ? $cd : './';
-       if (-d $prefix && -f "$prefix/inbox.lock") { # v2
-               return abs_path($prefix);
-       }
-       my @cmd = qw(git rev-parse --git-dir);
-       my $cmd = join(' ', @cmd);
-       my $pid = open my $fh, '-|';
-       defined $pid or die "forking $cmd failed: $!\n";
-       if ($pid == 0) {
-               if (defined $cd) {
-                       chdir $cd or die "chdir $cd failed: $!\n";
-               }
-               exec @cmd;
-               die "Failed to exec $cmd: $!\n";
-       } else {
-               my $dir = eval {
-                       local $/;
-                       <$fh>;
-               };
-               close $fh or die "error in $cmd: $!\n";
-               chomp $dir;
-               return abs_path($cd) if ($dir eq '.' && defined $cd);
-               abs_path($dir);
-       }
- }
  if (@ARGV) {
        @dirs = map { resolve_repo_dir($_) } @ARGV;
  } else {
@@@ -73,7 -45,7 +45,7 @@@
  sub usage { print STDERR "Usage: $usage\n"; exit 1 }
  usage() unless @dirs;
  
 -$config->each_inbox(sub {
 +defined($config) and $config->each_inbox(sub {
        my ($ibx) = @_;
  
        for my $i (0..$#dirs) {