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,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 80E0F1F56A for ; Mon, 18 Sep 2023 10:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1695032117; bh=tB7Sa888FBK7SOBQ4P3cqxpC+2dfJcaxA9TndIno/N0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=3ZapYTqTOK3XYxwqkBfLLQvzTIfNQhJPkpOqfbw2YtIN2Bx2bB8fmf5m7pMvYe6G4 SsLoOtQxN8ffgqUKzBJH7OT4z7uZmUL7BK1EyrE8tEbqKeVjDPJJLbTkrsQqzGkQhN SHIpazOmJTS5uEZRZO8YPNmwS1gJFCvVgx/x0CkI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/8] install/deps: more fixes Date: Mon, 18 Sep 2023 10:15:15 +0000 Message-ID: <20230918101516.2477899-8-e@80x24.org> In-Reply-To: <20230918101516.2477899-1-e@80x24.org> References: <20230918101516.2477899-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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"; }