dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] ci/deps: redo and fix essential package handling
Date: Fri,  8 Sep 2023 22:30:47 +0000	[thread overview]
Message-ID: <20230908223047.54276-1-e@80x24.org> (raw)

git depends on p5-TimeDate on FreeBSD, too, so ensure git
doesn't get uninstalled on FreeBSD.  Instead of making
@precious a separate array, we can actually stuff dependencies
into the $non_auto map and save us some code.

We can also eliminate some duplication in $non_auto by
populating the Perl standard library packages in a loop.
---
 ci/deps.perl | 59 ++++++++++++++--------------------------------------
 1 file changed, 16 insertions(+), 43 deletions(-)

diff --git a/ci/deps.perl b/ci/deps.perl
index ea46b789..68b602ef 100755
--- a/ci/deps.perl
+++ b/ci/deps.perl
@@ -54,32 +54,18 @@ my $profiles = {
 		) ],
 };
 
-# account for granularity differences between package systems and OSes
-# curl, TimeDate (Date::Parse) and Socket6 are dependencies of git on
-# some/most OSes
-my @precious = do {
-	if ($^O eq 'freebsd') { qw(curl Socket6) }
-	elsif ($pkg_fmt eq 'rpm') { qw(curl) }
-	# OpenBSD git depends on Date::Parse (p5-Time-TimeDate) indirectly,
-	elsif ($^O eq 'openbsd') { qw(curl Socket6 Date::Parse) }
-	else { () }
-};
-
-if (@precious) {
-	my $re = join('|', map { quotemeta($_) } @precious);
-	for my $list (values %$profiles) {
-		@$list = grep(!/\A(?:$re)\z/, @$list);
-	}
-	push @{$profiles->{essential}}, @precious;
-}
-
-
 # bare minimum for v2
 $profiles->{v2essential} = [ @{$profiles->{essential}}, qw(DBD::SQLite DBI) ];
 
-# package names which can't be mapped automatically:
+# package names which can't be mapped automatically and explicit
+# dependencies to prevent essential package removal:
 my $non_auto = {
-	'perl' => {
+	git => {
+		pkg => [ qw(curl p5-Socket6 p5-TimeDate git) ],
+		rpm => [ qw(curl git) ],
+		pkg_add => [ qw(curl p5-Socket6 p5-Time-TimeDate git) ],
+	},
+	perl => {
 		pkg => 'perl5',
 		pkg_add => [], # Perl is part of OpenBSD base
 	},
@@ -89,22 +75,6 @@ my $non_auto = {
 		rpm => 'perl-TimeDate',
 		pkg_add => 'p5-Time-TimeDate',
 	},
-	'Digest::SHA' => {
-		deb => 'perl', # libperl5.XX, but the XX varies
-		pkg => 'perl5',
-	},
-	'Encode' => {
-		deb => 'perl', # libperl5.XX, but the XX varies
-		pkg => 'perl5',
-	},
-	'ExtUtils::MakeMaker' => {
-		deb => 'perl', # perl-modules-5.xx
-		pkg => 'perl5',
-	},
-	'IO::Compress' => {
-		deb => 'perl', # perl-modules-5.xx
-		pkg => 'perl5',
-	},
 	'Inline::C' => {
 		pkg_add => 'p5-Inline', # tested OpenBSD 7.3
 		rpm => 'perl-Inline', # for CentOS 7.x, at least
@@ -119,10 +89,6 @@ my $non_auto = {
 		pkg_add => [qw(xapian-core xapian-bindings-perl)],
 		rpm => 'Search::Xapian', # 3rd-party repo
 	},
-	'Test::Simple' => {
-		deb => 'perl', # perl-modules-5.XX, but the XX varies
-		pkg => 'perl5',
-	},
 	'highlight.pm' => {
 		deb => 'libhighlight-perl',
 		pkg => [],
@@ -143,7 +109,14 @@ my $non_auto = {
 	},
 };
 
-# OpenBSD and FreeBSD both use "p5-".($CPAN_NAME =~ s/::/-/gr)
+# standard library stuff that CentOS 7.x (and presumably other RPM) split out:
+for (qw(Digest::SHA Encode ExtUtils::MakeMaker IO::Compress Test::Simple)) {
+	$non_auto->{$_} = {
+		deb => 'perl', # libperl5.XX, but the XX varies
+		pkg => 'perl5',
+	};
+}
+
 if ($pkg_fmt eq 'pkg_add') {
 	for my $name (keys %$non_auto) {
 		my $fbsd_pkg = $non_auto->{$name}->{pkg};

                 reply	other threads:[~2023-09-08 22:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230908223047.54276-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.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.
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).