unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] test_common: support `require_mods "v2"' for v2 inboxes
@ 2025-01-01 22:36 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2025-01-01 22:36 UTC (permalink / raw)
  To: meta

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.
---
 lib/PublicInbox/TestCommon.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 0f5b107d..a887fef8 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') {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-01 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-01 22:36 [PATCH] test_common: support `require_mods "v2"' for v2 inboxes Eric Wong

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).