* [PATCH 09/14] install: updates for Alpine Linux and apk
2023-12-13 0:50 7% [PATCH 00/14] Alpine Linux support Eric Wong
@ 2023-12-13 0:50 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-12-13 0:50 UTC (permalink / raw)
To: meta
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' }
^ permalink raw reply related [relevance 6%]
* [PATCH 00/14] Alpine Linux support
@ 2023-12-13 0:50 7% Eric Wong
2023-12-13 0:50 6% ` [PATCH 09/14] install: updates for Alpine Linux and apk Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-12-13 0:50 UTC (permalink / raw)
To: meta
I haven't tested every single possible package combination, but
I think this is enough to get started.
Patch 3 was a WTF moment for me.
Some of these are relevant for other platforms, as well, and
patch 7 decoupling from Inline::C is a good step towards making
our codebase more modular.
Patch 12 is a good fix regardless.
Eric Wong (14):
t/io: strace is optional on Linux
tests: account for missing git-http-backend
t/cindex*: skip --join when join(1) is missing
tests: attempt compatibility w/ busybox lsof
lei inspect: drop unneeded strftime import
treewide: avoid strftime %k for portability
xap_helper_cxx: decouple from Inline::C
xap_helper_cxx: support clang w/o `c++' executable
install: updates for Alpine Linux and apk
test_common: extract oct_is from search.t
t/convert-compact: allow S_ISGID bit
www_coderepo: fix read buffering
gzip_filter: use OO ->zflush dispatch
t/lei-import: relax EIO regexp
install/deps.perl | 38 +++++++++++++++++++++----
install/os.perl | 12 ++++++--
lib/PublicInbox/Admin.pm | 10 ++++++-
lib/PublicInbox/ExtSearchIdx.pm | 4 +--
lib/PublicInbox/GzipFilter.pm | 2 +-
lib/PublicInbox/Hval.pm | 6 +++-
lib/PublicInbox/LeiInspect.pm | 1 -
lib/PublicInbox/LeiMirror.pm | 4 +--
lib/PublicInbox/LeiXSearch.pm | 3 +-
lib/PublicInbox/RepoAtom.pm | 4 +--
lib/PublicInbox/TestCommon.pm | 50 +++++++++++++++++++++++++++++++--
lib/PublicInbox/WwwCoderepo.pm | 6 ++--
lib/PublicInbox/WwwStatic.pm | 5 ++--
lib/PublicInbox/XapHelperCxx.pm | 26 +++++++++++------
t/cindex-join.t | 1 +
t/cindex.t | 11 ++++----
t/clone-coderepo.t | 1 +
t/convert-compact.t | 20 ++++++-------
t/ds-leak.t | 5 +---
t/httpd-corner.t | 31 ++++++++------------
t/httpd.t | 1 +
t/lei-import.t | 5 ++--
t/lei-mirror.t | 1 +
t/nntpd.t | 16 +++++------
t/search.t | 5 ----
t/solver_git.t | 8 ++++--
t/v2reindex.t | 5 ++--
t/www_listing.t | 1 +
t/xap_helper.t | 6 ++--
xt/msgtime_cmp.t | 2 +-
30 files changed, 190 insertions(+), 100 deletions(-)
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-12-13 0:50 7% [PATCH 00/14] Alpine Linux support Eric Wong
2023-12-13 0:50 6% ` [PATCH 09/14] install: updates for Alpine Linux and apk 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).