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 7501F1F55F for ; Sat, 16 Sep 2023 12:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1694866178; bh=pG4PqCfKYS1FDSd6tiwANzn5da6idTFjg8KSLM2ImT0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=JyyQ24MEreg8oBHEklbWpNuwbkoWWiOr1DqcEA8UNRYx0PYNzRp7OvJeIoujNW9ce FHWNbOM2biWVIlwiouFpr/jbwTLWsBLE7Lf6H98Dl8593WmBfyf/q0TtqwrzVCV00h Gcx+h1P74dqiV5+/7/KMCRJuDgCsn5+nKoFdYzEo= Date: Sat, 16 Sep 2023 12:09:24 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH v2] install/deps: flesh out libgit2, SQLite, and Xapian packages Message-ID: <20230916120924.M393625@dcvr> References: <20230915204906.2058343-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230915204906.2058343-1-e@80x24.org> 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. --- 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;