user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH 0/3] some dependency cleanups
@ 2019-01-10  6:59 Eric Wong
  2019-01-10  6:59 ` [PATCH 1/3] daemon: make Socket6 optional, note about Net::Socket::IP Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2019-01-10  6:59 UTC (permalink / raw)
  To: meta

Getting rid of Socket6 is on the horizon, at least.

It's a bit sad to drop wheezy support since that's what
I started the project with; but I then again I always had
git installed in $HOME and not /usr, so it probably still
works otherwise *shrug*

Eric Wong (3):
  daemon: make Socket6 optional, note about Net::Socket::IP
  INSTALL: Net::Server is not needed for systemd use
  check git version requirements

 INSTALL                      | 25 +++++++++++++++++--------
 lib/PublicInbox/Daemon.pm    | 19 ++++++++++++++++---
 lib/PublicInbox/SearchIdx.pm |  1 +
 t/altid_v2.t                 |  2 ++
 t/common.perl                | 14 ++++++++++++++
 t/convert-compact.t          |  2 ++
 t/import.t                   |  6 ++++--
 t/init.t                     |  2 ++
 t/mda_filter_rubylang.t      |  2 ++
 t/nntpd.t                    | 11 ++++++++---
 t/psgi_v2.t                  |  2 ++
 t/v1reindex.t                |  2 ++
 t/v2-add-remove-add.t        |  2 ++
 t/v2mda.t                    |  2 ++
 t/v2mirror.t                 |  1 +
 t/v2reindex.t                |  2 ++
 t/v2writable.t               |  1 +
 t/watch_maildir_v2.t         |  2 ++
 18 files changed, 82 insertions(+), 16 deletions(-)

-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] daemon: make Socket6 optional, note about Net::Socket::IP
  2019-01-10  6:59 [PATCH 0/3] some dependency cleanups Eric Wong
@ 2019-01-10  6:59 ` Eric Wong
  2019-01-10  6:59 ` [PATCH 2/3] INSTALL: Net::Server is not needed for systemd use Eric Wong
  2019-01-10  6:59 ` [PATCH 3/3] check git version requirements Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-01-10  6:59 UTC (permalink / raw)
  To: meta

It looks like Net::Socket::IP comes with Perl 5.20 and
later; so we won't have to hassle users with another
package to install.
---
 lib/PublicInbox/Daemon.pm | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 6d2ae81..6aa4a19 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -234,6 +234,21 @@ sub sockname ($) {
 	"$host:$port";
 }
 
+sub unpack_ipv6 ($) {
+	my ($addr) = @_;
+
+	# TODO: support IO::Socket::IP which comes with Perl 5.24
+	# (perl-modules-5.24 in Debian)
+
+	# SpamAssassin and Net::Server use Socket6, so it may be installed
+	# on our system, already:
+	eval { require Socket6 } or return ('???-Socket6-missing', 0);
+
+	my ($port, $host) = Socket6::unpack_sockaddr_in6($addr);
+	$host = Socket6::inet_ntop(Socket6::AF_INET6(), $host);
+	($host, $port);
+}
+
 sub host_with_port ($) {
 	my ($addr) = @_;
 	my ($port, $host);
@@ -241,9 +256,7 @@ sub host_with_port ($) {
 	# this eval will die on Unix sockets:
 	eval {
 		if (length($addr) >= 28) {
-			require Socket6;
-			($port, $host) = Socket6::unpack_sockaddr_in6($addr);
-			$host = Socket6::inet_ntop(Socket6::AF_INET6(), $host);
+			($host, $port) = unpack_ipv6($addr);
 			$host = "[$host]";
 		} else {
 			($port, $host) = Socket::sockaddr_in($addr);
-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] INSTALL: Net::Server is not needed for systemd use
  2019-01-10  6:59 [PATCH 0/3] some dependency cleanups Eric Wong
  2019-01-10  6:59 ` [PATCH 1/3] daemon: make Socket6 optional, note about Net::Socket::IP Eric Wong
@ 2019-01-10  6:59 ` Eric Wong
  2019-01-10  6:59 ` [PATCH 3/3] check git version requirements Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-01-10  6:59 UTC (permalink / raw)
  To: meta

Also, move Socket6 down since it's usually pulled in as
a dependency of Net::Server or SpamAssassin; and we can
fail gracefully without it.
---
 INSTALL | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/INSTALL b/INSTALL
index 7c98c11..ccd9dac 100644
--- a/INSTALL
+++ b/INSTALL
@@ -50,10 +50,6 @@ Where "deb" indicates package names for Debian-derived distributions and
 
 Numerous optional modules are likely to be useful as well:
 
-  - Socket6                    deb: libsocket6-perl
-                               rpm: perl-Socket6
-                               (for IPv6 support)
-
   - Search::Xapian             deb: libsearch-xapian-perl
                                rpm: perl-Search-Xapian
                                (for NNTP service or gzipped mbox over HTTP)
@@ -76,14 +72,15 @@ Numerous optional modules are likely to be useful as well:
 
   - Net::Server                deb: libnet-server-perl
                                rpm: perl-Net-Server
-                               (for HTTP/NNTP servers as standalone daemons)
+                               (for HTTP/NNTP servers as standalone daemons,
+                                not needed as systemd services)
 
   - Filesys::Notify::Simple    deb: libfilesys-notify-simple-perl
                                rpm: perl-Filesys-Notify-Simple
                                (for public-inbox-watch)
 
   - Inline::C[7]               deb: libinline-c-perl
-                               (speeds up spawning on Linux
+                               (speeds up spawning of git(1) on Linux
                                 (see public-inbox-daemon(8))
 
   - Plack::Middleware::ReverseProxy
@@ -99,6 +96,11 @@ Numerous optional modules are likely to be useful as well:
                                rpm: perl-Plack-Middleware-Deflater
                                (saves bandwidth on responses)
 
+  - Socket6                    deb: libsocket6-perl
+                               rpm: perl-Socket6
+                               (pulled in by SpamAssassin and Net::Server,
+                                only necessary if using IPv6 with
+                                Plack::Middleware::AccessLog or similar)
 
 On Fedora systems, you'll probably also end up wanting
 perl-Test-HTTP-Server-Simple, perl-Devel-Peek, and perl-IPC-Run to run the
-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] check git version requirements
  2019-01-10  6:59 [PATCH 0/3] some dependency cleanups Eric Wong
  2019-01-10  6:59 ` [PATCH 1/3] daemon: make Socket6 optional, note about Net::Socket::IP Eric Wong
  2019-01-10  6:59 ` [PATCH 2/3] INSTALL: Net::Server is not needed for systemd use Eric Wong
@ 2019-01-10  6:59 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-01-10  6:59 UTC (permalink / raw)
  To: meta

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.
---
 INSTALL                      | 11 +++++++++--
 lib/PublicInbox/SearchIdx.pm |  1 +
 t/altid_v2.t                 |  2 ++
 t/common.perl                | 14 ++++++++++++++
 t/convert-compact.t          |  2 ++
 t/import.t                   |  6 ++++--
 t/init.t                     |  2 ++
 t/mda_filter_rubylang.t      |  2 ++
 t/nntpd.t                    | 11 ++++++++---
 t/psgi_v2.t                  |  2 ++
 t/v1reindex.t                |  2 ++
 t/v2-add-remove-add.t        |  2 ++
 t/v2mda.t                    |  2 ++
 t/v2mirror.t                 |  1 +
 t/v2reindex.t                |  2 ++
 t/v2writable.t               |  1 +
 t/watch_maildir_v2.t         |  2 ++
 17 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/INSTALL b/INSTALL
index ccd9dac..a89c890 100644
--- 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:
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index fd48169..cc1ac56 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -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);
diff --git a/t/altid_v2.t b/t/altid_v2.t
index 87f1452..e91a644 100644
--- a/t/altid_v2.t
+++ b/t/altid_v2.t
@@ -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 $@;
diff --git a/t/common.perl b/t/common.perl
index 688e30a..e49a596 100644
--- a/t/common.perl
+++ b/t/common.perl
@@ -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;
diff --git a/t/convert-compact.t b/t/convert-compact.t
index def0343..491486d 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -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";
diff --git a/t/import.t b/t/import.t
index eee4744..e773363 100644
--- a/t/import.t
+++ b/t/import.t
@@ -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');
diff --git a/t/init.t b/t/init.t
index 1551a30..86b4eb5 100644
--- 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",
diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index 583a139..279afaa 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -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";
diff --git a/t/nntpd.t b/t/nntpd.t
index d227b74..6b13f81 100644
--- 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,
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 65448dc..9811249 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -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;
diff --git a/t/v1reindex.t b/t/v1reindex.t
index 8be9514..33a36fa 100644
--- a/t/v1reindex.t
+++ b/t/v1reindex.t
@@ -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";
diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t
index c8d12d3..1b700d7 100644
--- a/t/v2-add-remove-add.t
+++ b/t/v2-add-remove-add.t
@@ -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";
diff --git a/t/v2mda.t b/t/v2mda.t
index d041ffd..1c90a5b 100644
--- 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)) {
diff --git a/t/v2mirror.t b/t/v2mirror.t
index 283b2b2..ef9a540 100644
--- a/t/v2mirror.t
+++ b/t/v2mirror.t
@@ -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
diff --git a/t/v2reindex.t b/t/v2reindex.t
index 2dda80e..8a3071b 100644
--- a/t/v2reindex.t
+++ b/t/v2reindex.t
@@ -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";
diff --git a/t/v2writable.t b/t/v2writable.t
index c7eeee9..44156fe 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -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 $@;
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 3b5d2b8..5f96891 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -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";
-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  6:59 [PATCH 0/3] some dependency cleanups Eric Wong
2019-01-10  6:59 ` [PATCH 1/3] daemon: make Socket6 optional, note about Net::Socket::IP Eric Wong
2019-01-10  6:59 ` [PATCH 2/3] INSTALL: Net::Server is not needed for systemd use Eric Wong
2019-01-10  6:59 ` [PATCH 3/3] check git version requirements Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox