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,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 67B4F1F68D for ; Wed, 13 Dec 2023 00:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1702428621; bh=eLOmHm/XwCINiIitmmYqDd+pF7N5gPaF7VvE5QXlt8M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=1TmmmBU0xmZEH3+e0+INNIA7cAc7elDuXBmSAVzGvhc4bxmX6DeR9+c6B3L4fDlYa ydQgrqA4eGdwnCLMxJmC8NhMVXNadI7cTLbx6FUkEZu+BnyR24nwZLXYykE9m3U1iK kEic6MjldpncMTuUGcvw2ORKq6/IlRoN5wvC5lnM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/14] install: updates for Alpine Linux and apk Date: Wed, 13 Dec 2023 00:50:14 +0000 Message-ID: <20231213005019.26912-10-e@80x24.org> In-Reply-To: <20231213005019.26912-1-e@80x24.org> References: <20231213005019.26912-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Somewhat surprising that BSD::Resource hasn't been packaged for Alpine, but otherwise pretty straightforward mapping with some dependencies filled in manually. --- install/deps.perl | 38 +++++++++++++++++++++++++++++++++----- install/os.perl | 12 +++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/install/deps.perl b/install/deps.perl index 3fed4f10..6563c3ce 100755 --- a/install/deps.perl +++ b/install/deps.perl @@ -130,33 +130,48 @@ my $non_auto = { # git and perl (+autodie) are essential pkg_add => [ qw(curl p5-Time-TimeDate git) ], }, perl => { + apk => [ qw(perl perl-utils) ], pkg => 'perl5', pkgin => 'perl', pkg_add => [], # Perl is part of OpenBSD base }, # optional stuff: + 'BSD::Resource' => { + apk => [], # not packaged for Alpine 3.19 + }, 'Date::Parse' => { + apk => 'perl-timedate', deb => 'libtimedate-perl', pkg => 'p5-TimeDate', rpm => 'perl-TimeDate', pkg_add => 'p5-Time-TimeDate', }, 'Inline::C' => { + apk => [ qw(perl-inline-c perl-dev) ], pkg_add => 'p5-Inline', # tested OpenBSD 7.3 rpm => 'perl-Inline', # for CentOS 7.x, at least }, 'DBD::SQLite' => { deb => 'libdbd-sqlite3-perl' }, + 'Plack::Middleware::ReverseProxy' => { + apk => [], # not packaged for Alpine 3.19.0 + }, 'Plack::Test' => { + apk => 'perl-plack', deb => 'libplack-perl', pkg => 'p5-Plack', }, + 'Plack::Test::ExternalServer' => { + apk => [], # not packaged for Alpine 3.19.0 + }, 'Xapian' => { + apk => 'xapian-bindings-perl', deb => 'libsearch-xapian-perl', pkg => 'p5-Xapian', pkg_add => 'xapian-bindings-perl', rpm => [], # xapian14-bindings-perl in 3rd-party repo }, 'highlight.pm' => { + apk => [], deb => 'libhighlight-perl', pkg => [], pkgin => 'p5-highlight', @@ -171,6 +186,7 @@ my $non_auto = { # git and perl (+autodie) are essential # some distros have both sqlite 2 and 3, we've only ever used 3 'libsqlite3' => { + apk => [], # handled by apk w/ perl-dbd-sqlite pkg => 'sqlite3', rpm => [], # `sqlite' is not removable due to yum/systemd deb => [], # libsqlite3-0, but no need to specify @@ -184,22 +200,26 @@ my $non_auto = { # git and perl (+autodie) are essential rpm => 'xapian-core', }, 'libxapian-dev' => { + apk => 'xapian-core-dev', pkg => 'xapian-core', pkgin => 'xapian', rpm => 'xapian-core-devel', }, 'pkg-config' => { + apk => [], # handled by apk w/ xapian-core-dev 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 + apk => 'sqlite', 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' => { + apk => 'xapian-core', pkg => 'xapian-core', pkgin => 'xapian', rpm => 'xapian-core', # ??? @@ -207,6 +227,7 @@ my $non_auto = { # git and perl (+autodie) are essential # OS-specific 'IO::KQueue' => { + apk => [], deb => [], rpm => [], }, @@ -226,6 +247,7 @@ for (qw(autodie Digest::SHA ExtUtils::MakeMaker IO::Compress Sys::Syslog deb => 'perl', # libperl5.XX, but the XX varies pkg => 'perl5', pkg_add => [], # perl is in the OpenBSD base system + apk => 'perl', pkgin => 'perl', rpm => "perl-$rpm", }; @@ -240,8 +262,9 @@ if ($pkg_fmt =~ /\A(?:pkg_add|pkgin)\z/) { } my %inst_check = ( # subs which return true if a package is intalled - pkg => sub { system(qw(pkg info -q), $_[0]) == 0 }, + apk => sub { system(qw(apk info -q -e), $_[0]) == 0 }, deb => sub { system("dpkg -s $_[0] >/dev/null 2>&1") == 0 }, + pkg => sub { system(qw(pkg info -q), $_[0]) == 0 }, pkg_add => sub { system(qw(pkg_info -q -e), "$_[0]->=0") == 0 }, pkgin => sub { system(qw(pkg_info -q -e), $_[0]) == 0 }, rpm => sub { system("rpm -qs $_[0] >/dev/null 2>&1") == 0 }, @@ -290,7 +313,10 @@ my (%add, %rm); # uniquify lists (@pkg_remove || @pkg_install) or warn "# no packages to install nor remove\n"; # OS-specific cleanups appreciated -if ($pkg_fmt eq 'deb') { +if ($pkg_fmt eq 'apk') { + root('apk', 'add', @pkg_install) if @pkg_install; + root('apk', 'del', @pkg_remove) if @pkg_remove; +} elsif ($pkg_fmt eq 'deb') { my @apt_opt = qw(-o APT::Install-Recommends=false -o APT::Install-Suggests=false); push @apt_opt, '-y' if $opt->{yes}; @@ -340,10 +366,12 @@ sub pkg2ospkg { # check common Perl module name patterns: if ($pkg =~ /::/ || $pkg =~ /\A[A-Z]/) { - if ($fmt eq 'deb') { + if ($fmt eq 'apk') { + $pkg =~ s/::/-/g; + return "perl-\L$pkg" + } elsif ($fmt eq 'deb') { $pkg =~ s/::/-/g; - $pkg =~ tr/A-Z/a-z/; - return "lib$pkg-perl"; + return "lib\L$pkg-perl"; } elsif ($fmt eq 'rpm') { $pkg =~ s/::/-/g; return "perl-$pkg" diff --git a/install/os.perl b/install/os.perl index bf5c55c2..00edbadf 100644 --- a/install/os.perl +++ b/install/os.perl @@ -50,8 +50,13 @@ EOM die "$^O unsupported"; } $VERSION_ID //= 0; # numeric? could be 'sid', actually... -my %MIN_VER = (freebsd => v11, openbsd => v7.3, netbsd => v9.3, - dragonfly => v6.4); +my %MIN_VER = ( # likely older versions work for many of these... + alpine => v3.19, + dragonfly => v6.4, + freebsd => v11, + netbsd => v9.3, + openbsd => v7.3, +); if (defined(my $min_ver = $MIN_VER{$^O})) { my $vid = $VERSION_ID; @@ -64,7 +69,8 @@ EOM } sub pkg_fmt () { - if ($ID =~ /\A(?:freebsd|dragonfly)\z/) { 'pkg' } + if ($ID eq 'alpine') { 'apk' } + elsif ($ID =~ /\A(?:freebsd|dragonfly)\z/) { 'pkg' } # *shrug*, as long as the (Net|Open)BSD names don't conflict w/ FreeBSD elsif ($ID eq 'netbsd') { 'pkgin' } elsif ($ID eq 'openbsd') { 'pkg_add' }