From 63cbab5cc8857bd3f68a29e33de62bb3df083bb5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 28 Nov 2022 05:31:06 +0000 Subject: [PATCH] lei_mirror: move directory creation to v2-only path We rely on `git clone' to create the destination directory for v1 and coderepos, so having it in _try_config_start was senseless. --- lib/PublicInbox/LeiMirror.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 285c64d8..6d72f15d 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -137,12 +137,6 @@ sub _get_txt_done { # tries the relatively new /$INBOX/_/text/config/raw endpoint sub _try_config_start { my ($self) = @_; - my $dst = $self->{cur_dst} // $self->{dst}; - if (!-d $dst || !mkdir($dst)) { - require File::Path; - File::Path::mkpath($dst); - -d $dst or die "mkpath($dst): $!\n"; - } _get_txt_start($self, qw(_/text/config/raw inbox.config.example), 0444); } @@ -381,6 +375,12 @@ failed to extract epoch number from $src } # filter out the epochs we skipped $self->{-culled_manifest} = 1 if delete(@$m{@skip}); + + if (!-d $dst || !mkdir($dst)) { + require File::Path; + File::Path::mkpath($dst); + -d $dst or die "mkpath($dst): $!\n"; + } my $lk = bless { lock_path => "$dst/inbox.lock" }, 'PublicInbox::Lock'; my $fini = PublicInbox::OnDestroy->new($$, \&v2_done, $task); $LIVE{_try_config_start($task)} = [ \&_try_config_done, $task, $fini ]; -- 2.44.0