From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/9] wwwstream: flesh out clone instructions for v2
Date: Fri, 30 Mar 2018 01:20:43 +0000 [thread overview]
Message-ID: <20180330012048.15985-5-e@80x24.org> (raw)
In-Reply-To: <20180330012048.15985-1-e@80x24.org>
Relying solely on git for v2 repos is probably not
so useful, so add pointers to public-inbox-init/index
commands.
---
lib/PublicInbox/WwwStream.pm | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 7631754..ec75f16 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -74,14 +74,17 @@ sub _html_end {
my (%seen, @urls);
my $http = $obj->base_url($ctx->{env});
- chop $http; # no trailing slash
+ chop $http; # no trailing slash for clone
my $part = $obj->max_git_part;
+ my $dir = (split(m!/!, $http))[-1];
if (defined($part)) { # v2
- # most recent partition first:
- for (; $part >= 0; $part--) {
- my $url = "$http/$part";
+ $seen{$http} = 1;
+ for my $i (0..$part) {
+ # old parts my be deleted:
+ -d "$obj->{mainrepo}/git/$i.git" or next;
+ my $url = "$http/$i";
$seen{$url} = 1;
- push @urls, $url;
+ push @urls, "$url $dir/git/$i.git";
}
} else { # v1
$seen{$http} = 1;
@@ -102,7 +105,19 @@ sub _html_end {
$urls .= "\n" .
join("\n", map { "\tgit clone --mirror $_" } @urls);
}
+ if (defined $part) {
+ my $addrs = $obj->{address};
+ $addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
+ $urls .= <<EOF
+
+ # If you have public-inbox 1.1+ installed, you may
+ # initialize and index your mirror using the following commands:
+ public-inbox-init -V2 $obj->{name} $dir/ $http \\
+ $addrs
+ public-inbox-index $dir
+EOF
+ }
my @nntp = map { qq(<a\nhref="$_">$_</a>) } @{$obj->nntp_url};
if (@nntp) {
$urls .= "\n\n";
--
EW
next prev parent reply other threads:[~2018-03-30 1:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 1:20 [PATCH 0/9] minor tweaks and fixes Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 1/9] search: warn on reopens and die on total failure Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 2/9] v2writable: allow gaps in git partitions Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 3/9] v2writable: convert some fatal reindex errors to warnings Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` Eric Wong (Contractor, The Linux Foundation) [this message]
2018-03-30 1:20 ` [PATCH 5/9] v2writable: go backwards through alternate Message-IDs Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 6/9] view: speed up homepage loading time with date clamp Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 7/9] view: drop load_results Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 8/9] msgtime: parse 3-digit years properly Eric Wong (Contractor, The Linux Foundation)
2018-03-30 1:20 ` [PATCH 9/9] feed: optimize query for feeds, too Eric Wong (Contractor, The Linux Foundation)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180330012048.15985-5-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).