unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH v2] install/deps: flesh out libgit2, SQLite, and Xapian packages
Date: Sat, 16 Sep 2023 12:09:24 +0000	[thread overview]
Message-ID: <20230916120924.M393625@dcvr> (raw)
In-Reply-To: <20230915204906.2058343-1-e@80x24.org>

This seems to work reasonably well across multiple BSDs and
Debian and smooth out differences in packaging granularity.

Declaring the $always_deps relationship between `Xapian'(.pm) and
libxapian means we can get rid of the OpenBSD-specific hack to
remove `xapian-bindings-perl' before other packages.
---
Range-diff:
1:  034b0e84 ! 1:  4b5cdf23 install/deps: flesh out libgit2, SQLite, and Xapian packages
    @@ install/deps.perl: my $non_auto = {
     +	'pkg-config' => {
     +		pkg_add => [], # part of the OpenBSD base system
     +		pkg => 'pkgconf', # pkg-config is a symlink to pkgconf
    ++		pkgin => 'pkg-config',
     +	},
     +	'sqlite3' => { # this is just the executable binary on deb
     +		rpm => [], # `sqlite' is not removable due to yum/systemd

 install/deps.perl | 69 ++++++++++++++++++++++++++++++++++-------------
 1 file changed, 51 insertions(+), 18 deletions(-)

diff --git a/install/deps.perl b/install/deps.perl
index 6a60c592..900668c7 100755
--- a/install/deps.perl
+++ b/install/deps.perl
@@ -50,7 +50,6 @@ my $profiles = {
 
 	# everything optional for normal use
 	optional => [ qw(
-		curl
 		Date::Parse
 		BSD::Resource
 		DBD::SQLite
@@ -62,7 +61,11 @@ my $profiles = {
 		Plack::Test
 		Plack::Middleware::ReverseProxy
 		Xapian
+		curl
 		highlight.pm
+		libxapian
+		pkg-config
+		sqlite3
 		xapian-tools
 		) ],
 
@@ -76,9 +79,14 @@ my $profiles = {
 
 # only for distro-agnostic dependencies which are always true:
 my $always_deps = {
-	'DBD::SQLite' => [ qw(DBI) ],
-	'Mail::IMAPClient' => [ qw(Parse::RecDescent) ],
-	'Plack::Middleware::ReverseProxy' => [ qw(Plack) ],
+	# we only load DBI explicitly
+	'DBD::SQLite' => [ qw(DBI libsqlite3) ],
+	'Mail::IMAPClient' => 'Parse::RecDescent',
+	'Plack::Middleware::ReverseProxy' => 'Plack',
+	'Xapian' => 'libxapian',
+	'xapian-tools' => 'libxapian',
+	'libxapian-dev' => [ qw(pkg-config libxapian) ],
+	'libgit2-dev' => 'pkg-config',
 };
 
 # bare minimum for v2
@@ -110,7 +118,7 @@ $profiles->{'watch-maildir'} = [ @{$profiles->{v2essential}} ];
 
 # package names which can't be mapped automatically and explicit
 # dependencies to prevent essential package removal:
-my $non_auto = {
+my $non_auto = { # git and perl are essential
 	git => {
 		pkg => [ qw(curl p5-TimeDate git) ],
 		rpm => [ qw(curl git) ],
@@ -121,6 +129,7 @@ my $non_auto = {
 		pkgin => 'perl',
 		pkg_add => [], # Perl is part of OpenBSD base
 	},
+	# optional stuff:
 	'Date::Parse' => {
 		deb => 'libtimedate-perl',
 		pkg => 'p5-TimeDate',
@@ -138,9 +147,8 @@ my $non_auto = {
 	},
 	'Xapian' => {
 		deb => 'libsearch-xapian-perl',
-		pkg => [qw(xapian-core p5-Xapian)],
-		pkg_add => [qw(xapian-core xapian-bindings-perl)],
-		pkgin => [qw(xapian p5-Xapian)],
+		pkg => 'p5-Xapian',
+		pkg_add => 'xapian-bindings-perl',
 		rpm => 'Search::Xapian', # 3rd-party repo
 	},
 	'highlight.pm' => {
@@ -150,6 +158,40 @@ my $non_auto = {
 		rpm => [],
 	},
 
+	# `libgit2' is the project name (since git has libgit)
+	'libgit2-dev' => {
+		pkg => 'libgit2',
+		rpm => 'libgit2-devel',
+	},
+
+	# some distros have both sqlite 2 and 3, we've only ever used 3
+	'libsqlite3' => {
+		pkg => 'sqlite3',
+		rpm => [], # `sqlite' is not removable due to yum/systemd
+		deb => [], # libsqlite3-0, but no need to specify
+	},
+
+	# only one version of Xapian distros
+	'libxapian' => { # avoid .so version numbers in our deps
+		deb => [], # libxapian30 atm, but no need to specify
+		pkg => 'xapian-core',
+		pkgin => 'xapian',
+		rpm => 'xapian-core',
+	},
+	'libxapian-dev' => {
+		pkg => 'xapian-core',
+		pkgin => 'xapian',
+		rpm => 'xapian-core-devel',
+	},
+	'pkg-config' => {
+		pkg_add => [], # part of the OpenBSD base system
+		pkg => 'pkgconf', # pkg-config is a symlink to pkgconf
+		pkgin => 'pkg-config',
+	},
+	'sqlite3' => { # this is just the executable binary on deb
+		rpm => [], # `sqlite' is not removable due to yum/systemd
+	},
+
 	# we call xapian-compact(1) in public-inbox-compact(1) and
 	# xapian-delve(1) in public-inbox-cindex(1)
 	'xapian-tools' => {
@@ -205,7 +247,7 @@ for my $ary (values %$profiles) {
 	my @extra;
 	for my $pkg (@$ary) {
 		my $deps = $always_deps->{$pkg} // next;
-		push @extra, @$deps;
+		push @extra, list($deps);
 	}
 	push @$ary, @extra;
 	$all{$_} = \@pkg_remove for @$ary;
@@ -267,15 +309,6 @@ if ($pkg_fmt eq 'deb') {
 	root(qw(yum install), @pkg_opt, @pkg_install) if @pkg_install;
 } elsif ($pkg_fmt eq 'pkg_add') { # OpenBSD
 	my @pkg_opt = $opt->{yes} ? qw(-I) : (); # -I means non-interactive
-	if (@pkg_remove) {
-		my @lifo = qw(xapian-bindings-perl);
-		for my $dep (@lifo) {
-			grep(/\A\Q$dep\E\z/, @pkg_remove) or next;
-			root(qw(pkg_delete), @pkg_opt, $dep);
-			@pkg_remove = grep(!/\A\Q$dep\E\z/, @pkg_remove);
-		}
-		root(qw(pkg_delete), @pkg_opt, @pkg_remove);
-	}
 	root(qw(pkg_delete -a), @pkg_opt); # autoremove unspecified
 	@pkg_install = map { "$_--" } @pkg_install; # disambiguate w3m
 	root(qw(pkg_add), @pkg_opt, @pkg_install) if @pkg_install;

      reply	other threads:[~2023-09-16 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 20:49 [PATCH] install/deps: flesh out libgit2, SQLite, and Xapian packages Eric Wong
2023-09-16 12:09 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230916120924.M393625@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).