From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BAB141F55F for ; Fri, 15 Sep 2023 20:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1694810946; bh=zdPLuqJIJcSwkJe7pSemqFmfoss9bg9SkS4Z3ZdCLbU=; h=From:To:Subject:Date:From; b=xQBwZjVX9gbvzVlxbqFJF21wUnSZhobc3pMn6ddhnpgztKolUZBsYx9+UDBTfShgA Gi+WVwp1F3mQ1tYPeznX/nOLMqa8MPzZOhNN0I+bZovZ+rPjCM8T2naGzOT/6mTnz/ CvmU3o6jZmBVSNr8ug/8OAG5O12kdWspBiaP58fo= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] install/deps: flesh out libgit2, SQLite, and Xapian packages Date: Fri, 15 Sep 2023 20:49:06 +0000 Message-ID: <20230915204906.2058343-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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. --- install/deps.perl | 68 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/install/deps.perl b/install/deps.perl index 6a60c592..5576dd19 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,39 @@ 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 + }, + '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 +246,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 +308,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;