diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-14 09:29:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-14 09:29:08 +0000 |
commit | 868e330e506634b9491f6787def9b46ae30e21c4 (patch) | |
tree | beb31e58f8399b1e38cc98ab60974cec65f49a0e /usr.sbin/pkg_add/OpenBSD/Update.pm | |
parent | d959f7a5147102b79c470ed749417fe66dfc436e (diff) |
simplify updater slightly
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Update.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 60 |
1 files changed, 25 insertions, 35 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 46f8bf5df51..5c3fc71d5bc 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.74 2007/05/13 16:58:13 espie Exp $ +# $OpenBSD: Update.pm,v 1.75 2007/05/14 09:29:07 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -124,50 +124,40 @@ sub process_package $self->add2cant($pkgname); return; } - if (@l == 1 && $state->{forced}->{pkgpath}) { - OpenBSD::ProgressMeter::clear(); - print "Directly updating $pkgname -> ", $l[0], "\n"; - $self->add2updates($l[0]); - return; - } - - if (defined $found && @l == 1 && $found eq $l[0]) { - if (!$plist->uses_old_libs) { - my $msg = "No need to update $pkgname"; - OpenBSD::ProgressMeter::message($msg); - print "$msg\n" if $state->{beverbose}; + if (@l == 1) { + if ($state->{forced}->{pkgpath}) { + OpenBSD::ProgressMeter::clear(); + print "Directly updating $pkgname -> ", $l[0], "\n"; + $self->add2updates($l[0]); return; } + if (defined $found && $found eq $l[0] && + !$plist->uses_old_libs) { + my $msg = "No need to update $pkgname"; + OpenBSD::ProgressMeter::message($msg); + print "$msg\n" if $state->{beverbose}; + return; + } } + OpenBSD::ProgressMeter::clear(); print "Candidates for updating $pkgname -> ", join(' ', @l), "\n"; - # if all packages have the same version, but distinct p, - # grab the most recent. - if (@l > 1) { - @l = OpenBSD::PackageName::keep_most_recent(@l); - } if (@l == 1) { - if (defined $found && $found eq $l[0] && !$plist->uses_old_libs) { - my $msg = "No need to update $pkgname"; - OpenBSD::ProgressMeter::message($msg); - print "$msg\n" if $state->{beverbose}; + $self->add2updates($l[0]); + return; + } + my $result = OpenBSD::Interactive::choose1($pkgname, + $state->{interactive}, sort @l); + if (defined $result) { + if (defined $found && $found eq $result && + !$plist->uses_old_libs) { + print "No need to update $pkgname\n"; } else { - $self->add2updates($l[0]); + $self->add2updates($result); } - } elsif (@l == 0) { - $self->add2cant($pkgname); } else { - my $result = OpenBSD::Interactive::choose1($pkgname, $state->{interactive}, sort @l); - if (defined $result) { - if (defined $found && $found eq $result && !$plist->uses_old_libs) { - print "No need to update $pkgname\n"; - } else { - $self->add2updates($result); - } - } else { - $state->{issues} = 1; - } + $state->{issues} = 1; } } |