From: Eric Wong Date: Wed, 1 Jan 2025 22:36:59 +0000 (+0000) Subject: test_common: support `require_mods "v2"' for v2 inboxes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44a1e9042ab85a5fcf2e111574f6668fb06fa270;p=thirdparty%2Fpublic-inbox.git test_common: support `require_mods "v2"' for v2 inboxes For our purposes, `v2' should be interpreted as a public-inbox format and not as a Perl version (e.g. `use v5.12'). This ensures v2index-late-dupe.t correctly depends on DBD::SQLite and git v2.6+ via `require_mods "v2"' instead of requiring Perl v2.x. On a side note, it's unlikely public-inbox-v3 format will ever be necessary as the v2 format appears scalable enough; thus we won't hit v5 and risk conflicting with in-use Perl versions. However, I'm not ruling out a v2.112 format for (nearly) transparent v1->v2 migrations. --- diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 0f5b107dc..a887fef8f 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -209,6 +209,13 @@ sub require_mods (@) { push @mods, qw(DBD::SQLite Xapian +SCM_RIGHTS); $mod = 'json'; # fall-through } + if ($mod eq 'v2') { + require_git v2.6, $maybe ? $maybe : 0; + push @mods, 'DBD::SQLite'; + next; + } elsif ($mod =~ /\Av/) { # don't confuse with Perl versions + Carp::croak "BUG: require_mods `$mod' ambiguous"; + } if ($mod eq 'json') { $mod = 'Cpanel::JSON::XS||JSON::MaybeXS||JSON||JSON::PP' } elsif ($mod eq '-httpd') {