]> Sergey Matveev's repositories - public-inbox.git/commitdiff
check git version requirements
authorEric Wong <e@80x24.org>
Thu, 10 Jan 2019 04:53:10 +0000 (04:53 +0000)
committerEric Wong <e@80x24.org>
Thu, 10 Jan 2019 06:46:49 +0000 (06:46 +0000)
This allows v1 tests to continue working on git 1.8.0 for
now.  This allows git 2.1.4 packaged with Debian 8 ("jessie")
to run old tests, at least.

I suppose it's safe to drop Debian 7 ("wheezy") due to our
dependency on git 1.8.0 for "merge-base --is-ancestor".

Writing V2 repositories requires git 2.6 for "get-mark"
support, so mask out tests for older gits.

17 files changed:
INSTALL
lib/PublicInbox/SearchIdx.pm
t/altid_v2.t
t/common.perl
t/convert-compact.t
t/import.t
t/init.t
t/mda_filter_rubylang.t
t/nntpd.t
t/psgi_v2.t
t/v1reindex.t
t/v2-add-remove-add.t
t/v2mda.t
t/v2mirror.t
t/v2reindex.t
t/v2writable.t
t/watch_maildir_v2.t

diff --git a/INSTALL b/INSTALL
index ccd9dac91926dbca7cefa7a661bde104e501c87b..a89c8907e4552737366d382df972f4f5b3d318ce 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -5,6 +5,13 @@ This is for folks who want to setup their own public-inbox instance.
 Clients should use normal git-clone/git-fetch, or NNTP clients
 if they want to import mail into their personal inboxes.
 
+public-inbox is developed on Debian GNU/Linux systems and will
+never depend on packages outside of the "main" component of
+the "stable" distribution, currently Debian 9.x ("stretch")
+
+Most packages are available in other GNU/Linux distributions;
+and FreeBSD support can happen.
+
 TODO: this still needs to be documented better,
 also see the scripts/ and sa_config/ directories in the source tree
 
@@ -14,8 +21,8 @@ Requirements
 public-inbox requires a number of other packages to access its full
 functionality.  The core tools are, of course:
 
-* Git
-* Perl
+* Git (1.8.0+, 2.6+ for writing v2 repositories)
+* Perl 5.8+
 * SQLite (needed for Xapian use)
 
 To accept incoming mail into a public inbox, you'll likely want:
index fd48169d4d7bb73170906f3e007c56da6659848b..cc1ac56b933d65998bdc915711658ea5c6b4f06e 100644 (file)
@@ -646,6 +646,7 @@ sub _git_log {
                                --raw -r --no-abbrev/, $range);
 }
 
+# --is-ancestor requires git 1.8.0+
 sub is_ancestor ($$$) {
        my ($git, $cur, $tip) = @_;
        return 0 unless $git->check($cur);
index 87f1452bf9ac4aec6a5a1038f089315639bbca20..e91a644c6dc06d8e3aef05db401ba9332ec40682 100644 (file)
@@ -4,6 +4,8 @@ use strict;
 use warnings;
 use Test::More;
 use File::Temp qw/tempdir/;
+require './t/common.perl';
+require_git(2.6);
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
        plan skip_all => "$mod missing for altid_v2.t" if $@;
index 688e30ad99cbee6c39a186c289a42eca4d3465e3..e49a596524b17c5d559ed6f871bb80195e45fdef 100644 (file)
@@ -39,4 +39,18 @@ sub spawn_listener {
        $pid;
 }
 
+sub require_git ($;$) {
+       my ($req, $maybe) = @_;
+       my ($req_maj, $req_min) = split(/\./, $req);
+       my ($cur_maj, $cur_min) = (`git --version` =~ /version (\d+)\.(\d+)/);
+
+       my $req_int = ($req_maj << 24) | ($req_min << 16);
+       my $cur_int = ($cur_maj << 24) | ($cur_min << 16);
+       if ($cur_int < $req_int) {
+               return 0 if $maybe;
+               plan skip_all => "git $req+ required, have $git_ver";
+       }
+       1;
+}
+
 1;
index def03436231680c7b79e6fcc35939a7aca8a7fda..491486d5b05a8e2bdd99f7b604b81d70d99bfc75 100644 (file)
@@ -5,6 +5,8 @@ use warnings;
 use Test::More;
 use File::Temp qw/tempdir/;
 use PublicInbox::MIME;
+require './t/common.perl';
+require_git(2.6);
 my @mods = qw(DBD::SQLite Search::Xapian);
 foreach my $mod (@mods) {
        eval "require $mod";
index eee47447d3c9fbada1f9addee0f19423551e8cf4..e7733638f023fd4852963fe6d88b85da9f85e842 100644 (file)
@@ -11,6 +11,7 @@ use IO::File;
 use Fcntl qw(:DEFAULT);
 use File::Temp qw/tempdir tempfile/;
 my $dir = tempdir('pi-import-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+require './t/common.perl';
 
 is(system(qw(git init -q --bare), $dir), 0, 'git init successful');
 my $git = PublicInbox::Git->new($dir);
@@ -27,11 +28,12 @@ my $mime = PublicInbox::MIME->create(
        ],
        body => "hello world\n",
 );
+my $v2 = require_git(2.6, 1);
 
-$im->{want_object_info} = 1 if 'v2';
+$im->{want_object_info} = 1 if $v2;
 like($im->add($mime), qr/\A:\d+\z/, 'added one message');
 
-if ('v2') {
+if ($v2) {
        my $info = $im->{last_object};
        like($info->[0], qr/\A[a-f0-9]{40}\z/, 'got last object_id');
        is($mime->as_string, ${$info->[2]}, 'string matches');
index 1551a304e6b7c7b28bb3b9e8b935f9a231f745cb..86b4eb5c72e67b74a3474b1aee2030e3d3b71cec 100644 (file)
--- a/t/init.t
+++ b/t/init.t
@@ -5,6 +5,7 @@ use warnings;
 use Test::More;
 use PublicInbox::Config;
 use File::Temp qw/tempdir/;
+require './t/common.perl';
 my $tmpdir = tempdir('pi-init-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 use constant pi_init => 'blib/script/public-inbox-init';
 use PublicInbox::Import;
@@ -53,6 +54,7 @@ SKIP: {
                eval "require $mod";
                skip "$mod missing for v2", 2 if $@;
        }
+       require_git(2.6, 1) or skip "git 2.6+ required", 2;
        local $ENV{PI_DIR} = "$tmpdir/.public-inbox/";
        my $cfgfile = "$ENV{PI_DIR}/config";
        my @cmd = (pi_init, '-V2', 'v2list', "$tmpdir/v2list",
index 583a139f3b342ee7a6b55d85ae95c3563c327313..279afaac6e7c58d8928d7894217b6fc86f55232b 100644 (file)
@@ -6,6 +6,8 @@ use Test::More;
 use File::Temp qw/tempdir/;
 use PublicInbox::MIME;
 use PublicInbox::Config;
+require './t/common.perl';
+require_git(2.6);
 my @mods = qw(DBD::SQLite Search::Xapian IPC::Run);
 foreach my $mod (@mods) {
        eval "require $mod";
index d227b74d1835407507f1f83ba776d5dae796a804..6b13f81e7679f77a893442de74fadb4a48f0308e 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -18,6 +18,10 @@ use Net::NNTP;
 use Sys::Hostname;
 require './t/common.perl';
 
+# FIXME: make easier to test both versions
+my $version = $ENV{PI_VERSION} || 2;
+require_git('2.6') if $version == 2;
+
 my $tmpdir = tempdir('pi-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $home = "$tmpdir/pi-home";
 my $err = "$tmpdir/stderr.log";
@@ -30,10 +34,11 @@ my $init = 'blib/script/public-inbox-init';
 use_ok 'PublicInbox::Import';
 use_ok 'PublicInbox::Inbox';
 use_ok 'PublicInbox::Git';
-use_ok 'PublicInbox::V2Writable';
+SKIP: {
+       skip "git 2.6+ required for V2Writable", 1 if $version == 1;
+       use_ok 'PublicInbox::V2Writable';
+}
 
-# XXX FIXME: make it easier to test both versions
-my $version = int($ENV{PI_VERSION} || 1);
 my %opts = (
        LocalAddr => '127.0.0.1',
        ReuseAddr => 1,
index 65448dc435a3d9925942233c60f4fd98e3243d72..98112494b32cf90c202c02d103659961fd5fe6ad 100644 (file)
@@ -3,6 +3,8 @@
 use strict;
 use warnings;
 use Test::More;
+require './t/common.perl';
+require_git(2.6);
 use File::Temp qw/tempdir/;
 use PublicInbox::MIME;
 use PublicInbox::Config;
index 8be95149723c1539ef252c72147b6da739e4e287..33a36fad34b19791fcc20ef229e8ed3aa7d4c119 100644 (file)
@@ -7,6 +7,8 @@ use PublicInbox::MIME;
 use PublicInbox::ContentId qw(content_digest);
 use File::Temp qw/tempdir/;
 use File::Path qw(remove_tree);
+require './t/common.perl';
+require_git(2.6);
 
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
index c8d12d34b5903ee64e7b39975d3f1c6365db1a94..1b700d760b92500d3837695bfe61a39da4659274 100644 (file)
@@ -5,6 +5,8 @@ use warnings;
 use Test::More;
 use PublicInbox::MIME;
 use File::Temp qw/tempdir/;
+require './t/common.perl';
+require_git(2.6);
 
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
index d041ffd42e114948b022ba9037a2fb08355bac09..1c90a5b33fa91b5d0f5ba3fea7647258b50d3358 100644 (file)
--- a/t/v2mda.t
+++ b/t/v2mda.t
@@ -7,6 +7,8 @@ use PublicInbox::MIME;
 use File::Temp qw/tempdir/;
 use Fcntl qw(SEEK_SET);
 use Cwd;
+require './t/common.perl';
+require_git(2.6);
 
 my $V = 2;
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
index 283b2b228852f132f5ab3a3bb2480d81fa3f876f..ef9a5405a0dff95cb631731a26280e9addc73f5b 100644 (file)
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 require './t/common.perl';
+require_git(2.6);
 
 # Integration tests for HTTP cloning + mirroring
 foreach my $mod (qw(Plack::Util Plack::Builder Danga::Socket
index 2dda80e8c5e5adcf1c2e23a346e53c32165d378c..8a3071b734af5c763a8192cfafd74e3919e57f7a 100644 (file)
@@ -7,6 +7,8 @@ use PublicInbox::MIME;
 use PublicInbox::ContentId qw(content_digest);
 use File::Temp qw/tempdir/;
 use File::Path qw(remove_tree);
+require './t/common.perl';
+require_git(2.6);
 
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
index c7eeee997bb7c189c71de5902c3a6105f74c3ec5..44156fe19ebf22cd7b9d886c2774a0614c5c6895 100644 (file)
@@ -7,6 +7,7 @@ use PublicInbox::MIME;
 use PublicInbox::ContentId qw(content_digest);
 use File::Temp qw/tempdir/;
 require './t/common.perl';
+require_git(2.6);
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
        plan skip_all => "$mod missing for nntpd.t" if $@;
index 3b5d2b85f3006db34dbb9256c9e5432e258335f3..5f968919dfff669080aa4af0909f5750d97965d0 100644 (file)
@@ -5,6 +5,8 @@ use File::Temp qw/tempdir/;
 use PublicInbox::MIME;
 use Cwd;
 use PublicInbox::Config;
+require './t/common.perl';
+require_git(2.6);
 my @mods = qw(Filesys::Notify::Simple PublicInbox::V2Writable);
 foreach my $mod (@mods) {
        eval "require $mod";