summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2022-04-27 15:19:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2022-04-27 15:19:04 +0000
commit534f75ab10e112398cf9e1237c4e4363e27d46f2 (patch)
tree795150cdf6d77d1dd812d521031f5f5c18cd8780 /usr.sbin/pkg_add
parentc7e54f67111037b2bcb75fe375219cca2a3cebb0 (diff)
split the code in figure_out_kept:
we need a somewhat complete updateset so we can proceed with handling dependencies. The case where the signature is equal is not an issue, but the case where we need to keep the package because it still contains oldlibs is! So we do that AFTER dependencies so that dependencies have been updated and we possibly depend on old libs (which may happen even if the signature didn't change)
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm27
1 files changed, 21 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index 8d43eb9f7c9..07079549813 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.128 2022/04/16 09:32:40 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.129 2022/04/27 15:19:03 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -331,9 +331,6 @@ sub display_timestamp
sub find_kept_handle
{
my ($set, $n, $state) = @_;
- unless (defined $n->{location} && defined $n->{location}{update_info}) {
- $n->complete($state);
- }
my $plist = $n->dependency_info;
return if !defined $plist;
my $pkgname = $plist->pkgname;
@@ -385,6 +382,23 @@ sub figure_out_kept
}
}
+sub precomplete_handle
+{
+ my ($set, $n, $state) = @_;
+ unless (defined $n->{location} && defined $n->{location}{update_info}) {
+ $n->complete($state);
+ }
+}
+
+sub precomplete
+{
+ my ($set, $state) = @_;
+
+ for my $n ($set->newer) {
+ $set->precomplete_handle($n, $state);
+ }
+}
+
sub complete
{
my ($set, $state) = @_;
@@ -950,6 +964,7 @@ sub process_set
return ();
}
+ $set->precomplete($state);
for my $handle ($set->newer) {
if ($state->tracker->is_installed($handle->pkgname)) {
$set->move_kept($handle);
@@ -957,8 +972,6 @@ sub process_set
}
}
- $set->figure_out_kept($state);
-
if (newer_has_errors($set, $state)) {
return ();
}
@@ -973,6 +986,8 @@ sub process_set
return (@deps, $set);
}
+ $set->figure_out_kept($state);
+
if ($set->newer == 0 && $set->older_to_do == 0) {
$state->tracker->uptodate($set);
return ();