From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5F4921FAF8 for ; Mon, 28 Nov 2022 05:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613554; bh=gLKYMVoTWOaNEfSn/dDL5arJGueYaa5F0rNspaY9N+I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xeuIbMwTRrxKOtHFsbZq8+AjQAveWd9H4vJIuscupmF/mLZdL8sD7biAC9C7Eop+o C1RipFDkITw/ime3bVEolcLfrkEQB9fMmyJtY302KjYJcXdYjHoqrmQBZn9FizROis ry1PCGyemTUo/ExJFEDQinZfoVylhyBkmhld1Wnk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/95] lei_mirror: move directory creation to v2-only path Date: Mon, 28 Nov 2022 05:31:06 +0000 Message-Id: <20221128053232.291618-10-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 ];