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 5/8] update CI helper scripts for NetBSD and `pkgin'
Date: Sat,  9 Sep 2023 12:01:39 +0000	[thread overview]
Message-ID: <20230909120142.1041752-6-e@80x24.org> (raw)
In-Reply-To: <20230909120142.1041752-1-e@80x24.org>

---
 ci/deps.perl     | 24 +++++++++++++++++++++---
 ci/profiles.perl | 12 ++++--------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/ci/deps.perl b/ci/deps.perl
index 68b602ef..6bc38735 100755
--- a/ci/deps.perl
+++ b/ci/deps.perl
@@ -67,6 +67,7 @@ my $non_auto = {
 	},
 	perl => {
 		pkg => 'perl5',
+		pkgin => 'perl',
 		pkg_add => [], # Perl is part of OpenBSD base
 	},
 	'Date::Parse' => {
@@ -87,11 +88,13 @@ my $non_auto = {
 	'Search::Xapian' => {
 		pkg => [qw(xapian-core p5-Xapian)],
 		pkg_add => [qw(xapian-core xapian-bindings-perl)],
+		pkgin => [qw(xapian p5-Xapian)],
 		rpm => 'Search::Xapian', # 3rd-party repo
 	},
 	'highlight.pm' => {
 		deb => 'libhighlight-perl',
 		pkg => [],
+		pkgin => 'p5-highlight',
 		rpm => [],
 	},
 
@@ -99,6 +102,7 @@ my $non_auto = {
 	# xapian-delve(1) in public-inbox-cindex(1)
 	'xapian-tools' => {
 		pkg => 'xapian-core',
+		pkgin => 'xapian',
 		rpm => 'xapian-core', # ???
 	},
 
@@ -114,21 +118,29 @@ for (qw(Digest::SHA Encode ExtUtils::MakeMaker IO::Compress Test::Simple)) {
 	$non_auto->{$_} = {
 		deb => 'perl', # libperl5.XX, but the XX varies
 		pkg => 'perl5',
+		pkg_add => [], # perl is in the OpenBSD base system
+		pkgin => 'perl',
 	};
 }
 
+# NetBSD and OpenBSD package names are similar to FreeBSD in most cases
 if ($pkg_fmt eq 'pkg_add') {
 	for my $name (keys %$non_auto) {
 		my $fbsd_pkg = $non_auto->{$name}->{pkg};
-		$fbsd_pkg = [] if ($fbsd_pkg // '') eq 'perl5';
 		$non_auto->{$name}->{pkg_add} //= $fbsd_pkg if $fbsd_pkg;
 	}
+} elsif ($pkg_fmt eq 'pkgin') {
+	for my $name (keys %$non_auto) {
+		my $fbsd_pkg = $non_auto->{$name}->{pkg};
+		$non_auto->{$name}->{pkgin} //= $fbsd_pkg if $fbsd_pkg;
+	}
 }
 
 my %inst_check = (
 	pkg => sub { system(qw(pkg info -q), $_[0]) == 0 },
 	deb => sub { system("dpkg -s $_[0] >/dev/null 2>&1") == 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 },
 );
 
@@ -139,7 +151,7 @@ my (@pkg_install, @pkg_remove, %all);
 for my $ary (values %$profiles) {
 	$all{$_} = \@pkg_remove for @$ary;
 }
-if ($^O =~ /\A(?:free|open)bsd\z/) {
+if ($^O =~ /\A(?:free|net|open)bsd\z/) {
 	$all{'IO::KQueue'} = \@pkg_remove;
 }
 $profiles->{all} = [ keys %all ]; # pseudo-profile for all packages
@@ -184,6 +196,12 @@ if ($pkg_fmt eq 'deb') {
 	root(qw(pkg remove -y), @quiet, @pkg_remove) if @pkg_remove;
 	root(qw(pkg install -y), @quiet, @pkg_install) if @pkg_install;
 	root(qw(pkg autoremove -y), @quiet);
+} elsif ($pkg_fmt eq 'pkgin') { # NetBSD
+	my @quiet = $ENV{V} ? ('-'.('V'x$ENV{V})) : ();
+	exclude_uninstalled(\@pkg_remove);
+	root(qw(pkgin -y), @quiet, 'remove', @pkg_remove) if @pkg_remove;
+	root(qw(pkgin -y), @quiet, 'install', @pkg_install) if @pkg_install;
+	root(qw(pkgin -y), @quiet, 'autoremove');
 # TODO: yum / rpm support
 } elsif ($pkg_fmt eq 'rpm') {
 	my @quiet = $ENV{V} ? () : ('-q');
@@ -229,7 +247,7 @@ sub pkg2ospkg {
 		} elsif ($fmt eq 'rpm') {
 			$pkg =~ s/::/-/g;
 			return "perl-$pkg"
-		} elsif ($fmt =~ /\Apkg(?:_add)?\z/) {
+		} elsif ($fmt =~ /\Apkg(?:_add|in)?\z/) {
 			$pkg =~ s/::/-/g;
 			return "p5-$pkg"
 		} else {
diff --git a/ci/profiles.perl b/ci/profiles.perl
index 3d67143a..5b441790 100755
--- a/ci/profiles.perl
+++ b/ci/profiles.perl
@@ -56,7 +56,8 @@ EOM
 }
 my $PKG_FMT = do {
 	if ($ID eq 'freebsd') { 'pkg' }
-	# *shrug*, as long as the name doesn't conflict with FreeBSD's
+	# *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' }
 	elsif ($ID =~ m!\A(?:debian|ubuntu)\z!) { 'deb' }
 	elsif ($ID =~ m!\A(?:centos|redhat|fedora)\z!) { 'rpm' }
@@ -65,7 +66,8 @@ my $PKG_FMT = do {
 
 # these package group names and '-' syntax are passed to ci/deps.perl
 my $TASKS = do {
-	if ($ID eq 'freebsd') { <<EOM
+	if ($ID =~ /\A(?:free|net|open)bsd\z/) { <<EOM
+all devtest Search::Xapian-
 all devtest IO::KQueue-
 all devtest IO::KQueue
 all devtest Inline::C-
@@ -83,12 +85,6 @@ EOM
 v2essential devtest
 essential devtest
 all Search::Xapian-
-EOM
-	} elsif ($ID eq 'openbsd') { <<EOM
-all devtest Inline::C-
-all devtest Inline::C
-all devtest IO::KQueue-
-all devtest IO::KQueue
 EOM
 	} else { die "TODO: support ID=$ID VERSION_ID=$VERSION_ID" }
 };

  parent reply	other threads:[~2023-09-09 12:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09 12:01 [PATCH 0/8] NetBSD-related updates Eric Wong
2023-09-09 12:01 ` [PATCH 1/8] Makefile.PL: check `getconf NPROCESSORS_ONLN', too Eric Wong
2023-09-09 12:01 ` [PATCH 2/8] ipc: define _SC_NPROCESSORS_ONLN for NetBSD Eric Wong
2023-09-09 12:01 ` [PATCH 3/8] ci/run.sh: parameterize BUILD_JOBS TEST_JOBS and TEST_TARGET Eric Wong
2023-09-09 12:01 ` [PATCH 4/8] ci/profiles: rewrite in Perl Eric Wong
2023-09-09 21:14   ` [SQUASH] manifest update Eric Wong
2023-09-09 12:01 ` Eric Wong [this message]
2023-09-09 12:01 ` [PATCH 6/8] xap_helper: note __cleanup__ works with C++ exceptions Eric Wong
2023-09-16 13:10   ` [PATCH] xap_helper: test cleanup + throw support in C++ Eric Wong
2023-09-09 12:01 ` [PATCH 7/8] xap_helper: use _OPENBSD_SOURCE on NetBSD for reallocarray Eric Wong
2023-09-09 12:01 ` [PATCH 8/8] xap_helper: clamp workers to USHRT_MAX 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: https://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=20230909120142.1041752-6-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).