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 7/8] install/deps: more fixes
Date: Mon, 18 Sep 2023 10:15:15 +0000	[thread overview]
Message-ID: <20230918101516.2477899-8-e@80x24.org> (raw)
In-Reply-To: <20230918101516.2477899-1-e@80x24.org>

We need to mark *-dev packages as optional, and ignore
dependency-only packages in the `optional' field.

Furthermore, make the output less confusing when there's neither
packages to install nor remove; and avoid invoking `apt-get install'
with an empty package list.

This also fixes an OpenBSD-specific regression from commit 82990fb72dac
which made package removal a no-op.

Fixes: 82990fb72dac (install/deps: flesh out libgit2, SQLite, and Xapian packages)
---
 install/deps.perl | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/install/deps.perl b/install/deps.perl
index 900668c7..65547f9d 100755
--- a/install/deps.perl
+++ b/install/deps.perl
@@ -48,7 +48,8 @@ my $profiles = {
 		URI
 		), @test_essential ],
 
-	# everything optional for normal use
+	# Everything else is optional for normal use.  Only specify
+	# the minimum to pull in dependencies here:
 	optional => [ qw(
 		Date::Parse
 		BSD::Resource
@@ -63,11 +64,14 @@ my $profiles = {
 		Xapian
 		curl
 		highlight.pm
-		libxapian
-		pkg-config
+		libgit2-dev
+		libxapian-dev
 		sqlite3
 		xapian-tools
 		) ],
+		# no pkg-config, libsqlite3, libxapian, libz, etc. since
+		# they'll get pulled in lib*-dev, DBD::SQlite and
+		# Xapian(.pm)  respectively
 
 	# optional developer stuff
 	devtest => [ qw(
@@ -279,6 +283,8 @@ my (%add, %rm); # uniquify lists
 		!$add{$_} && !$rm{$_}++ && $INST_CHECK->($_)
 	} @pkg_remove : ();
 
+(@pkg_remove || @pkg_install) or warn "# no packages to install nor remove\n";
+
 # OS-specific cleanups appreciated
 if ($pkg_fmt eq 'deb') {
 	my @apt_opt = qw(-o APT::Install-Recommends=false
@@ -288,7 +294,7 @@ if ($pkg_fmt eq 'deb') {
 		@pkg_install,
 		# apt-get lets you suffix a package with "-" to
 		# remove it in an "install" sub-command:
-		map { "$_-" } @pkg_remove);
+		map { "$_-" } @pkg_remove) if (@pkg_remove || @pkg_install);
 	root('apt-get', @apt_opt, qw(autoremove)) if $opt->{'allow-remove'};
 } elsif ($pkg_fmt eq 'pkg') { # FreeBSD
 	my @pkg_opt = $opt->{yes} ? qw(-y) : ();
@@ -309,9 +315,10 @@ 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
-	root(qw(pkg_delete -a), @pkg_opt); # autoremove unspecified
+	root(qw(pkg_delete), @pkg_opt, @pkg_remove) if @pkg_remove;
 	@pkg_install = map { "$_--" } @pkg_install; # disambiguate w3m
 	root(qw(pkg_add), @pkg_opt, @pkg_install) if @pkg_install;
+	root(qw(pkg_delete -a), @pkg_opt) if $opt->{'allow-remove'};
 } else {
 	die "unsupported package format: $pkg_fmt\n";
 }

  parent reply	other threads:[~2023-09-18 10:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 10:15 [PATCH 0/8] portability odds and ends Eric Wong
2023-09-18 10:15 ` [PATCH 1/8] ci/run: favor `make check' as the default target Eric Wong
2023-09-18 10:15 ` [PATCH 2/8] drop GNU nproc(1) support in favor of getconf(1) Eric Wong
2023-09-18 10:15 ` [PATCH 3/8] ipc: assume SOCK_SEQPACKET exists Eric Wong
2023-09-18 10:15 ` [PATCH 4/8] rename t/run.perl to xt/check-run Eric Wong
2023-09-18 10:15 ` [PATCH 5/8] makefile: avoid needless use of double-colon rules Eric Wong
2023-09-18 10:15 ` [PATCH 6/8] pop3d: split @FLOCK into $FLOCK_TMPL and @FLOCK_ORDER Eric Wong
2023-09-18 10:15 ` Eric Wong [this message]
2023-09-18 10:15 ` [PATCH 8/8] makefile: avoid non-POSIX which(1) 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=20230918101516.2477899-8-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).