user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20231213005019.26912-10-e@80x24.org> (raw)
In-Reply-To: <20231213005019.26912-1-e@80x24.org>

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' }

  parent reply	other threads:[~2023-12-13  0:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  0:50 [PATCH 00/14] Alpine Linux support Eric Wong
2023-12-13  0:50 ` [PATCH 01/14] t/io: strace is optional on Linux Eric Wong
2023-12-13  0:50 ` [PATCH 02/14] tests: account for missing git-http-backend Eric Wong
2023-12-13  0:50 ` [PATCH 03/14] t/cindex*: skip --join when join(1) is missing Eric Wong
2023-12-13  0:50 ` [PATCH 04/14] tests: attempt compatibility w/ busybox lsof Eric Wong
2023-12-13  0:50 ` [PATCH 05/14] lei inspect: drop unneeded strftime import Eric Wong
2023-12-13  0:50 ` [PATCH 06/14] treewide: avoid strftime %k for portability Eric Wong
2023-12-13  0:50 ` [PATCH 07/14] xap_helper_cxx: decouple from Inline::C Eric Wong
2023-12-13  0:50 ` [PATCH 08/14] xap_helper_cxx: support clang w/o `c++' executable Eric Wong
2023-12-13  0:50 ` Eric Wong [this message]
2023-12-13  0:50 ` [PATCH 10/14] test_common: extract oct_is from search.t Eric Wong
2023-12-13  0:50 ` [PATCH 11/14] t/convert-compact: allow S_ISGID bit Eric Wong
2023-12-13  0:50 ` [PATCH 12/14] www_coderepo: fix read buffering Eric Wong
2023-12-13  0:50 ` [PATCH 13/14] gzip_filter: use OO ->zflush dispatch Eric Wong
2023-12-13  0:50 ` [PATCH 14/14] t/lei-import: relax EIO regexp Eric Wong

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: http://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=20231213005019.26912-10-e@80x24.org \
    --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.
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).