user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/5] fixes for CentOS 7
@ 2019-05-22  2:13 Eric Wong
  2019-05-22  2:13 ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:13 UTC (permalink / raw)
  To: meta

Search::Xapian isn't available from the distro, but we can
support more things with only DBD::SQLite and DBI.

Eric Wong (5):
  init: preserve permissions for git prior to 2.1.0
  t/watch_filter_rubylang: disable v2 test for git < 2.6
  git: workaround old git-rev-parse(1) (--git-path)
  t/search*: require DBI and DBD::SQLite, too
  ci: support CentOS-7

 ci/deps.perl              |  7 +++++++
 ci/profiles.sh            |  6 ++++++
 lib/PublicInbox/Git.pm    |  5 +++++
 script/public-inbox-init  | 12 +++++++++++-
 t/search-thr-index.t      |  7 +++++--
 t/search.t                |  7 +++++--
 t/watch_filter_rubylang.t | 14 ++++++++++++--
 7 files changed, 51 insertions(+), 7 deletions(-)

-- 
EW

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

* [PATCH 1/5] init: preserve permissions for git prior to 2.1.0
  2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
@ 2019-05-22  2:13 ` Eric Wong
  2019-05-22  2:13 ` [PATCH 2/5] t/watch_filter_rubylang: disable v2 test for git < 2.6 Eric Wong
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:13 UTC (permalink / raw)
  To: meta

"git config" did not preserve permissions of the config file it
modifies prior to git 2.1.0, so workaround that.
---
 script/public-inbox-init | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/script/public-inbox-init b/script/public-inbox-init
index 5516e79..2cc704c 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -38,10 +38,11 @@ my $pi_config = PublicInbox::Config->default_file;
 my $dir = dirname($pi_config);
 mkpath($dir); # will croak on fatal errors
 my ($fh, $pi_config_tmp) = tempfile('pi-init-XXXXXXXX', DIR => $dir);
+my $perm;
 if (-e $pi_config) {
 	open(my $oh, '<', $pi_config) or die "unable to read $pi_config: $!\n";
 	my @st = stat($oh);
-	my $perm = $st[2];
+	$perm = $st[2];
 	defined $perm or die "(f)stat failed on $pi_config: $!\n";
 	chmod($perm & 07777, $fh) or
 		die "(f)chmod failed on future $pi_config: $!\n";
@@ -125,6 +126,9 @@ if ($version >= 2) {
 	die "Unsupported -V/--version: $version\n";
 }
 
+# needed for git prior to v2.1.0
+umask(0077) if defined $perm;
+
 foreach my $addr (@address) {
 	next if $seen{lc($addr)};
 	x(@x, "--add", "$pfx.address", $addr);
@@ -136,5 +140,11 @@ if (defined($indexlevel)) {
 	x(@x, "$pfx.indexlevel", $indexlevel);
 }
 
+# needed for git prior to v2.1.0
+if (defined $perm) {
+	chmod($perm & 07777, $pi_config_tmp) or
+			die "(f)chmod failed on future $pi_config: $!\n";
+}
+
 rename $pi_config_tmp, $pi_config or
 	die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n";
-- 
EW


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

* [PATCH 2/5] t/watch_filter_rubylang: disable v2 test for git < 2.6
  2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
  2019-05-22  2:13 ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong
@ 2019-05-22  2:13 ` Eric Wong
  2019-05-22  2:14 ` [PATCH 3/5] git: workaround old git-rev-parse(1) (--git-path) Eric Wong
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:13 UTC (permalink / raw)
  To: meta

This test was not disabled properly for ancient versions of
git without get-mark support.
---
 t/watch_filter_rubylang.t | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index 3256555..da383c1 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -2,6 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
+require './t/common.perl';
 use Test::More;
 use File::Temp qw/tempdir/;
 use PublicInbox::MIME;
@@ -12,13 +13,22 @@ foreach my $mod (@mods) {
 	plan skip_all => "$mod missing for watch_filter_rubylang_v2.t" if $@;
 }
 
-use_ok 'PublicInbox::V2Writable';
 use_ok 'PublicInbox::WatchMaildir';
 use_ok 'PublicInbox::Emergency';
 my $tmpdir = tempdir('watch-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
 
-for my $v (qw(V1 V2)) {
+my @v = qw(V1);
+SKIP: {
+	if (require_git(2.6, 1)) {
+		use_ok 'PublicInbox::V2Writable';
+		push @v, 'V2';
+	} else {
+		skip 'git 2.6+ needed for V2', 40;
+	}
+}
+
+for my $v (@v) {
 	my @warn;
 	$SIG{__WARN__} = sub { push @warn, @_ };
 	my $cfgpfx = "publicinbox.$v";
-- 
EW


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

* [PATCH 3/5] git: workaround old git-rev-parse(1) (--git-path)
  2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
  2019-05-22  2:13 ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong
  2019-05-22  2:13 ` [PATCH 2/5] t/watch_filter_rubylang: disable v2 test for git < 2.6 Eric Wong
@ 2019-05-22  2:14 ` Eric Wong
  2019-05-22  2:14 ` [PATCH 4/5] t/search*: require DBI and DBD::SQLite, too Eric Wong
  2019-05-22  2:14 ` [PATCH 5/5] ci: support CentOS-7 Eric Wong
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:14 UTC (permalink / raw)
  To: meta

git < 2.5.0 was missing --git-path support.  This means any
users relying on some rare environment variables will need git
2.5.0+
---
 lib/PublicInbox/Git.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 236f70c..a4daaa4 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -59,6 +59,11 @@ sub git_path ($$) {
 	$self->{-git_path}->{$path} ||= do {
 		local $/ = "\n";
 		chomp(my $str = $self->qx(qw(rev-parse --git-path), $path));
+
+		# git prior to 2.5.0 did not understand --git-path
+		if ($str eq "--git-path\n$path") {
+			$str = "$self->{git_dir}/$path";
+		}
 		$str;
 	};
 }
-- 
EW


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

* [PATCH 4/5] t/search*: require DBI and DBD::SQLite, too
  2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
                   ` (2 preceding siblings ...)
  2019-05-22  2:14 ` [PATCH 3/5] git: workaround old git-rev-parse(1) (--git-path) Eric Wong
@ 2019-05-22  2:14 ` Eric Wong
  2019-05-22  2:14 ` [PATCH 5/5] ci: support CentOS-7 Eric Wong
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:14 UTC (permalink / raw)
  To: meta

None of the Search::Xapian-dependent stuff works without DBI
and DBD::SQLite.

There are no plans to support Xapian w/o DBD::SQLite since
SQLite is more common and less resource-intensive than Xapian.
---
 t/search-thr-index.t | 7 +++++--
 t/search.t           | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/t/search-thr-index.t b/t/search-thr-index.t
index 848dc56..1872af8 100644
--- a/t/search-thr-index.t
+++ b/t/search-thr-index.t
@@ -7,8 +7,11 @@ use Test::More;
 use File::Temp qw/tempdir/;
 use PublicInbox::MID qw(mids);
 use Email::MIME;
-eval { require Search::Xapian };
-plan skip_all => "Search::Xapian missing for search" if $@;
+my @mods = qw(DBI DBD::SQLite Search::Xapian);
+foreach my $mod (@mods) {
+	eval "require $mod";
+	plan skip_all => "missing $mod for $0" if $@;
+}
 require PublicInbox::SearchIdx;
 my $tmpdir = tempdir('pi-search-thr-index.XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $git_dir = "$tmpdir/a.git";
diff --git a/t/search.t b/t/search.t
index a9d0c92..c063620 100644
--- a/t/search.t
+++ b/t/search.t
@@ -3,8 +3,11 @@
 use strict;
 use warnings;
 use Test::More;
-eval { require Search::Xapian };
-plan skip_all => "Search::Xapian missing for search" if $@;
+my @mods = qw(DBI DBD::SQLite Search::Xapian);
+foreach my $mod (@mods) {
+	eval "require $mod";
+	plan skip_all => "missing $mod for $0" if $@;
+};
 require PublicInbox::SearchIdx;
 use File::Temp qw/tempdir/;
 use Email::MIME;
-- 
EW


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

* [PATCH 5/5] ci: support CentOS-7
  2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
                   ` (3 preceding siblings ...)
  2019-05-22  2:14 ` [PATCH 4/5] t/search*: require DBI and DBD::SQLite, too Eric Wong
@ 2019-05-22  2:14 ` Eric Wong
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2019-05-22  2:14 UTC (permalink / raw)
  To: meta

Tested on an amd64 chroot built with rinse 3.4
---
 ci/deps.perl   | 7 +++++++
 ci/profiles.sh | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/ci/deps.perl b/ci/deps.perl
index 32b0226..faca459 100755
--- a/ci/deps.perl
+++ b/ci/deps.perl
@@ -58,6 +58,8 @@ my $profiles = {
 my @precious;
 if ($^O eq 'freebsd') {
 	@precious = qw(perl curl Socket6 IO::Compress::Gzip);
+} elsif ($pkg_fmt eq 'rpm') {
+	@precious = qw(perl curl);
 }
 
 if (@precious) {
@@ -168,6 +170,11 @@ if ($pkg_fmt eq 'deb') {
 	root(qw(pkg install -y), @quiet, @pkg_install) if @pkg_install;
 	root(qw(pkg autoremove -y), @quiet);
 # TODO: yum / rpm support
+} elsif ($pkg_fmt eq 'rpm') {
+	my @quiet = $ENV{V} ? () : ('-q');
+	exclude_uninstalled(\@pkg_remove);
+	root(qw(yum remove -y), @quiet, @pkg_remove) if @pkg_remove;
+	root(qw(yum install -y), @quiet, @pkg_install) if @pkg_install;
 } else {
 	die "unsupported package format: $pkg_fmt\n";
 }
diff --git a/ci/profiles.sh b/ci/profiles.sh
index 5d7c2cf..d559ec5 100755
--- a/ci/profiles.sh
+++ b/ci/profiles.sh
@@ -68,6 +68,12 @@ all devtest-
 v2essential
 essential
 essential devtest-
+EOF
+	;;
+centos-7) sed "s/^/$PKG_FMT /" <<EOF
+v2essential devtest
+essential devtest
+all Search::Xapian-
 EOF
 	;;
 esac
-- 
EW


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

end of thread, other threads:[~2019-05-22  2:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22  2:13 [PATCH 0/5] fixes for CentOS 7 Eric Wong
2019-05-22  2:13 ` [PATCH 1/5] init: preserve permissions for git prior to 2.1.0 Eric Wong
2019-05-22  2:13 ` [PATCH 2/5] t/watch_filter_rubylang: disable v2 test for git < 2.6 Eric Wong
2019-05-22  2:14 ` [PATCH 3/5] git: workaround old git-rev-parse(1) (--git-path) Eric Wong
2019-05-22  2:14 ` [PATCH 4/5] t/search*: require DBI and DBD::SQLite, too Eric Wong
2019-05-22  2:14 ` [PATCH 5/5] ci: support CentOS-7 Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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